meituan / YOLOv6

YOLOv6: a single-stage object detection framework dedicated to industrial applications.
GNU General Public License v3.0
5.71k stars 1.03k forks source link

AttributeError: Can't get attribute 'SimConv' on <module 'yolov6.layers.common' #799

Open ZhuYoukang320 opened 1 year ago

ZhuYoukang320 commented 1 year ago

Before Asking

Search before asking

Question

推理时最新发布的模型在最新代码上无法运行,0.3.0发布的模型还是旧版本模型?

Additional

No response

Chilicyy commented 1 year ago

您好,最新的代码主要更新了移动端模型以及对卷积算子进行了重构,如果您希望在最新代码上运行v3.0版本的模型,可以在Release 4.0页面重新下载对应的权重文件。

FONG1234 commented 1 year ago

我也是遇到这个问题, 因为我打算用pre-trained model来训练我的模型但是遇到这个问题 AttributeError: Can't get attribute 'SimConv' on <module 'yolov6.layers.common' from '/content/YOLOv6/yolov6/layers/common.py'>,有人已经解答到这个问题了吗?

Chilicyy commented 1 year ago

@FONG1234 重新下载权重也报错吗

ZhuYoukang320 commented 1 year ago

@FONG1234 重新下载权重也报错吗

没有,0.4.0版本没问题了

FONG1234 commented 1 year ago

好的等下我试试看,谢谢

FONG1234 commented 1 year ago

当我使用yolov6l_finetune, 我可以训练我的模型。但是当我使用yolov6s6_finetune的时候以下问题还是会出来:

Traceback (most recent call last): File "/content/YOLOv6/tools/train.py", line 128, in main(args) File "/content/YOLOv6/tools/train.py", line 113, in main trainer = Trainer(args, cfg, device) File "/content/YOLOv6/yolov6/core/engine.py", line 58, in init model = self.get_model(args, cfg, self.num_classes, device) File "/content/YOLOv6/yolov6/core/engine.py", line 403, in get_model model = load_state_dict(weights, model, map_location=device) File "/content/YOLOv6/yolov6/utils/checkpoint.py", line 13, in load_state_dict ckpt = torch.load(weights, map_location=map_location) File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 809, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1172, in _load result = unpickler.load() File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1165, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'SimConv' on <module 'yolov6.layers.common' from '/content/YOLOv6/yolov6/layers/common.py'>

可能是yolov6l.pt有更新权重 (0.40版本),但是yolov6s6还是停留再0.30版本,有什么解决方案吗?T.T

Chilicyy commented 1 year ago

@FONG1234 如果您想训练3.0版本的模型,可以先回退到tag 0.3.0,不需要更新代码,0.4.0版本代码没有对这些模型做算法更新。如果需要的话,后续我们也会更新下P6模型的权重。

FONG1234 commented 1 year ago

不好意思又是我,当我退回使用 git checkout 0.3.0来退回0.3.0版本, 但是又有其他的问题出现。

AttributeError: module 'numpy' has no attribute 'int'. np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'inf'?

Chilicyy commented 1 year ago

@FONG1234 可参考issues#667;如果仍有问题,可以切换到v3分支 git checkout v3

medetovyerma commented 1 year ago

For those who got error related to "SimConv" part , just try to get new updated weights from https://github.com/meituan/YOLOv6/releases/tag/0.4.0 release

danzz006 commented 1 year ago

For those who got error related to "SimConv" part , just try to get new updated weights from https://github.com/meituan/YOLOv6/releases/tag/0.4.0 release

Solved it by using the updated weights!

IyshwaryaK commented 1 year ago

tried downloading new updated weights from https://github.com/meituan/YOLOv6/releases/tag/0.4.0 release and solved as @medetovyerma said

sangeun-jo commented 1 year ago

I used ver 0.4.0, but got same error.

I downloaded the wrong Small Weight file from https://github.com/meituan/YOLOv6/releases/download/0.1.0/yolov6s.pt

try

import torch
torch.hub.download_url_to_file('https://github.com/meituan/YOLOv6/releases/download/0.3.0/yolov6s.pt', 'yolov6s.pt')
AshishRaghani23 commented 1 year ago

Traceback (most recent call last): File "/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/tools/train.py", line 127, in main(args) File "/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/tools/train.py", line 112, in main trainer = Trainer(args, cfg, device) File "/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/yolov6/core/engine.py", line 57, in init model = self.get_model(args, cfg, self.num_classes, device) File "/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/yolov6/core/engine.py", line 388, in get_model model = load_state_dict(weights, model, map_location=device) File "/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/yolov6/utils/checkpoint.py", line 13, in load_state_dict ckpt = torch.load(weights, map_location=map_location) File "/home/aivid/anaconda3/lib/python3.10/site-packages/torch/serialization.py", line 809, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/home/aivid/anaconda3/lib/python3.10/site-packages/torch/serialization.py", line 1172, in _load result = unpickler.load() File "/home/aivid/anaconda3/lib/python3.10/site-packages/torch/serialization.py", line 1165, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'ConvModule' on <module 'yolov6.layers.common' from '/opt/1TB/Computer-Vision/Training/YOLOv6_training/YOLOv6/yolov6/layers/common.py'>

@Chilicyy I got this error after downloading updated weights from 4.0 release.

gallardorafael commented 8 months ago

For those who got error related to "SimConv" part , just try to get new updated weights from https://github.com/meituan/YOLOv6/releases/tag/0.4.0 release

This worked for me!