Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何加载自定义模型 #4

Closed
koihoo opened this issue Jun 9, 2023 · 7 comments
Closed

如何加载自定义模型 #4

koihoo opened this issue Jun 9, 2023 · 7 comments
Labels
question Further information is requested

Comments

@koihoo
Copy link

koihoo commented Jun 9, 2023

我已经将自训模型从pt转为onnx,依旧无法加载。
请问如何加载自定义模型?

@CVHub520
Copy link
Owner

CVHub520 commented Jun 9, 2023

我已经将自训模型从pt转为onnx,依旧无法加载。 请问如何加载自定义模型?

您好,请提供更多的上下文信息帮助定位。
具体教程可参考:https://mp.weixin.qq.com/s/Fi7i4kw0n_QsA7AgmtP-JQ

@koihoo
Copy link
Author

koihoo commented Jun 9, 2023

我的模型是用yolov8x进行的目标检测+分割训练,但是转成onnx依旧无法加载模型

@koihoo
Copy link
Author

koihoo commented Jun 9, 2023

您好,按照您给的教程操作后,出现以下错误:
image
我的文件格式长这样
image
我的swan.yaml:

type: yolov8
name: yolov8-swan
display_name: yolov8-swan
model_path: C:/Users/Admin/Desktop/ultralytics/runs/train-best/weights/best.onnx
input_width: 640
input_height: 640
score_threshold: 0.30
nms_threshold: 0.45
confidence_threshold: 0.4
classes:
  - swan

@CVHub520
Copy link
Owner

我的模型是用yolov8x进行的目标检测+分割训练,但是转成onnx依旧无法加载模型

您好,目前第一个版本还没支持分割模型。另外根据你给出的这个报错原因,一般都是 pytorch 或者 opencv 等版本问题所致,可参考此帖:ultralytics/yolov5#8439

@CVHub520 CVHub520 added the question Further information is requested label Jun 16, 2023
@aiyou9
Copy link

aiyou9 commented Jun 18, 2023

您好,按照您给的教程操作后,出现以下错误: image 我的文件格式长这样 image 我的swan.yaml:

type: yolov8
name: yolov8-swan
display_name: yolov8-swan
model_path: C:/Users/Admin/Desktop/ultralytics/runs/train-best/weights/best.onnx
input_width: 640
input_height: 640
score_threshold: 0.30
nms_threshold: 0.45
confidence_threshold: 0.4
classes:
  - swan

原项目还没更新这个提交,可以看看这位大佬的vietanhdev/anylabeling#46
我用yolov8,目标检测版,在 ’x-anylabeling‘ 中,我自己训练的项目没有加载成功,和你一样的报错,我换到原项目,可以了

如果你换到anylabeling

你的自定义模型的定义 yaml,可能有问题
name:#这里可能是 best.pt 文件夹名 ,按照你提供的信息,这里可能是weights

如果报错,文件位置不对,需要把yaml和onnx文件放到下面路径中
C:\Users\你自己的用户名\anylabeling_data\yolov8-swan

type: yolov8
name: yolov8-swan
display_name: yolov8-swan
model_path: best.onnx
input_width: 640
input_height: 640
score_threshold: 0.30
nms_threshold: 0.45
confidence_threshold: 0.4
classes:
- swan

可能yaml中 使用绝对路径,name:就不需要像上面那样限定?

@aiyou9
Copy link

aiyou9 commented Jun 18, 2023

我搜了 https:github.com/vietanhdev/anylabeling 的issue 都说导出YOLO系列的模型,都需要加 --opset 12
python export.py --weights yolov5x-seg.pt --include onnx --opset 12
不懂,是否在x-anylabeling中也需要?

@CVHub520
Copy link
Owner

我搜了 https:github.com/vietanhdev/anylabeling 的issue 都说导出YOLO系列的模型,都需要加 --opset 12 python export.py --weights yolov5x-seg.pt --include onnx --opset 12 不懂,是否在x-anylabeling中也需要?

请参考:#9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants