当前位置:网站首页>YOLOv5导出onnx遇到的坑
YOLOv5导出onnx遇到的坑
2022-06-30 11:28:00 【weixin_44834086】
1、运行export.py时报错 ‘Upsample’ object has no attribute ‘recompute_scale_factor’
解决办法:找到Upsampling.py文件(我的文件在这个路径下找到的,仅供参考D:\Program Files\Lib\site-packages\torch\nn\modules),将forward函数修改如下:
def forward(self, input: Tensor) -> Tensor:
return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners) #把括号中的这一部分删掉即可,recompute_scale_factor=self.recompute_scale_factor
2、以上修改完成后运行export.py,程序不再报错,但未能导出onnx,提升未安装onnx,并提示使用如下命令进行安装:
pip install 'onnx'
按照提升的命令安装时,速度很慢,采用清华镜像则可以秒装,命令如下:
pip install 'onnx' -i https://pypi.tuna.tsinghua.edu.cn/simple/
安装好onnx后,再次运行export.py,成功导出onnx文件。
导出onnx文件后,按照程序的提示,使用这个链接 https://netron.app可以打开onnx文件,我打开后如下图所示:
边栏推荐
- 10 days to learn how to flutter Day10 flutter play animation and packaging
- Multiparty cardinality testing for threshold private set-2021: Interpretation
- 谁还记得「张同学」?
- 1175. 质数排列
- Flutter 从零开始 004 按钮组件
- koa - 洋葱模型浅析
- H3C switch emptying configuration
- wallys/3×3 MIMO 802.11ac Mini PCIe Wi-Fi Module, QCA9880, 2,4GHz / 5GHzDesigned for Enterprise
- 基于视觉的机器人抓取:从物体定位、物体姿态估计到平行抓取器抓取估计
- Use of switch statement in go language learning
猜你喜欢
随机推荐
对象映射 - Mapping.Mapster
Speech signal processing - Fundamentals (V): Fourier transform
Shutter from zero 004 button assembly
启明星辰集团运维安全网关(堡垒机)再次夺得榜首!
wallys/IPQ8074a/2x(4×4 or 8×8) 11AX MU-MIMO DUAL CONCURRENT EMBEDDEDBOARD
Summer vacation study record
线下门店为什么要做新零售?
Customize an annotation to get a link to the database
Who still remembers "classmate Zhang"?
再不上市,旷视科技就熬不住了
自定义一个注解来获取数据库的链接
Use of switch statement in go language learning
AMS source code analysis
导致系统性能失败的10个原因
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
Is the golden cycle of domestic databases coming?
Esp32-c3 introductory tutorial IOT part ⑤ - Alibaba cloud Internet of things platform espaliyun RGB LED practical mass production solution
Create - configure factory
Oracle NetSuite 助力 TCM Bio,洞悉数据变化,让业务发展更灵活
[revisiting the classic C language] ~x,%c,%d,%x, etc. in C language, the role of the address character in C language, and the consortium in C language








