模型预测过程中报错 RuntimeError: Sizes of tensors must match except in dimension 1.
具体报错如上所示
问题背景
用gradio库写了一个YOLOv7检测logo的demo,上传图片之后报错如上。
解决方法
一开始我以为是类别数不对应的问题,然而并不是。
实际上是一个非常粗心的错误,原本的YOLOv7在训练和检测时都对图片进行了resize操作,而我在调用detect函数的时候,传入的图片是未经过resize的,所以就有了上述错误。
回YOLOv7源码可以看到它是
from utils.datasets import letterbox
然后调用letterbox函数实现resize,于是照搬,增加一行代码就好了。
当然自己写一段resize代码也是可以的。
模型预测过程中报错 RuntimeError: Sizes of tensors must match except in dimension 1.相关推荐
- Pytorch_Geometric(PyG)使用DataLoader报错RuntimeError: Sizes of tensors must match except in dimension 0.
使用Pytorch_Geometric(PyG)时构建DataLoader,从DataLoader获取样本Batch时报错:RuntimeError: Sizes of tensors must ma ...
- 记录解决RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 27 but got size
问题描述 在做目标检测服务过程中,将yolov7模型通过flask打包成预测服务API,此次训练的图像输入大小是1280,输入预测图片是如果图像大于1280则预测成功,小于1280则报RuntimeE ...
- RuntimeError: Sizes of tensors must match except in dimension 1. Got 61 and 60 in dimension 2
1. 背景介绍 在训练语义分割模型时,出现以下错误: RuntimeError: Sizes of tensors must match except in dimension 1. Got 61 a ...
- RuntimeError: Sizes of tensors must match except in dimension 2. Got 5 and 4
调试代码的时候,遇到***RuntimeError: Sizes of tensors must match except in dimension 2. Got 5 and 4*** 这个问题, 解 ...
- Sizes of tensors must match except in dimension 1. Got 61 and 60 in dimension 2
1. 背景介绍 在训练编码解码网络模型时,出现以下错误: RuntimeError: Sizes of tensors must match except in dimension 1. ...
- Sizes of tensors must match except in dimension 1. Expected size 24 but got size 25 for tensor numbe
在做图像分割的时候遇到了错误,错误如下: File "D:/segmentation/Pytorch-UNet-master/train.py", line 193, in < ...
- RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1.
最近在修改模型不支持的算子后,由于对模型的效果产生了影响,所以需要进行微调训练,但是训练的时候报错了,如下: File "/home/xxxxxxx/EdgeNets/nn_layers/e ...
- RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0—问题分析
声明: 这里仅仅提供一个思路,暂时没有绝对正确通用的解决方案 作者:{ 墨理 } 感谢通过私信.评论交流,协力探讨解决问题的同学 UP .Penser 文章目录 探讨的 pytorch 报错信息如下 ...
- Pytorch踩坑: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0.
报错信息: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 186 a ...
最新文章
- 【linux】串口编程(一)——配置串口
- 面向可解释的NLP:北大、哈工大等提出文本分类的生成性解释框架
- 【 C 】结构的自引用
- MissingServletRequestPartException: Required request part ‘file‘ is not present]
- mysql的源码目录_Mysql DBA系统学习(2)了解mysql的源码目录及源文件
- Node.js知识梳理之Node.js安装
- 7年老员工的6点离职忠告
- Svn分支管理的使用(三)
- php 抽奖活动_php 实现活动人选抽奖功能代码
- 微信小程序实现图片懒加载
- 在实习的过程中规划自己的未来职业蓝图
- The Forty-ninth Of Word-Day
- linux双系统无u盘安装教程视频教程,U盘安装Windows和Ubuntu 15.04双系统图解教程
- c语言10以内随机数生成器,C语言随机数生成器
- 如何从一个大规模的文本中筛选出符合条件的记录
- nvcc编译器之GPU代码编译(chapter 5)
- 解决pprint安装不上 | pprint_一个漂亮的打印机
- java 线程锁Lock
- 用java获取本机IP地址
- Sqoop将MySQL数据导入到HDFS和Hive中
热门文章
- python 逐行调试工具_Python调试的三个工具
- Java基础+框架 面试题
- jquery数组求和
- 路由器有线桥接相同ssid_在家中配置两个具有一个SSID(网络名称)的无线路由器以进行免费漫游...
- 路由桥接后副路由频繁断网的解决办法及完整的桥接过程
- python保存文件到指定目录_python将文件目录上传到指定位置
- nserror 自定义错误_NSError 错误 code 对照表
- 跟着王进老师学Python:初识Python-王进-专题视频课程
- 贪吃蛇大作战,C# WPF 实现两条贪吃蛇,有用户名注册,成绩展示,历史记录排序
- JJwt生成Token