pytorch-YOLOv4
pytorch-YOLOv4 copied to clipboard
OpenCV can't augment image: 608 x 608
训练自己的数据集的时候出现的,我只需要识别一个类别 我的环境为: Ubuntu 16.04.12 cuda 10.0 python 3.7.9 torchversion 1.2.0
运行: python train.py -l 0.001 -g 1 -pretrained ./weight/yolov4.pth -classes 1 -dir ./VOCdevkit/VOC2007/JPEGImages/ -train_label_path ./data/train.txt
出现:
Epochs: 300
Batch size: 4
Subdivisions: 1
Learning rate: 0.001
Training size: 464
Validation size: 52
Checkpoints: True
Device: cuda
Images size: 608
Optimizer: adam
Dataset classes: 1
Train label path:./data/train.txt
Pretrained:
Epoch 1/300: 0%| | 0/464 [00:00<?, ?img/s]OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608
希望大佬们帮我分析分析
It comes from image_data_augmentation of Dataset.py.
我在想你是不是在运行的时候ctrlc暂停了,那样的话就会触发except,然后就会print(...)
请问楼主解决了吗?
请问楼主解决了吗?
其实就是中途退出触发except,在调试的时候很常见。
请问楼主解决了吗?
其实就是中途退出触发except,在调试的时候很常见。 我一步一步调式出来 是这一行有问题 但是我不是很明白这个HSV相乘为什么有问题,楼主能帮忙看一下吗 谢谢
我解决了 楼主 cv2.split()出来的hsv是tuple,不能被赋值的,转换成list就好了
楼主解决这个问题了吗?我用代码直接跑的COCO2017数据集,报的错误一模一样,如果解决了还希望能分享一下 Epoch 1/300: 0%| | 0/4952 [00:00<?, ?img/s] OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608
这里 我一步一步debug下来发现的,hsv原本返回的类型是元组,不可更改,因此被try了,把它转换为list就行了 141行
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年12月23日(星期四) 晚上10:57 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Tianxiaomo/pytorch-YOLOv4] OpenCV can't augment image: 608 x 608 (#427)
楼主解决这个问题了吗?我用代码直接跑的COCO2017数据集,报的错误一模一样,如果解决了还希望能分享一下 Epoch 1/300: 0%| | 0/4952 [00:00<?, ?img/s] OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>
这里 我一步一步debug下来发现的,hsv原本返回的类型是元组,不可更改,因此被try了,把它转换为list就行了 141行 … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年12月23日(星期四) 晚上10:57 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Tianxiaomo/pytorch-YOLOv4] OpenCV can't augment image: 608 x 608 (#427) 楼主解决这个问题了吗?我用代码直接跑的COCO2017数据集,报的错误一模一样,如果解决了还希望能分享一下 Epoch 1/300: 0%| | 0/4952 [00:00<?, ?img/s] OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 OpenCV can't augment image: 608 x 608 — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>
非常感谢楼主,我刚刚发现将python版本降到3.4同样解决了这个问题
我解决了 楼主 cv2.split()出来的hsv是tuple,不能被赋值的,转换成list就好了
可以问是怎么改的? 谢谢!
hsv = cv2.split(hsv_src)
#https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/427
#OpenCV can't augment image: 608 x 608
hsv = list(hsv)
h, s, v = cv2.split(hsv)
我也遇到了一样的问题,请问要改的文件在哪,能发一下路径吗,谢谢
我也遇到了一样的问题,请问要改的文件在哪,能发一下路径吗,谢谢
其实我将opencv降到3.4.7就没问题了,你也可以试试看
好的,感谢!
#https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/427 #OpenCV can't augment image: 608 x 608
我降成3.4.7还是一样~~
This following worked for me
Before (actual error: TypeError: 'tuple' object does not support item assignment
)
hsv_src = cv2.cvtColor(sized.astype(np.float32), cv2.COLOR_RGB2HSV) # RGB to HSV
hsv = cv2.split(hsv_src)
hsv[1] *= dsat
After making it into list
hsv_src = cv2.cvtColor(sized.astype(np.float32), cv2.COLOR_RGB2HSV) # RGB to HSV
hsv = list(cv2.split(hsv_src)) # <---- IN THIS LINE: make it tuple to list
hsv[1] *= dsat
resolved the OpenCV can't augment image
error
(Note: my opencv version 4.8.1
and numpy version 1.18.2
)
我解决了 楼主 cv2.split()出来的hsv是tuple,不能被赋值的,转换成list就好了
确实有用