stanford-policylab / surveilling-surveillance

Codebase for "Surveilling Surveillance: Estimating the Prevalence of Surveillance Cameras with Street View Data"
https://policylab.stanford.edu/surveillance/
MIT License
16 stars 1 forks source link

Faster RCNN model that you provide does not work when we load it in for testing? Any idea #1

Open Haiduri98 opened 11 months ago

Haiduri98 commented 11 months ago

/home/hinux/anaconda3/bin/conda run -n 38 --no-capture-output python /home/hinux/pythonProject/surveilling-surveillance/detection/main.py Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (81, 1024) in the checkpoint but (3, 1024) in the model! You might want to double check if this is expected. Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (81,) in the checkpoint but (3,) in the model! You might want to double check if this is expected. Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (320, 1024) in the checkpoint but (8, 1024) in the model! You might want to double check if this is expected. Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (320,) in the checkpoint but (8,) in the model! You might want to double check if this is expected. Some model parameters or buffers are not found in the checkpoint: roi_heads.box_predictor.bbox_pred.{bias, weight} roi_heads.box_predictor.cls_score.{bias, weight} Traceback (most recent call last): File "/home/hinux/pythonProject/surveilling-surveillance/detection/main.py", line 117, in test(ckpt_path="../data/best.ckpt") File "/home/hinux/pythonProject/surveilling-surveillance/detection/main.py", line 100, in test task = load_task(ckpt_path="../data/best.ckpt", File "/home/hinux/pythonProject/surveilling-surveillance/detection/lightning/init.py", line 13, in load_task return DetectionTask.load_from_checkpoint(ckpt_path, kwargs) File "/home/hinux/anaconda3/envs/38/lib/python3.8/site-packages/pytorch_lightning/core/saving.py", line 158, in load_from_checkpoint model = cls._load_model_state(checkpoint, strict=strict, kwargs) File "/home/hinux/anaconda3/envs/38/lib/python3.8/site-packages/pytorch_lightning/core/saving.py", line 204, in _load_model_state model.load_state_dict(checkpoint['state_dict'], strict=strict) File "/home/hinux/anaconda3/envs/38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DetectionTask: Unexpected key(s) in state_dict: "model.model.proposal_generator.anchor_generator.cell_anchors.0", "model.model.proposal_generator.anchor_generator.cell_anchors.1", "model.model.proposal_generator.anchor_generator.cell_anchors.2", "model.model.proposal_generator.anchor_generator.cell_anchors.3", "model.model.proposal_generator.anchor_generator.cell_anchors.4". ERROR conda.cli.main_run:execute(49): conda run python /home/hinux/pythonProject/surveilling-surveillance/detection/main.py failed. (See above for error)

Process finished with exit code 1

Haiduri98 commented 11 months ago

I found out that we need to use Detectron2 version 0.4 - which is not given in the requirements Pytorch Lightning 1.1.4 (13-10-2023)