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

用yolov8n-pose訓練完的模型,在自動標記時無法標記到物件 #508

Closed
JW5123 opened this issue Jul 6, 2024 · 8 comments
Closed
Labels
question Further information is requested

Comments

@JW5123
Copy link

JW5123 commented Jul 6, 2024

作者您好,目前使用yolov8n-pose.yaml來訓練帶有兩個關鍵點及邊界框的物件,有將訓練後產生的best.pt檔轉換best.onnx並設置好yaml檔,但在自動標記時,雖然模型成功載入,但執行後卻沒有標記任何東西。

由於上述原因,有試過用yolov8n.yaml訓練只有邊界框的資料,拿訓練後的模型自動標記是有成功標記物件。另外,就是有發現使用軟體裡面預設的yolov8n或是yolov8n-pose模型測試自動標記人,是有標記到,但如果是用官網給的這兩個模型自行轉換onnx檔後在載入自動標記就無法標記到。

訓練資料是魚,有全身(邊界框)、頭尾(關鍵點),下面是我配置模型的yaml檔

type: yolov8_pose
name: yolov8n-pose-r20240706
display_name: YOLOv8n
model_path: best.onnx
confidence_threshold: 0.5
nms_threshold: 0.6
kpt_threshold: 0.25
has_visible: true
classes:
zebrafish:
- head
- tail

這部分是訓練資料的配置檔
train: 'images/train/'
val: 'images/val/'
test: 'images/test/'

nc: 1
names: ["zebrafish"]

kpt_shape: [2, 3]
flip_idx: []

上面的配置檔都是按照官網的教學設定

@CVHub520
Copy link
Owner

CVHub520 commented Jul 6, 2024

您好,请确保以下几点:

  1. *.pt*·onnx 时没有设置动态batch,即dynamic参数应该设置为False(默认值);
  2. 确保自定义的*.yaml配置文件格式是正确的,按照给定示例存在非法的文件内容,请注意缩进:
type: yolov8_pose
name: yolov8n-pose-r20240706
display_name: YOLOv8n
model_path: best.onnx
confidence_threshold: 0.5
nms_threshold: 0.6
kpt_threshold: 0.25
has_visible: true
classes:
  zebrafish:
    - head
    - tail

@CVHub520 CVHub520 added the question Further information is requested label Jul 6, 2024
@JW5123
Copy link
Author

JW5123 commented Jul 6, 2024

您好,已確認過yaml檔格式及pt轉換參數設定,但載入anylabeling後仍無法自動標記出物件。但我進行預測是可以正常標記物件

訓練檔案內容

from ultralytics import YOLO
import multiprocessing

if name == 'main':
multiprocessing.freeze_support()

model = YOLO("../YoloV8模型訓練/Yolo_models/yolov8n-pose.pt")

result = model.train(
    data="../YoloV8模型訓練/yaml/data.yaml",
    imgsz=640,
    epochs=100,
    patience=50,
    batch=16,
    close_mosaic=10,
    project='Yolov8_train_data',
    name='train1',
    device=0
)

pt轉onnx檔內容

from ultralytics import YOLO

model = YOLO('../YoloV8模型訓練/train_weight/best.pt')
model.export(format="onnx", dynamic=False)

資料集 txt 檔格式

0 0.3668478811841037 0.4608295034694061 0.020149026763990226 0.019599891862665635 0.37482638888888886 0.4666666666666667 2 0.35954861111111114 0.45771604938271604 2
0 0.6540483813395108 0.4501765663050757 0.027981081632355752 0.01647986805518463 0.6458957085828344 0.4495453537369705 2 0.6655439121756487 0.4495453537369705 2
0 0.24613231766346247 0.7233693622797505 0.026301277029396795 0.013590138786603936 0.23627200071839077 0.7257742656449553 2 0.25524200790229884 0.723778735632184 2
0 0.7318762496324752 0.7462424037231943 0.02493797692552562 0.01121889625731527 0.7410714285714286 0.7452380952380953 2 0.7242559523809524 0.7478835978835978 2

模型預測

frame0000036

@CVHub520
Copy link
Owner

CVHub520 commented Jul 6, 2024

您好,已確認過yaml檔格式及pt轉換參數設定,但載入anylabeling後仍無法自動標記出物件。但我進行預測是可以正常標記物件

訓練檔案內容

from ultralytics import YOLO import multiprocessing

if name == 'main': multiprocessing.freeze_support()

model = YOLO("../YoloV8模型訓練/Yolo_models/yolov8n-pose.pt")

