YOLOv5-Multibackbone-Compression
YOLOv5-Multibackbone-Compression copied to clipboard
您好,使用SwimTransformer出错
from models.SwinTransformer import SwinTransformerLayer出错,
Traceback (most recent call last):
File "train.py", line 24, in
我通过导入pip install timm的方式解决了这个问题,但是运行还是出现了新的问题
Traceback (most recent call last):
File "train.py", line 542, in
下载了您的代码来尝试SWinTr但是还是会报错 Sizes of tensors must match except in dimension 1. Expected size 24 but got size 19 for tensor number 1 in the list.,我尝试修改了一些东西错误消失,但是又出现了写的错误 File "E:\GoogleDownload\YOLOv5-Multibackbone-Compression-main\utils\datasets.py", line 388, in init self.mosaic_border = [-img_size // 2, -img_size // 2] TypeError: bad operand type for unary -: 'list'
下载了您的代码来尝试SWinTr但是还是会报错 Sizes of tensors must match except in dimension 1. Expected size 24 but got size 19 for tensor number 1 in the list.,我尝试修改了一些东西错误消失,但是又出现了写的错误 File "E:\GoogleDownload\YOLOv5-Multibackbone-Compression-main\utils\datasets.py", line 388, in init self.mosaic_border = [-img_size // 2, -img_size // 2] TypeError: bad operand type for unary -: 'list'
Fixing...
Please git pull again.
使用您的代码训练 Epoch gpu_mem box obj cls labels img_size 0% 0/1701 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/autocast_mode.py:141: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn('User provided device_type of 'cuda', but CUDA is not available. Disabling') 0/299 0G 0.1069 0.04991 0 5 640: 0% 1/1701 [00:27<12:46:40, 27.06s/it]/usr/local/lib/python3.7/dist-packages/torch/autocast_mode.py:141: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn('User provided device_type of 'cuda', but CUDA is not available. Disabling')会报这个,我放到租用的GPU还是会报; 尝试移植SWImTR到自己的工程任然报错File "/content/drive/My Drive/yolov5-5.0/models/common.py", line 308, in init super().init(c1, c2, c2, n, shortcut, g, e) TypeError: init() takes from 3 to 7 positional arguments but 8 were given。 想问一下您训练的时候使用的GPU型号,我可以去租赁同等算力的GPU尝试一下
大佬,我添加您的Swin,然后在这个模块的return这一行报错了。 class C3(nn.Module): # CSP Bottleneck with 3 convolutions def init(self, c1, c2, c2o, n=1, shortcut=True, g=1, e=[0.5,0.5], rate=[1.0 for _ in range(12)]): # ch_in, ch_out, number, shortcut, groups, expansion super().init() # c_ = int(c2 * e) # hidden channels if isinstance(e,list): c1_ = int(c2o * e[0]) c2_ = int(c2o * e[1]) else: c1_ = int(c2o * e) c2_ = int(c2o * e) self.cv1 = Conv(c1, c1_, 1, 1) print("cv1的尺度", self.cv1) self.cv2 = Conv(c1, c2_, 1, 1) print("cv2的尺度",self.cv2) self.cv3 = Conv(c1_+c2_, c2, 1) # act=FReLU(c2) self.m = nn.Sequential([Bottleneck(c1_, c1_, shortcut, g, e=rate[i]) for i in range(n)]) # self.m = nn.Sequential([CrossConv(c_, c_, 3, 1, g, 1.0, shortcut) for _ in range(n)])
def forward(self, x):
# print(self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1)).shape)
return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1))
下面是报错信息,不知您是否遇到过这种问题,我输出了尺度,觉得cat的时候尺度是对得上的啊, 发生异常: RuntimeError (note: full exception trace is shown but execution is paused at: forward) Sizes of tensors must match except in dimension 1. Got 8 and 1 in dimension 2 (The offending index is 1)
使用您的代码训练 Epoch gpu_mem box obj cls labels img_size 0% 0/1701 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/autocast_mode.py:141: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn('User provided device_type of 'cuda', but CUDA is not available. Disabling') 0/299 0G 0.1069 0.04991 0 5 640: 0% 1/1701 [00:27<12:46:40, 27.06s/it]/usr/local/lib/python3.7/dist-packages/torch/autocast_mode.py:141: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling warnings.warn('User provided device_type of 'cuda', but CUDA is not available. Disabling')会报这个,我放到租用的GPU还是会报; 尝试移植SWImTR到自己的工程任然报错File "/content/drive/My Drive/yolov5-5.0/models/common.py", line 308, in init super().init(c1, c2, c2, n, shortcut, g, e) TypeError: init() takes from 3 to 7 positional arguments but 8 were given。 想问一下您训练的时候使用的GPU型号,我可以去租赁同等算力的GPU尝试一下
应该是您移植时的错误,传参出现异常;GPU RTX 3090 *2
大佬,我添加您的Swin,然后在这个模块的return这一行报错了。 class C3(nn.Module): # CSP Bottleneck with 3 convolutions def init(self, c1, c2, c2o, n=1, shortcut=True, g=1, e=[0.5,0.5], rate=[1.0 for _ in range(12)]): # ch_in, ch_out, number, shortcut, groups, expansion super().init() # c_ = int(c2 * e) # hidden channels if isinstance(e,list): c1_ = int(c2o * e[0]) c2_ = int(c2o * e[1]) else: c1_ = int(c2o * e) c2_ = int(c2o * e) self.cv1 = Conv(c1, c1_, 1, 1) print("cv1的尺度", self.cv1) self.cv2 = Conv(c1, c2_, 1, 1) print("cv2的尺度",self.cv2) self.cv3 = Conv(c1_+c2_, c2, 1) # act=FReLU(c2) self.m = nn.Sequential([Bottleneck(c1, c1_, shortcut, g, e=rate[i]) for i in range(n)]) # self.m = nn.Sequential([CrossConv(c, c_, 3, 1, g, 1.0, shortcut) for _ in range(n)])
def forward(self, x): # print(self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1)).shape) return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1))下面是报错信息,不知您是否遇到过这种问题,我输出了尺度,觉得cat的时候尺度是对得上的啊, 发生异常: RuntimeError (note: full exception trace is shown but execution is paused at: forward) Sizes of tensors must match except in dimension 1. Got 8 and 1 in dimension 2 (The offending index is 1)
若是git 最新版的Hub,应该是不会报错的
大佬,您的意思是,让我重新下载您最新的代码是吗,我是用的5.0版本的yolov5,然后把您写的Swin相关模块,复制到自己代码中,但是报错了。然而,我直接运行昨天刚下载的您的仓库的代码就 可以跑通,这是啥原因啊,是因为我自己用的是5.0版本吗
------------------ 原始邮件 ------------------ 发件人: "Gumpest/YOLOv5-Multibackbone-Compression" @.>; 发送时间: 2021年12月13日(星期一) 晚上7:21 @.>; @.@.>; 主题: Re: [Gumpest/YOLOv5-Multibackbone-Compression] 您好,使用SwimTransformer出错 (Issue #36)
大佬,我添加您的Swin,然后在这个模块的return这一行报错了。 class C3(nn.Module): # CSP Bottleneck with 3 convolutions def init(self, c1, c2, c2o, n=1, shortcut=True, g=1, e=[0.5,0.5], rate=[1.0 for _ in range(12)]): # ch_in, ch_out, number, shortcut, groups, expansion super().init() # c_ = int(c2 * e) # hidden channels if isinstance(e,list): c1_ = int(c2o * e[0]) c2_ = int(c2o * e[1]) else: c1_ = int(c2o * e) c2_ = int(c2o * e) self.cv1 = Conv(c1, c1_, 1, 1) print("cv1的尺度", self.cv1) self.cv2 = Conv(c1, c2_, 1, 1) print("cv2的尺度",self.cv2) self.cv3 = Conv(c1_+c2_, c2, 1) # act=FReLU(c2) self.m = nn.Sequential([Bottleneck(c1, c1_, shortcut, g, e=rate[i]) for i in range(n)]) # self.m = nn.Sequential([CrossConv(c, c_, 3, 1, g, 1.0, shortcut) for _ in range(n)])
def forward(self, x): # print(self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1)).shape) return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1))
下面是报错信息,不知您是否遇到过这种问题,我输出了尺度,觉得cat的时候尺度是对得上的啊, 发生异常: RuntimeError (note: full exception trace is shown but execution is paused at: forward) Sizes of tensors must match except in dimension 1. Got 8 and 1 in dimension 2 (The offending index is 1)
若是git 最新版的Hub,应该是不会报错的
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
大佬,您的意思是,让我重新下载您最新的代码是吗,我是用的5.0版本的yolov5,然后把您写的Swin相关模块,复制到自己代码中,但是报错了。然而,我直接运行昨天刚下载的您的仓库的代码就 可以跑通,这是啥原因啊,是因为我自己用的是5.0版本吗
我使用了您的代码训练,租用了同等算力的GPU但是还是会报错
File "/user-data/yolov5-5.0/models/SwinTransformer.py", line 88, in forward
x = (attn @ v).transpose(1, 2).reshape(B_, N, C)
RuntimeError: expected scalar type Float but found Half
不知道为什么
我使用了您的代码训练,租用了同等算力的GPU但是还是会报错 File "/user-data/yolov5-5.0/models/SwinTransformer.py", line 88, in forward x = (attn @ v).transpose(1, 2).reshape(B_, N, C) RuntimeError: expected scalar type Float but found Half 不知道为什么
您好,请在命令行中添加 --nohalf即可
按照您意见加上--nohalf之后又出现了新的错误 File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 242, in forward x_windows = window_partition(shifted_x, self.window_size) # nW*B, window_size, window_size, C File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 122, in window_partition x = x.view(B, H // window_size, window_size, W // window_size, window_size, C) RuntimeError: shape '[32, 2, 8, 2, 8, 512]' is invalid for input of size 5505024,您在帮忙看一下是哪里的问题呢,我使用的还是您的程序,但是还是会有这个错误
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
按照您意见加上--nohalf之后又出现了新的错误 File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 242, in forward x_windows = window_partition(shifted_x, self.window_size) # nW*B, window_size, window_size, C File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 122, in window_partition x = x.view(B, H // window_size, window_size, W // window_size, window_size, C) RuntimeError: shape '[32, 2, 8, 2, 8, 512]' is invalid for input of size 5505024,您在帮忙看一下是哪里的问题呢,我使用的还是您的程序,但是还是会有这个错误
您好 请告知一下你的训练命令行,我来试一下
你好,我是运行的yolo.py文件,没有train,我遇到的问题是,将这个大佬的Swin添加都自己的5.0版本代码中会报错
------------------ 原始邮件 ------------------ 发件人: "Gumpest/YOLOv5-Multibackbone-Compression" @.>; 发送时间: 2021年12月15日(星期三) 上午10:44 @.>; @.@.>; 主题: Re: [Gumpest/YOLOv5-Multibackbone-Compression] 您好,使用SwimTransformer出错 (Issue #36)
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
我下载了您的程序,但是我使用了自己的数据集,运行命令: python train.py --data my.yaml --weights yolov5s.pt --cfg models/accModels/yolov5xP2CBAM-Swin-BiFPN-SPP.yaml --hyp data/hyps/hyp.visdrone.yaml --epochs 60 --batch-size 2 --img 640 --nohalf 您觉得有可能是我数据集的问题吗 我百度查找相关错误,有说是因为nc的数值不对引起的,但是我检查了数值并没有问题
Please git pull again.
大佬,请问我将您写的Swin的代码放到我使用的5.0版的v5上会报通道出错,但是我down您的仓库的代码就可以跑,我查看了每一层的通道数,发现5.0版和6.0版是一样的,但是在5.0上就会报错,请问这个是v5版本不同导致的吗,您写的代码 只能在6.0版本上运行吗
我下载了您的程序,但是我使用了自己的数据集,运行命令: python train.py --data my.yaml --weights yolov5s.pt --cfg models/accModels/yolov5xP2CBAM-Swin-BiFPN-SPP.yaml --hyp data/hyps/hyp.visdrone.yaml --epochs 60 --batch-size 2 --img 640 --nohalf 您觉得有可能是我数据集的问题吗 我百度查找相关错误,有说是因为nc的数值不对引起的,但是我检查了数值并没有问题
my.yaml 以及/yolov5xP2CBAM-Swin-BiFPN-SPP.yaml都需要改成对应的nc
Please git pull again.
大佬,请问我将您写的Swin的代码放到我使用的5.0版的v5上会报通道出错,但是我down您的仓库的代码就可以跑,我查看了每一层的通道数,发现5.0版和6.0版是一样的,但是在5.0上就会报错,请问这个是v5版本不同导致的吗,您写的代码 只能在6.0版本上运行吗
目前是只支持v6版本
按照您意见加上--nohalf之后又出现了新的错误 File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 242, in forward x_windows = window_partition(shifted_x, self.window_size) # nW*B, window_size, window_size, C File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 122, in window_partition x = x.view(B, H // window_size, window_size, W // window_size, window_size, C) RuntimeError: shape '[32, 2, 8, 2, 8, 512]' is invalid for input of size 5505024,您在帮忙看一下是哪里的问题呢,我使用的还是您的程序,但是还是会有这个错误
按照您意见加上--nohalf之后又出现了新的错误 File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 242, in forward x_windows = window_partition(shifted_x, self.window_size) # nW*B, window_size, window_size, C File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 122, in window_partition x = x.view(B, H // window_size, window_size, W // window_size, window_size, C) RuntimeError: shape '[32, 2, 8, 2, 8, 512]' is invalid for input of size 5505024,您在帮忙看一下是哪里的问题呢,我使用的还是您的程序,但是还是会有这个错误 你好,我也遇到了同样的问题,请问您现在解决了吗?
我下载了您的程序,但是我使用了自己的数据集,运行命令: python train.py --data my.yaml --weights yolov5s.pt --cfg models/accModels/yolov5xP2CBAM-Swin-BiFPN-SPP.yaml --hyp data/hyps/hyp.visdrone.yaml --epochs 60 --batch-size 2 --img 640 --nohalf 您觉得有可能是我数据集的问题吗 我百度查找相关错误,有说是因为nc的数值不对引起的,但是我检查了数值并没有问题
您好,我也遇到了同样的问题,我也是用的自己的数据集,出现了和你一样的问题,请问您解决了吗?
按照您意见加上--nohalf之后又出现了新的错误 File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 242, in forward x_windows = window_partition(shifted_x, self.window_size) # nW*B, window_size, window_size, C File "/user-data/YOLOv5-Multibackbone-Compression-main/models/SwinTransformer.py", line 122, in window_partition x = x.view(B, H // window_size, window_size, W // window_size, window_size, C) RuntimeError: shape '[32, 2, 8, 2, 8, 512]' is invalid for input of size 5505024,您在帮忙看一下是哪里的问题呢,我使用的还是您的程序,但是还是会有这个错误
您好 请告知一下你的训练命令行,我来试一下
您好,我也遇到了这个问题。请问这是由于数据集原因引起的吗?现在就是在第一轮计算map时报错
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我下载作者仓库的代码就可以跑通
Please git pull again.
大佬,请问我将您写的Swin的代码放到我使用的5.0版的v5上会报通道出错,但是我down您的仓库的代码就可以跑,我查看了每一层的通道数,发现5.0版和6.0版是一样的,但是在5.0上就会报错,请问这个是v5版本不同导致的吗,您写的代码 只能在6.0版本上运行吗
目前是只支持v6版本
5.0版本和6.0版本差别这么大吗,为啥没法跑啊
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我下载作者仓库的代码就可以跑通
你用的是自己的数据集吗?
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我下载作者仓库的代码就可以跑通
你用的是自己的数据集吗?
我用的是自己的数据集,也是这个问题,请问您解决了吗
直接使用仓库的代码可以跑通,是自己的数据集
------------------ 原始邮件 ------------------ 发件人: "Gumpest/YOLOv5-Multibackbone-Compression" @.>; 发送时间: 2022年1月9日(星期天) 上午9:49 @.>; @.@.>; 主题: Re: [Gumpest/YOLOv5-Multibackbone-Compression] 您好,使用SwimTransformer出错 (Issue #36)
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我下载作者仓库的代码就可以跑通
你用的是自己的数据集吗?
我用的是自己的数据集,也是这个问题,请问您解决了吗
— 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: @.***>
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我直接运行昨天刚下载的您的仓库的代码就 可以跑通,
你说的跑的通是SwinTransformer可以跑通吗,我总是在第一轮训练计算map时出现错误
我下载作者仓库的代码就可以跑通
你用的是自己的数据集吗?
我用的是自己的数据集,也是这个问题,请问您解决了吗
没有解决,希望作者能回复一下,我下载了yolov5 6.0然后吧swintransformer移值过去,就会报这个错误
在train.py中的img_size 使用默认的,不要640,不要640,不要640