Label-Studio X SAM 半自动化标注
Label Studio 是一个开源的数据标注工具,支持标注多类型数据,输出多格式。包括标注音频、文本、图像、视频和时间序列数据,可输出mask图片、yolo、voc、coco等;可借助sam辅助标注
服务部署
docker环境构建
FROM ultralytics/yolov5:v6.1
RUN apt update
RUN pip install label-studio==1.7.3 -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install label-studio-ml==1.0.9 -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install segment_anything_hq -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install timm -i https://pypi.tuna.tsinghua.edu.cn/simple
相关下载路径
git clone https://github.com/open-mmlab/playground
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
#### 分割的效果好使用 sam_vit_h_4b8939.pth
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
服务部署
cd /project/playground-main/label_anything
nohup label-studio-ml start sam --port 8003 --with \
sam_config=vit_b \
sam_checkpoint_file=/project/weights/sam_vit_b_01ec64.pth \
out_mask=True \
out_bbox=True \
out_poly=True \
device=cuda:0 &
sleep 10
export ML_TIMEOUT_SETUP=40
label-studio start
使用教程 服务地址: http://0.0.0.0:8080/
相关配置
<View>
<Image name="image" value="$image" zoom="true"/>
<KeyPointLabels name="KeyPointLabels" toName="image">
<Label value="cat" smart="true" background="#e51515" showInline="true"/>
<Label value="person" smart="true" background="#412cdd" showInline="true"/>
</KeyPointLabels>
<RectangleLabels name="RectangleLabels" toName="image">
<Label value="cat" background="#FF0000"/>
<Label value="person" background="#0d14d3"/>
</RectangleLabels>
<PolygonLabels name="PolygonLabels" toName="image">
<Label value="cat" background="#FF0000"/>
<Label value="person" background="#0d14d3"/>
</PolygonLabels>
<BrushLabels name="BrushLabels" toName="image">
<Label value="cat" background="#FF0000"/>
<Label value="person" background="#0d14d3"/>
</BrushLabels>
</View>