赞
踩
最近在尝试做图像目标检测相关的模型训练工作,但是如果想要实现一个模型的训练,数据集是至关重要,而目标检测数据集的制作相对于图像分类要复杂一些,因此需要一个简单易用的标注工具,对比了网上的一堆工具之后,最后选择了label studio,主要是以下原因:
css
复制代码
> conda create -n label-studio python=3.10
> conda activate label-studio
shell
复制代码
> cd /data/code/github/label-studio
# Run database migrations
> python label_studio/manage.py migrate
> python label_studio/manage.py collectstatic
# Start the server in development mode at http://localhost:8080
python label_studio/manage.py runserver
> python label_studio/server.py --host=0.0.0.0 --port=8081
数据保存路径如下:
javascript
复制代码
~/.local/share/label-studio/
如下所示
yaml
复制代码
(label-studio) # ls -lrt ~/.local/share/label-studio/
total 1212
drwxr-xr-x 2 xxxx xxxx 4096 Oct 20 10:36 test_data
drwxr-xr-x 4 xxxx xxxx 4096 Oct 20 11:02 media
drwxr-xr-x 2 xxxx xxxx 4096 Oct 20 12:05 export
-rw-r--r-- 1 xxxx xxxx 1228800 Oct 20 15:30 label_studio.sqlite3
Labeling Interface中可以设置标注的物体类型
Machine Learning可以设置后端推理服务来实现自动化标注,可以参考label-studio-ml-backend,如果使用了Yolov8来做检测的话,可以参考label-studio-yolov8-backend;如果结合SAM来做检测的话,可以参考分割一切?手把手教你部署SAM+LabelStudio实现自动标注
Retrieve predictions when loading a task automatically:会自动将导入的图片去调用预测服务
下面的数字是对应类型的快捷键
可以清理标注结果
标注的数据code如下:
json 复制代码 { "id": 50, "data": { "image": "/data/upload/7/437ac54a-csm_eb24002_58f4fb61dd.jpg" }, "annotations": [ { "id": 5, "created_username": " xxxx@gmail.com, 2", "created_ago": "0 minutes", "completed_by": { "id": 2, "first_name": "", "last_name": "", "avatar": null, "email": "xxxxx@gmail.com", "initials": "li" }, "result": [ { "original_width": 1366, "original_height": 768, "image_rotation": 0, "value": { "x": 10.10689990281827, "y": 27.483448736637506, "width": 23.420796890184647, "height": 37.68170958859735, "rotation": 0, "rectanglelabels": [ "Car" ] }, "id": "8oMV4M5avz", "from_name": "label", "to_name": "image", "type": "rectanglelabels", "origin": "manual" } ], "was_cancelled": false, "ground_truth": false, "created_at": "2023-10-22T09:21:27.660411Z", "updated_at": "2023-10-22T09:21:27.660435Z", "draft_created_at": "2023-10-22T09:19:22.672990Z", "lead_time": 114.60199999999999, "import_id": null, "last_action": null, "task": 50, "project": 7, "updated_by": 2, "parent_prediction": null, "parent_annotation": null, "last_created_by": null } ], "predictions": [] }
可以部署后端预测服务来实现自动标注
shell
复制代码
> git clone https://github.com/HumanSignal/label-studio-ml-backend.git
> cd label-studio-ui-element-backend
> pip install -e .
# 环境验证
> label-studio-ml create env_verify
> label-studio-ml start env_verify -p 9091
css
复制代码
> label-studio-ml create ui_element
> label-studio-ml start ui_element -p 9091
> nohup label-studio-ml start ui_element -p 9091 > ./ui_element/label.log 2>&1 &
> nohup label-studio-ml start ui_element_sam -p 9092 > ./ui_element_sam/label.log 2>&1 &
会导出来所有的标注结果,并且可以导出来不同的标注格式,比如用作YOLO训练的话,一般可以使用YOLO
格式,当然也还有COCO
和VOC
数据格式
目前还没法只导出来选中图片的标注结果。 比如导出来的YOLO数据格式如下:
images:标注的图片
labels:标注数据,使用txt后缀保存,每一行代表一条标注数据,包含5列
classex.txt
中的类别索引保持一致复制代码
0 0.7914317925591883 0.3476714942329373 0.3066516347237879 0.1781053970456451
0 0.7931228861330326 0.5379758910762293 0.30552423900789166 0.16834619720752755
0 0.7931228861330328 0.7221807880206979 0.30777903043968435 0.1756655970861157
这里给大家分享一份Python全套学习资料,包括学习路线、软件、源码、视频、面试题等等,都是我自己学习时整理的,希望可以对正在学习或者想要学习Python的朋友有帮助!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。