GithubHelp home page GithubHelp logo

Comments (12)

bubbliiiing avatar bubbliiiing commented on June 23, 2024

有没有文字描述呀,我看不了这个图

from faster-rcnn-pytorch.

9711128 avatar 9711128 commented on June 23, 2024

TypeError: expected seqence object with len>=0 or a single integer

from faster-rcnn-pytorch.

jinweiLiu avatar jinweiLiu commented on June 23, 2024

TypeError: expected seqence object with len>=0 or a single integer
同样这个问题

from faster-rcnn-pytorch.

bubbliiiing avatar bubbliiiing commented on June 23, 2024

我赌五毛版本问题

from faster-rcnn-pytorch.

jinweiLiu avatar jinweiLiu commented on June 23, 2024

you win

from faster-rcnn-pytorch.

bubbliiiing avatar bubbliiiing commented on June 23, 2024

no I lose

from faster-rcnn-pytorch.

sunjiabin17 avatar sunjiabin17 commented on June 23, 2024

you win

我遇到同样的问题,请问您怎么解决的,我把torch升级到1.2.0还是不行

from faster-rcnn-pytorch.

sunjiabin17 avatar sunjiabin17 commented on June 23, 2024

you win

我遇到同样的问题,请问您怎么解决的,我把torch升级到1.2.0还是不行

open-mmlab/mmdetection#2842
在frcnn.py中
def detect_image(self, image):
with torch.no_grad():
# 添加以下两行
if isinstance(self.model, torch.nn.DataParallel):
self.model.device_ids = [0]

from faster-rcnn-pytorch.

bubbliiiing avatar bubbliiiing commented on June 23, 2024

啊这,是什么东西

from faster-rcnn-pytorch.

zhaowenyi7 avatar zhaowenyi7 commented on June 23, 2024

在rpn.forward里面,roi返回之前先转到cpu上了,从tensor变成了ndarray,所以dataparallel处理不了了,参考https://discuss.pytorch.org/t/nn-dataparallel-typeerror-expected-sequence-object-with-len-0-or-a-single-integer/97082/23

Yes. Sorry, in this line I put tensor to cpu before gather.
return torch.unsqueeze(loss, 0), predicted_interaction.cpu().detach().view(-1, 1), correct_interaction.cpu().detach().view(-1, 1)

from faster-rcnn-pytorch.

bubbliiiing avatar bubbliiiing commented on June 23, 2024

啥意思啊,我为什么没听懂…要是哪段代码有问题,我还得改呢,我这里运行没报错,我不知道是啥问题

from faster-rcnn-pytorch.

zhaowenyi7 avatar zhaowenyi7 commented on June 23, 2024

roi_cls_locs, roi_scores, rois, roi_indices = self.model(images)

return roi_cls_locs, roi_scores, rois, roi_indices

def forward(self, x, scale=1.):
        img_size = x.shape[2:]
        h = self.extractor(x)

        rpn_locs, rpn_scores, rois, roi_indices, anchor = \
            self.rpn.forward(h, img_size, scale)
            
        # print(np.shape(h))
        # print(np.shape(rois))
        # print(roi_indices)
        roi_cls_locs, roi_scores = self.head.forward(h, rois, roi_indices)
        return roi_cls_locs, roi_scores, rois, roi_indices

最后的四个返回值,后两个是ndarray的,不是tensor,按论坛里的说法,Dataparallel多卡分配计算完要合并结果,ndarray合并不了,你在rpn里面把roi放到CPU上了,所以这样。

for i in range(n):

for i in range(n):
            roi = self.proposal_layer(
                rpn_locs[i].cpu().data.numpy(),
                rpn_fg_scores[i].cpu().data.numpy(),
                anchor, img_size,
                scale=scale)
            batch_index = i * np.ones((len(roi),), dtype=np.int32)
            rois.append(roi)
            roi_indices.append(batch_index)

我怀疑是版本问题,因为你代码里推理的时候把环境变量设置成了1张卡,可能你的版本没问题,别人的版本Dataparallel还是按照多卡的机制gather的,就失败了
其实推理阶段直接把Dataparallel删了就行

from faster-rcnn-pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.