hukaixuan19970627 / yolov5_obb

yolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测
GNU General Public License v3.0
1.82k stars 425 forks source link

Inference via torch.hub #515

Open StaHRocK1992 opened 1 year ago

StaHRocK1992 commented 1 year ago

Hello guys, I want to use my custom trained model via torch.hub. I load the model like follows:

model = torch.hub.load(source='local', repo_or_dir=r'path\to\local\yolov5_obb', model='custom', path=r'./model/yolov5_obb_best.pt')

The thing is I always get the ERROR:

ImportError: cannot import name 'nms_rotated_ext' from partially initialized module 'utils.nms_rotated' (most likely due to a circular import)

The compliation of nms_rotated was successful. I saw that there where some other issues regarding to that ERROR, but since the complilation was successful I guess there is another issue.

By the way I'm using Windows 10, PyTorch 1.9, CUDA 11.4 and the detect.py is working perfectly fine.

Maybe someone could help me solve this issue.

Thanks in advance.

kurvaraviteja355 commented 1 year ago

@StaHRocK1992 I am also facing same problem. Do you have a solution?

StaHRocK1992 commented 1 year ago

@kurvaraviteja355 I didn't find a way to use the custom model via torch.hub. Maybe there is something wrong with the hubconfig.

To use the model, I grabbed all the needed files from the repo itself. After that it's working fine.