WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.18k stars 4.17k forks source link

AttributeError: Can't get attribute 'SegmentationModel' on <module 'models.yolo' #1825

Open AbdurrahimBalta opened 1 year ago

AbdurrahimBalta commented 1 year ago

AttributeError: Can't get attribute 'SegmentationModel' on <module 'models.yolo' from '/Users/cache/torch/hub/WongKinYiu_yolov7_main/models/yolo.py'>

I'm trying to use my custom instance segmentation model. The yolov7 seg codes are a branch of yolov5, but the models.yolo.py file is still in its old version and out of date for segmentation.

mycode

def get_yolov7():

local best.pt

model = torch.hub.load('WongKinYiu/yolov7', 'custom',
                  'best.pt', force_reload=True) 

local repo

model.conf = 0.6
return model

model = get_yolov7()

marziyemahmoudifar commented 4 months ago

AttributeError: Can't get attribute 'SegmentationModel' on <module 'models.yolo' from '/Users/cache/torch/hub/WongKinYiu_yolov7_main/models/yolo.py'>

I'm trying to use my custom instance segmentation model. The yolov7 seg codes are a branch of yolov5, but the models.yolo.py file is still in its old version and out of date for segmentation.

mycode

def get_yolov7(): # local best.pt model = torch.hub.load('WongKinYiu/yolov7', 'custom', 'best.pt', force_reload=True)

local repo

model.conf = 0.6
return model

model = get_yolov7()

Hi dear, I faced a similar error, can you guide me to solve it? Thanks in advance

giplil commented 4 weeks ago

这个是使用的底膜问题 也就是.pt的问题 换一个.pt文件就可以了 更换成yolov5s.pt之类的