RetinaFace test.py RuntimeError: softmax_label is not presented
See original GitHub issueHello 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:
- Created 4 years ago
- Reactions:4
- Comments:8
As answered by @nttstar in #760 :
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 thedetector
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