Git Product home page Git Product logo

Comments (6)

wangat avatar wangat commented on May 28, 2024 1

x = x.view(batchsize, -1, height, width)
-1是自动计算的意思,所以只能有1个,bs是-1了,第二项就不能再是-1了,我改成(batchsize,groups*channels_per_group,height,width)了,数字固定了

from yolov7_plate.

wangat avatar wangat commented on May 28, 2024

我也遇到了相同的问题,可视化发现concat和reshape算子那边有点问题,onnxruntime测试也是,最后定位在common.py的channel_shuffle这边,需要把batch_size设置为-1,其他对应修改就可以了。

from yolov7_plate.

pangedeshijie avatar pangedeshijie commented on May 28, 2024

哥们,很感谢你提供的解决方案,这个common.py是修改完后,需要重新训练一下模型吗?还是在导出为onnx的时候修改?

from yolov7_plate.

pangedeshijie avatar pangedeshijie commented on May 28, 2024

我也遇到了相同的问题,可视化发现concat和reshape算子那边有点问题,onnxruntime测试也是,最后定位在common.py的channel_shuffle这边,需要把batch_size设置为-1,其他对应修改就可以了。
哥们,很感谢你提供的解决方案,这个common.py是修改完后,需要重新训练一下模型吗?还是在导出为onnx的时候修改?

from yolov7_plate.

wangat avatar wangat commented on May 28, 2024

哥们,很感谢你提供的解决方案,这个common.py是修改完后,需要重新训练一下模型吗?还是在导出为onnx的时候修改?

应该不需要重新训练,导出的时候修改就可以。

from yolov7_plate.

pangedeshijie avatar pangedeshijie commented on May 28, 2024

def channel_shuffle(x, groups):
batchsize, num_channels, height, width = x.data.size()
channels_per_group = num_channels // groups

batchsize = -1

# reshape
x = x.view(batchsize, groups, channels_per_group, height, width)
x = torch.transpose(x, 1, 2).contiguous()

# flatten

x = x.view(batchsize, -1, height, width)
return x

哥们,你好,我在这个地方做了一下修改,导出的时候报错了,你那边具体是怎么修改的 方便说一下吗?

x = x.view(batchsize, -1, height, width)

RuntimeError: only one dimension can be inferred

from yolov7_plate.

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.