facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.27k stars 5.46k forks source link

ROI Error in Keypoint infer_simple #149

Closed tarlen5 closed 6 years ago

tarlen5 commented 6 years ago

Hi, thanks in advance for this great codebase and for considering this issue.

Expected results

I'm trying to run tools/infer_simple.py on the demo directory for keypoint detection using the baseline models in the model zoo. All of the configs/12_2017_baselines/e2e_keypoint_rcnn_*.yaml models do work for me, but none of the configs/12_2017_baselines/keypoint_rcnn_*.yaml work, all throwing the same KeyError, described in the next section.

Actual results

I get a KeyError when it tries to perform the first inference on the first image, with the following Traceback:

Traceback (most recent call last):
  File "tools/infer_simple.py", line 147, in <module>
    main(args)
  File "tools/infer_simple.py", line 117, in main
    model, im, None, timers=timers
  File "/home/ubuntu/local/detectron/lib/core/test.py", line 65, in im_detect_all
    scores, boxes, im_scales = im_detect_bbox(model, im, box_proposals)
  File "/home/ubuntu/local/detectron/lib/core/test.py", line 141, in im_detect_bbox
    hashes = np.round(inputs['rois'] * cfg.DEDUP_BOXES).dot(v)
KeyError: u'rois'

Detailed steps to reproduce

E.g.:

python tools/infer_simple.py demo \
--cfg configs/12_2017_baselines/keypoint_rcnn_X-101-64x4d-FPN_1x.yaml \
--output-dir /home/ubuntu/data/computer-vision/internal_experiments/detectron-demo \
--image-ext jpg \
--wts https://s3-us-west-2.amazonaws.com/detectron/37731079/12_2017_baselines/keypoint_rcnn_X-101-64x4d-FPN_1x.yaml.16_40_56.wj7Hg7lX/output/train/keypoints_coco_2014_train%3Akeypoints_coco_2014_valminusminival/generalized_rcnn/model_final.pkl

System information

rbgirshick commented 6 years ago

You can only use the e2e* models with infer_simple.py; otherwise you'd need to provide externally computed region proposals, as in Fast R-CNN.

gadcam commented 6 years ago

I also had this problem. @rbgirshick I think it would be useful to add a line about it in GETTING_STARTED.md and maybe another on how to run other models, what do you think ?

ccs1605 commented 6 years ago

@tarlen5 how did you locate -wts http url from eg: keypoint_rcnn_X-101-64x4d-FPN_1x.yaml?

tarlen5 commented 6 years ago

Hi @ccs1605. To find these weights you go to the Model Zoo page:

https://github.com/facebookresearch/Detectron/blob/master/MODEL_ZOO.md#keypoint-only-mask-r-cnn-baselines-using-precomputed-rpn-proposals

And then find the section you're interested in (the documentation is very clear here). Then find the link to the weights file in the far right column "download links". So for keypoint_rcnn_X-101-64x4d-FPN_1x.yaml you'd have:

https://s3-us-west-2.amazonaws.com/detectron/37731079/12_2017_baselines/keypoint_rcnn_X-101-64x4d-FPN_1x.yaml.16_40_56.wj7Hg7lX/output/train/keypoints_coco_2014_train%3Akeypoints_coco_2014_valminusminival/generalized_rcnn/model_final.pkl

ccs1605 commented 6 years ago

thank you! it works like a charm.

Markovcom commented 6 years ago

@rbgirshick can you give an example ? thanks!