result = model.train(
    data="../YoloV8模型訓練/yaml/data.yaml",
    imgsz=640,
    epochs=100,
    patience=50,
    batch=16,
    close_mosaic=10,
    project='Yolov8_train_data',
    name='train1',
    device=0
)

pt轉onnx檔內容

from ultralytics import YOLO

model = YOLO('../YoloV8模型訓練/train_weight/best.pt') model.export(format="onnx", dynamic=False)

資料集 txt 檔格式

0 0.3668478811841037 0.4608295034694061 0.020149026763990226 0.019599891862665635 0.37482638888888886 0.4666666666666667 2 0.35954861111111114 0.45771604938271604 2 0 0.6540483813395108 0.4501765663050757 0.027981081632355752 0.01647986805518463 0.6458957085828344 0.4495453537369705 2 0.6655439121756487 0.4495453537369705 2 0 0.24613231766346247 0.7233693622797505 0.026301277029396795 0.013590138786603936 0.23627200071839077 0.7257742656449553 2 0.25524200790229884 0.723778735632184 2 0 0.7318762496324752 0.7462424037231943 0.02493797692552562 0.01121889625731527 0.7410714285714286 0.7452380952380953 2 0.7242559523809524 0.7478835978835978 2

模型預測

frame0000036

Are you sure you are using the X-AnyLabeling repository instead of the AnyLabeling repository? The GUI for the former should be like this:

image

@CVHub520
Copy link
Owner

CVHub520 commented Jul 6, 2024

Additionally, you can try running the built-in yolov8n-pose model first to ensure that the issue is not with the tool itself.

image

@CVHub520
Copy link
Owner

CVHub520 commented Jul 6, 2024

If you still encounter problems after completing the aforementioned verification steps, please zip your ONNX model file, an image that ensures the target can be inferred, and your configuration file, and send the compressed package to the specified email address: cv_hub@163.com.

@JW5123
Copy link
Author

JW5123 commented Jul 7, 2024

Additionally, you can try running the built-in yolov8n-pose model first to ensure that the issue is not with the tool itself.

image

您好,關於這部分的測試有個問題,我直接使用該軟件內建的yolov8n-pose自動標註人體圖片是可以正常標註,但若是照著你們網站的模型庫配置https://github.com/CVHub520/X-AnyLabeling/blob/main/docs/zh_cn/model_zoo.md再導入該軟件就無法正常標註。請問是軟件的bug嗎?

使用軟件內建模型的標註

螢幕擷取畫面 2024-07-07 125925

使用你們網站的配置檔

螢幕擷取畫面 2024-07-07 130518
螢幕擷取畫面 2024-07-07 130537
螢幕擷取畫面 2024-07-07 135004

正常來說,內建的模型不是會跟 https://github.com/CVHub520/X-AnyLabeling/releases/download/v1.0.0/yolov8n-pose.onnx 這個載下來的一樣嗎?

@CVHub520
Copy link
Owner

CVHub520 commented Jul 7, 2024

Additionally, you can try running the built-in yolov8n-pose model first to ensure that the issue is not with the tool itself.
image

您好,關於這部分的測試有個問題,我直接使用該軟件內建的yolov8n-pose自動標註人體圖片是可以正常標註,但若是照著你們網站的模型庫配置https://github.com/CVHub520/X-AnyLabeling/blob/main/docs/zh_cn/model_zoo.md再導入該軟件就無法正常標註。請問是軟件的bug嗎?

使用軟件內建模型的標註

螢幕擷取畫面 2024-07-07 125925

使用你們網站的配置檔

螢幕擷取畫面 2024-07-07 130518 螢幕擷取畫面 2024-07-07 130537 螢幕擷取畫面 2024-07-07 135004

正常來說,內建的模型不是會跟 https://github.com/CVHub520/X-AnyLabeling/releases/download/v1.0.0/yolov8n-pose.onnx 這個載下來的一樣嗎?

大概率是您的模型转换有问题或者配置文件写的有问题。我这边用模型库下载的配置文件和模型本地加载也完全没有问题。如前所述:

If you still encounter problems after completing the aforementioned verification steps, please zip your ONNX model file, an image that ensures the target can be inferred, and your configuration file, and send the compressed package to the specified email address: cv_hub@163.com.

@CVHub520
Copy link
Owner

CVHub520 commented Jul 7, 2024

此外,您也可以尝试通过 git 的方式下载最新的源码运行,保持版本对齐大多数时候能解决很多意想不到的问题,因为当前最新的 GUI 版本并未发布,可能版本更新过程存在一些 gap。

@CVHub520 CVHub520 closed this as completed Aug 8, 2024
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

2 participants