Detectron2: incompatible.missing_keys.remove(k). AttributeError: 'NoneType' object has no attribute 'missing_keys'

Created on 21 Apr 2020  路  5Comments  路  Source: facebookresearch/detectron2

Instructions To Reproduce the Issue:

  1. Try to install detectron2 at 21 April 2020 1:25PM (GMT+8). I try to run simple demo code using this command below
python3.7 demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml --input input1.jpg input2.jpg --opts MODEL.WEIGHTS /media/ion/ioNdrive/detectron2/weights/model_final_a54504.pkl
  1. and I get this error
[04/21 13:12:35 detectron2]: Arguments: Namespace(confidence_threshold=0.5, config_file='../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml', input=['input1.jpg', 'input2.jpg'], opts=['MODEL.WEIGHTS', '/media/ion/ioNdrive/detectron2/weights/model_final_a54504.pkl'], output=None, video_input=None, webcam=False)
[04/21 13:12:38 fvcore.common.checkpoint]: Loading checkpoint from /media/ion/ioNdrive/detectron2/weights/model_final_a54504.pkl
[04/21 13:12:38 fvcore.common.checkpoint]: Reading a file from 'Detectron2 Model Zoo'
[04/21 13:12:38 fvcore.common.checkpoint]: Some model parameters are not in the checkpoint:
  pixel_std
  pixel_mean
Traceback (most recent call last):
  File "demo.py", line 79, in <module>
    demo = VisualizationDemo(cfg)
  File "/media/ion/ioNdrive/detectron2/demo/predictor.py", line 35, in __init__
    self.predictor = DefaultPredictor(cfg)
  File "/media/ion/ioNdrive/detectron2/detectron2/engine/defaults.py", line 185, in __init__
    checkpointer.load(cfg.MODEL.WEIGHTS)
  File "/home/ion/.local/lib/python3.7/site-packages/fvcore/common/checkpoint.py", line 104, in load
    self._load_model(checkpoint)
  File "/media/ion/ioNdrive/detectron2/detectron2/checkpoint/detection_checkpoint.py", line 68, in _load_model
    incompatible.missing_keys.remove(k)
AttributeError: 'NoneType' object has no attribute 'missing_keys'
  1. I am managed to solve it by comment some code at line 59-71 in THE_REPO/detectron2/checkpoint/detection_checkpoint.py. and add this code
super()._load_model(checkpoint)
  1. So, here is the question. Is it okay? or How to solve this problem properly?

Thank you very much.

best regards,
Albert Christianto

installation / environment

Most helpful comment

You need the latest version of fvcore.

All 5 comments

You need the latest version of fvcore.

hi, @ppwwyyxx.
thanks for the fast response.

what is the latest version of fvcore?

my fvcore version is '0.1.dev200420'. I followed the detectron2 readme installation, so it didn't install the latest version?
thank you very much.

best regards,
Albert Christianto

You actually need latest version from github: https://github.com/facebookresearch/fvcore#3-install-from-github
It seems the latest package hasn't been uploaded yet

Hi @ppwwyyxx
yes, you are right the latest version of fvcore hasn't been uploaded yet.
I have installed the latest version of fvcore from github and it works very well.
thank you very much for your tips and hospitality.
best regards,
Albert Christianto

update: the latest master of detectron2 (273e3b9746473a7469550bf793bbfb4c0a47c7d5) should work with older version of fvcore (at the cost of extra warnings)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AntonBaumannDE picture AntonBaumannDE  路  3Comments

jinfagang picture jinfagang  路  3Comments

aminekechaou picture aminekechaou  路  3Comments

joeythegod picture joeythegod  路  4Comments

choasup picture choasup  路  3Comments