Label-studio
概要
在label-studio工具中集成机器学习模型,可以辅助自动化标注数据集,非常节约时间。一般手工标注直接安装label-studio后打开就行,安装后根据需求选取模板标注(非常简单,按照GitHub流程来就行)。主要记录一下自己在label-studio中集成机器学习模型的经历,先介绍label-studio的安装方式,再介绍label-studio-ml集成,最后介绍数据Cloud storage setup。
安装流程
1.安装label-studio
1.1Anaconda
# Install locally with pip
pip install label-studio
# Install locally with Anaconda
conda create --name label-studio
conda activate label-studio
conda install psycopg2
pip install label-studio
# Start the server at http://localhost:8080
label-studio
window和Linux系统下安装anaconda,创建虚拟环境运行都能成功。
1.2Docker
还可以用docker(第一次接触,不太熟,后面集成模型遇到很多问题,也是因为这个成功)安装
# install label-studio images
docker pull heartexlabs/label-studio:latest
# Run Label Studio in a Docker container
docker run -it -p 8080:8080 -v $(pwd)/mydata:/label-studio/data heartexlabs/label-studio:latest
将/mydata
设置为自己的数据集目录,docker在Linux上安装没得权限,在window下查阅说安装Docker Desktop。
Docker Desktop安装网址,需要注意Hyper-V和WSL2这两个东西,因为第一次接触docker少了开启Hyper-V服务中的容器,导致不成功。安装配置成功后,运行上述命令会生成一个image镜像,并创建一个独立的container,如下图所示:
启动流程
1.Anaconda
1.1在anaconda中pip install label-studio
label-studio or label-studio start
1.2本地启动label-studio
下载代码,完成后进入目录
# Install all package dependencies
pip install -e .
# 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
Linux系统中没有问题,window会出错,原因是因为有一个包没有window版的。
2.Docker
如果要重新创建一个标注容器则启动image,继续上一个容器则启动container
标注流程
1.注册账号(sign up)
2.登陆后create自己的项目(项目名、上传数据、选择模板)
根据自己的任务选择template,或者创建自己需要的template。
3.以computer vision-keypoint labeling为例:
自定义标签名,可增可删,切换到coda,以hxml文件定义模板(定义参数在下面有解释):
保存后就能标注了!
annoation技术名词解释
选择template时,根据需求定义annoation信息
value* string - Value of the label
selected true / false - Whether to preselect this label
maxUsages number - Maximum number of times this label can be used per task
hint string - Hint for label on hover
hotkey string - Hotkey to use for the label. Automatically generated if not specified
alias string - Label alias
showAlias true / false - Whether to show alias inside label text
aliasstyle string - CSS style for the alias
size string - Size of text in the label
background string - Background color of an active label in hexadecimal
selectedColor string - Color of text in an active label in hexadecimal
granularity symbol/ word - Set control based on symbol or word selection (only for Text)
html string - HTML code is used to display label button instead of raw text provided by value' (should be properly escaped)
小结
接触Docker后,确实好用,后续模型集成自动标注和cloud storage都是调试Docker先成功,再尝试其他方法。