Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could you help me this problem? #21

Open
SamXiaosheng opened this issue Dec 8, 2022 · 6 comments
Open

could you help me this problem? #21

SamXiaosheng opened this issue Dec 8, 2022 · 6 comments

Comments

@SamXiaosheng
Copy link

File "/data/sam/Meta-Faster-R-CNN-main/meta_faster_rcnn/modeling/fsod/fsod_fast_rcnn.py", line 112, in fsod_fast_rcnn_inference_single_image
scores = scores.reshape(cls_num, box_num).permute(1, 0)
RuntimeError: shape '[20, 645]' is invalid for input of size 12912

@GuangxingHan
Copy link
Owner

Can you please share more information about your process, e.g., the log file? which stage are you in?

@SamXiaosheng
Copy link
Author

SamXiaosheng commented Dec 9, 2022 via email

@GuangxingHan
Copy link
Owner

Can you please share with me your training log to see what happened there? Thanks.

@SamXiaosheng
Copy link
Author

[12/08 17:53:30] d2.data.datasets.coco INFO: Loading datasets/coco/annotations/instances_val2014.json takes 4.73 seconds.
[12/08 17:53:30] d2.data.datasets.coco INFO: Loaded 40504 images in COCO format from datasets/coco/annotations/instances_val2014.json
[12/08 17:53:33] d2.data.build INFO: Distribution of instances among all 80 categories:

category #instances category #instances category #instances
person 86348 bicycle 2458 car 14898
motorcycle 3049 airplane 1444 bus 2023
train 1602 truck 3337 boat 3543
traffic light 4351 fire hydrant 650 stop sign 686
parking meter 510 bench 3490 bird 3852
cat 1669 dog 1951 horse 2187
sheep 3119 cow 2788 elephant 1856
bear 462 zebra 1877 giraffe 1767
backpack 2890 umbrella 3919 handbag 4113
tie 2234 suitcase 2219 frisbee 935
skis 2180 snowboard 793 sports ball 2198
kite 2770 baseball bat 1020 baseball gl.. 1206
skateboard 1705 surfboard 2227 tennis racket 1626
bottle 8282 wine glass 2620 cup 7010
fork 1775 knife 2555 spoon 2130
bowl 4903 banana 2854 apple 1761
sandwich 1457 orange 2057 broccoli 2679
carrot 2646 hot dog 1010 pizza 2097
donut 2474 cake 2097 chair 12987
couch 1927 potted plant 3069 bed 1450
dining table 5237 toilet 1462 tv 2057
laptop 1781 mouse 850 remote 1863
keyboard 1028 cell phone 2233 microwave 539
oven 1175 toaster 78 sink 1901
refrigerator 888 book 8342 clock 2271
vase 2251 scissors 441 teddy bear 1522
hair drier 74 toothbrush 630
total 288415
[12/08 17:53:33] d2.data.common INFO: Serializing 40504 elements to byte tensors and concatenating them all ...
[12/08 17:53:34] d2.data.common INFO: Serialized dataset takes 153.61 MiB
[12/08 17:53:39] d2.evaluation.evaluator INFO: Start inference on 20252 images
[12/08 17:53:52] d2.engine.train_loop ERROR: Exception during training:
Traceback (most recent call last):
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 135, in train
self.after_step()

File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 165, in after_step
h.after_step()
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/engine/hooks.py", line 353, in after_step
self._do_eval()
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/engine/hooks.py", line 328, in _do_eval
results = self._func()
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 366, in test_and_save_results
self._last_eval_results = self.test(self.cfg, self.model)
File "/data/sam/FCT-main/fsod_mpvit_rcnn_train_net.py", line 197, in test
results_i = inference_on_dataset(model, data_loader, evaluator)
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/detectron2/evaluation/evaluator.py", line 141, in inference_on_dataset
outputs = model(inputs)
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 619, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_mpvit_rcnn.py", line 150, in forward
return self.inference(batched_inputs)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_mpvit_rcnn.py", line 471, in inference
results, _ = self.roi_heads.eval_with_support(query_images, query_features_dict, support_proposals_dict, support_box_features_dict)
File "/data/anaconda3/envs/FCT_cu110/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_cross_mpvit_roi_heads.py", line 287, in eval_with_support
pred_instances, _ = self.box_predictor.inference(pred_cls, predictions, proposals)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_fast_rcnn.py", line 562, in inference
self.test_topk_per_image,
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_fast_rcnn.py", line 80, in fsod_fast_rcnn_inference
for pred_cls_per_image, scores_per_image, boxes_per_image, image_shape in zip(pred_cls, scores, boxes, image_shapes)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_fast_rcnn.py", line 80, in
for pred_cls_per_image, scores_per_image, boxes_per_image, image_shape in zip(pred_cls, scores, boxes, image_shapes)
File "/data/sam/FCT-main/FCT/modeling/fsod/fsod_fast_rcnn.py", line 111, in fsod_fast_rcnn_inference_single_image
scores = scores.reshape(cls_num, box_num).permute(1, 0)
RuntimeError: shape '[20, 653]' is invalid for input of size 13064

@GuangxingHan
Copy link
Owner

GuangxingHan commented Dec 9, 2022

Thanks. But it is hard to see anything here. Have you modified the config file or the related source codes?

Also, could you also print the shape/value of scores, cls_num, box_num to manually check the logic of the codes?

@SamXiaosheng
Copy link
Author

i modify cls_num = pred_cls.shape[0]#pred_cls.unique().shape[0] in fsod_fast_rcnn.py file line 108 ,and it can work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants