question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RetinaFace test.py RuntimeError: softmax_label is not presented

See original GitHub issue

Hello guys,

After everything is set well, I start to run the demo test.py. But met this type of error:

[32, 16, 8] {‘32’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (32, 16)}, ‘8’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (2, 1)}, ‘16’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (8, 4)}} [14:02:42] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v0.8.0. Attempting to upgrade… [14:02:42] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded! means [0. 0. 0.] use_landmarks False sym size: 1 Traceback (most recent call last): File “./insightface-master/RetinaFace/test.py”, line 15, in <module> detector = RetinaFace(‘./model/imagenet-resnet-152/resnet-152’, 0, gpuid, ‘net3’) File “./insightface-master/RetinaFace/retinaface.py”, line 139, in init self.model.set_params(arg_params, aux_params) File “~/.virtualenvs/mxnet_py2/local/lib/python2.7/site-packages/mxnet/module/module.py”, line 350, in set_params allow_extra=allow_extra) File “~/.virtualenvs/mxnet_py2/local/lib/python2.7/site-packages/mxnet/module/module.py”, line 309, in init_params _impl(desc, arr, arg_params) File “~/.virtualenvs/mxnet_py2/local/lib/python2.7/site-packages/mxnet/module/module.py”, line 300, in _impl raise RuntimeError(“%s is not presented” % name) RuntimeError: softmax_label is not presented

I found solutions on some webpages like:

Adding arg_params['softmax_label'] = mx.nd.array([0]) before self.model.set_params(arg_params, aux_params)

After doing that another error occurs:

[32, 16, 8] {‘32’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (32, 16)}, ‘8’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (2, 1)}, ‘16’: {‘ALLOWED_BORDER’: 9999, ‘BASE_SIZE’: 16, ‘RATIOS’: (1.0,), ‘SCALES’: (8, 4)}} [14:03:23] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v0.8.0. Attempting to upgrade… [14:03:23] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded! means [0. 0. 0.] use_landmarks False sym size: 1 (1104, 736, 3) (‘im_scale’, 1.391304347826087) [14:03:24] src/operator/nn/./cudnn/./cudnn_algoreg-inl.h:97: Running performance tests to find the best convolution algorithm, this can take a while… (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable) Traceback (most recent call last): File “/home/zhaocy/chenyang/insightface_chenyang/insightface-master/RetinaFace/test.py”, line 37, in <module> faces, landmarks = detector.detect(img, thresh, scales=scales, do_flip=flip) File “/home/zhaocy/chenyang/insightface_chenyang/insightface-master/RetinaFace/retinaface.py”, line 229, in detect scores = scores[:, self._num_anchors[‘stride%s’%s]:, :, :] IndexError: too many indices for array

I found that the shape of scores is 1*11586 at that point which may lead this error.

Anyone can explain these?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

2reactions
levotreacommented, Jul 5, 2019

As answered by @nttstar in #760 :

You may download the wrong models. Pre-trained models under Train section is just used for training and parameters initialization.

which is also what I explained in my previous answer, if you just want to use test.py without training a model beforehand, then you have to use a pretrained model : https://www.dropbox.com/s/53ftnlarhyrpkg2/retinaface-R50.zip?dl=0.

You will have to place the model in the models folder and modify the detector line in test.py : detector = RetinaFace("/xxx/insightface-master/models/retinaface-R50/R50", 0, gpuid, 'net3'), where “xxx” is the path to your insightface-master folder.

0reactions
mtydmmcommented, Dec 9, 2019

As answered by @nttstar in #760 :

You may download the wrong models. Pre-trained models under Train section is just used for training and parameters initialization.

which is also what I explained in my previous answer, if you just want to use test.py without training a model beforehand, then you have to use a pretrained model : https://www.dropbox.com/s/53ftnlarhyrpkg2/retinaface-R50.zip?dl=0.

You will have to place the model in the models folder and modify the detector line in test.py : detector = RetinaFace("/xxx/insightface-master/models/retinaface-R50/R50", 0, gpuid, 'net3'), where “xxx” is the path to your insightface-master folder.

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found