当前位置:   article > 正文

anylabeling 自动标注 使用记录 (跑不起来你打我)

anylabeling

目录

一、anylabeling

二、Segment Anything模型ONNX导出

1、下载这个项目

2、环境配置

3、下载SAM预训练权重

4、导出ONNX格式

三、yaml文件编写

四、视频讲解

五、使用记录

六、其他


一、anylabeling

anylabeling项目地址
我直接用的之前yolov5的conda虚拟环境

pip install anylabeling -i https://pypi.tuna.tsinghua.edu.cn/simple

或许可能直接安装好依赖,但是把该项目的requirenments.txt

  1. pip install -r requirements.txt -i https://pypi.douban.com/simple

以下代码启动运行:

anylabeling

可能会报错:
报错1
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

你把  /etc/gdm/custom.conf中,#WaylandEnable=false改为WaylandEnable=false,然后重启
报错2
Qt platform plugin “xcb“缺失

sudo apt-get install libxcb-xinerama0

然后再次执行

anylabeling

就会出现一个图形界面了

这里第二步选择的模型可以有Segment Anything和yolo系列的网络模型。

二、Segment Anything模型ONNX导出

1、下载这个项目

2、环境配置

  1. cd segment-anything; pip install -e .
  2. pip install opencv-python pycocotools matplotlib onnxruntime onnx

3、下载SAM预训练权重

下载以下几个预训练权重文件,文件从小到大依次排列,越大的模型分割效果越好,但是分割时间也越长,建议先使用最小的模型试试效果,目前实测最小的模型分割效果也很不错。
1,sam_vit_b_01ec64.pth
2,sam_vit_l_0b3195.pth
3,sam_vit_h_4b8939.pth

  1. wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
  2. wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth
  3. wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth

4、导出ONNX格式

--checkpoint  The path to the SAM model checkpoint 即SAM预训练权重

--output  The filename to save the ONNX model to

--model-type In ['default', 'vit_h', 'vit_l', 'vit_b']. Which type of SAM model to export.

python scripts/export_onnx_model.py  --checkpoint ./sam_vit_b_01ec64.pth --model-type vit_b --output sam_vit_b.onnx

三、yaml文件编写

这个软件加载模型必须要yaml文件:

Load Custom Model · Issue #39 · vietanhdev/anylabeling · GitHub

yaml文件如何编写:

Custom Models for Auto Labeling – AnyLabeling

yaml文件与onnx格式文件在同一目录下

运行软件会在家目录生成 anylabling文件夹

SegmentAnything:

  1. type: segment_anything
  2. name: segment_anything_vit_b_quant-r20230416
  3. display_name: Segment Anything (ViT-B Quant)
  4. decoder_model_path: segment_anything_vit_b_decoder_quant.onnx
  5. encoder_model_path: segment_anything_vit_b_encoder_quant.onnx
  6. input_size: 1024
  7. max_height: 682
  8. max_width: 1024

YOLOv5:

  1. type: yolov5
  2. name: yolov5l-r20230415
  3. display_name: YOLOv5l Ultralytics
  4. model_path: yolov5l.onnx
  5. confidence_threshold: 0.45
  6. input_height: 640
  7. input_width: 640
  8. nms_threshold: 0.45
  9. score_threshold: 0.5
  10. classes:
  11. - person
  12. - bicycle
  13. - car
  14. - motorcycle
  15. - airplane
  16. - bus
  17. - train
  18. - truck
  19. - boat
  20. - traffic light
  21. - fire hydrant
  22. - stop sign
  23. - parking meter
  24. - bench
  25. - bird
  26. - cat
  27. - dog
  28. - horse
  29. - sheep
  30. - cow
  31. - elephant
  32. - bear
  33. - zebra
  34. - giraffe
  35. - backpack
  36. - umbrella
  37. - handbag
  38. - tie
  39. - suitcase
  40. - frisbee
  41. - skis
  42. - snowboard
  43. - sports ball
  44. - kite
  45. - baseball bat
  46. - baseball glove
  47. - skateboard
  48. - surfboard
  49. - tennis racket
  50. - bottle
  51. - wine glass
  52. - cup
  53. - fork
  54. - knife
  55. - spoon
  56. - bowl
  57. - banana
  58. - apple
  59. - sandwich
  60. - orange
  61. - broccoli
  62. - carrot
  63. - hot dog
  64. - pizza
  65. - donut
  66. - cake
  67. - chair
  68. - couch
  69. - potted plant
  70. - bed
  71. - dining table
  72. - toilet
  73. - tv
  74. - laptop
  75. - mouse
  76. - remote
  77. - keyboard
  78. - cell phone
  79. - microwave
  80. - oven
  81. - toaster
  82. - sink
  83. - refrigerator
  84. - book
  85. - clock
  86. - vase
  87. - scissors
  88. - teddy bear
  89. - hair drier
  90. - toothbrush

YOLOv8:

  1. type: yolov8
  2. name: yolov8m-r20230415
  3. display_name: YOLOv8m Ultralytics
  4. model_path: yolov8m.onnx
  5. confidence_threshold: 0.45
  6. input_height: 640
  7. input_width: 640
  8. nms_threshold: 0.45
  9. score_threshold: 0.5
  10. classes:
  11. - person
  12. - bicycle
  13. - car
  14. - motorcycle
  15. - airplane
  16. - bus
  17. - train
  18. - truck
  19. - boat
  20. - traffic light
  21. - fire hydrant
  22. - stop sign
  23. - parking meter
  24. - bench
  25. - bird
  26. - cat
  27. - dog
  28. - horse
  29. - sheep
  30. - cow
  31. - elephant
  32. - bear
  33. - zebra
  34. - giraffe
  35. - backpack
  36. - umbrella
  37. - handbag
  38. - tie
  39. - suitcase
  40. - frisbee
  41. - skis
  42. - snowboard
  43. - sports ball
  44. - kite
  45. - baseball bat
  46. - baseball glove
  47. - skateboard
  48. - surfboard
  49. - tennis racket
  50. - bottle
  51. - wine glass
  52. - cup
  53. - fork
  54. - knife
  55. - spoon
  56. - bowl
  57. - banana
  58. - apple
  59. - sandwich
  60. - orange
  61. - broccoli
  62. - carrot
  63. - hot dog
  64. - pizza
  65. - donut
  66. - cake
  67. - chair
  68. - couch
  69. - potted plant
  70. - bed
  71. - dining table
  72. - toilet
  73. - tv
  74. - laptop
  75. - mouse
  76. - remote
  77. - keyboard
  78. - cell phone
  79. - microwave
  80. - oven
  81. - toaster
  82. - sink
  83. - refrigerator
  84. - book
  85. - clock
  86. - vase
  87. - scissors
  88. - teddy bear
  89. - hair drier
  90. - toothbrush

四、视频讲解(非本人视频)

自动标注项目AnyLabeling上手体验和教程

五、使用记录

yolo模型还是蛮好用

标注文件:

但是vit模型在window,onnxruntime获取内存报错。linux端即使最小的模型,也只能点一个点跑不起来,最好有GPU,然后在环境中安装onnx-runtime-gpu

六、其他

SAM+LabelStudio实现自动标注试过了,点了猫图片半天没有反应。还接着尝试了好几个,如SAM-Tool项目,跑不起来。搞了我大半天时间,还是上面这个项目好用,stars走起

参考:
Qt运行出现 Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run....解决_楽 - 冰の菓的博客-CSDN博客

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/709093
推荐阅读
相关标签
  

闽ICP备14008679号