【已解决】ModuleNotFoundError: No module named ‘timm.models.layers.he
【摘要】 @[toc] 错误信息在使用timm库的时候出现了ModuleNotFoundError: No module named 'timm.models.layers.helpers’的错误,详情如下:Traceback (most recent call last): File "/home/wh/projects/yolov8/ultralytics-main/train.py", lin...
@[toc]
错误信息
在使用timm库的时候出现了ModuleNotFoundError: No module named 'timm.models.layers.helpers’的错误,详情如下:
Traceback (most recent call last):
File "/home/wh/projects/yolov8/ultralytics-main/train.py", line 1, in <module>
from ultralytics import YOLO
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/__init__.py", line 5, in <module>
from ultralytics.hub import start
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/hub/__init__.py", line 5, in <module>
from ultralytics.hub.auth import Auth
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/hub/auth.py", line 5, in <module>
from ultralytics.hub.utils import HUB_API_ROOT, PREFIX, request_with_credentials
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/hub/utils.py", line 14, in <module>
from ultralytics.yolo.utils import (ENVIRONMENT, LOGGER, ONLINE, RANK, SETTINGS, TESTS_RUNNING, TQDM_BAR_FORMAT,
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/yolo/__init__.py", line 3, in <module>
from . import v8
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/yolo/v8/__init__.py", line 3, in <module>
from ultralytics.yolo.v8 import classify, detect, pose, segment
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/yolo/v8/classify/__init__.py", line 3, in <module>
from ultralytics.yolo.v8.classify.predict import ClassificationPredictor, predict
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/yolo/v8/classify/predict.py", line 5, in <module>
from ultralytics.yolo.engine.predictor import BasePredictor
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/yolo/engine/predictor.py", line 37, in <module>
from ultralytics.nn.autobackend import AutoBackend
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/nn/__init__.py", line 3, in <module>
from .tasks import (BaseModel, ClassificationModel, DetectionModel, SegmentationModel, attempt_load_one_weight,
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/nn/tasks.py", line 10, in <module>
from ultralytics.nn.modules import (AIFI, C1, C2, C3, C3TR, SPP, SPPF, Bottleneck, BottleneckCSP, C2f, C3Ghost, C3x,
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/nn/modules/__init__.py", line 23, in <module>
from .inceptionnext import MetaNeXtStage
File "/home/wh/projects/yolov8/ultralytics-main/ultralytics/nn/modules/inceptionnext.py", line 16, in <module>
from timm.models.layers.helpers import to_2tuple
ModuleNotFoundError: No module named 'timm.models.layers.helpers'
原因
timm版本更新后,脚本的位置发生了变化。
解决方法
将
timm.models.layers.helpers
替换为
timm.layers.helpers
专栏:神经网络精讲与实战
这篇文章,是对专栏的总目录,方便大家查看文章。这个专栏我计划整理一些经典常用的主干网络模型,对其进行讲解和实战。由浅入深,逐步增加深度,让大家更容易接受。
PDF版的文章和实战代码以及数据集,我会放到网盘上,大家在文章的末尾可以看到。
![在这里插入图片描述](https://img-blog.csdnimg.cn/22b930319e9e46d59258007c4368d71d.png#pic_center =300x)
AlexNet
VGGNet
GoogLeNet
Inception V2——V4
第十六篇 Inception V2、Inception V3、Inception V4模型详解
ResNet
DenseNet
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)