simplest_FasterRcnn_pytorch icon indicating copy to clipboard operation
simplest_FasterRcnn_pytorch copied to clipboard

Hi, I have this error in runing train.py!

Open BCWang93 opened this issue 5 years ago • 3 comments

你好,我非常感兴趣您的这个项目,觉得很简洁;但是当我在运行train.py 的时候,出现了以下的错误,您能帮忙解决一下吗?谢谢! Traceback (most recent call last): File "train.py", line 25, in losses = model.train_step(img,bbox,label,scale,epoch) File "/home/a/Bcw_data/simplest_FasterRcnn_pytorch/model/faster_rcnn_vgg16.py", line 178, in train_step features, roi, rpn_loc_loss, rpn_cls_loss = self.train_extracor_and_rpn(img, bbox, scale, retain_graph=True) File "/home/a/Bcw_data/simplest_FasterRcnn_pytorch/model/faster_rcnn_vgg16.py", line 209, in train_extracor_and_rpn rpn_loc, rpn_score, roi, anchor = self.rpn(features, img_size, scale, training=True) File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "/home/a/Bcw_data/simplest_FasterRcnn_pytorch/model/regin_proposal_network.py", line 195, in forward roi = self.proposcal_creator(rpn_locs[0].cpu().detach().numpy(),rpn_scores[0].cpu().detach().numpy(),anchor, img_size,scale=scale,training=training) File "/home/a/Bcw_data/simplest_FasterRcnn_pytorch/model/creator.py", line 450, in call keep = np.where((hs >= min_size) & (ws >= min_size))[0] TypeError: le() received an invalid combination of arguments - got (numpy.ndarray), but expected one of:

  • (Tensor other) didn't match because some of the arguments have invalid types: (numpy.ndarray)
  • (Number other) didn't match because some of the arguments have invalid types: (numpy.ndarray)

BCWang93 avatar Jun 20 '19 09:06 BCWang93

我当时运行倒是没有遇到这个问题,不过google了一下有类似的问题(https://www.gitmemory.com/issue/aditya-vora/FCHD-Fully-Convolutional-Head-Detector/28/482140429)

是不是pytorch更新之后有不兼容?

Kyle1993 avatar Jun 26 '19 19:06 Kyle1993

is it solved? I have the same problem

7-qiliu avatar Aug 25 '19 02:08 7-qiliu

    min_size_temp = min_size.numpy()
    keep = np.where((hs >= min_size_temp) & (ws >= min_size_temp))[0]

yangninghua avatar Feb 02 '21 09:02 yangninghua