aim-uofa / AdelaiDet

AdelaiDet is an open source toolbox for multiple instance-level detection and recognition tasks.
https://git.io/AdelaiDet
Other
3.38k stars 648 forks source link

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. #236

Open MrChangJiang opened 3 years ago

MrChangJiang commented 3 years ago

File "/home/user/.conda/envs/detectron/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "/home/user/AdelaiDet/adet/modeling/one_stage_detector.py", line 47, in forward processed_results = super().forward(batched_inputs) File "/home/user/detectron2/detectron2/modeling/meta_arch/rcnn.py", line 285, in forward proposals, proposal_losses = self.proposal_generator(images, features, gt_instances) File "/home/user/.conda/envs/detectron/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, **kwargs) File "/home/user/AdelaiDet/adet/modeling/fcos/fcos.py", line 105, in forward locations, images.image_sizes, top_feats File "/home/user/AdelaiDet/adet/modeling/fcos/fcos_outputs.py", line 411, in predict_proposals l, o, r, c, image_sizes, t File "/home/user/AdelaiDet/adet/modeling/fcos/fcos_outputs.py", line 448, in forward_for_single_feature_map pre_nms_top_n = candidate_inds.view(N, -1).sum(1) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

long2double commented 3 years ago

me too!!!!

White-Sun commented 3 years ago

me too,and is this a result that i wrongly config project in some step forward?

tianzhi0549 commented 3 years ago

@MrChangJiang @changshuangzhao @White-Sun Please change pre_nms_top_n = candidate_inds.view(N, -1).sum(1) to pre_nms_top_n = candidate_inds.reshape(N, -1).sum(1).

White-Sun commented 3 years ago

@MrChangJiang @changshuangzhao @ White-Sun请更改pre_nms_top_n = candidate_inds.view(N, -1).sum(1)pre_nms_top_n = candidate_inds.reshape(N, -1).sum(1)

thanks,i have sloved this problem.