新版的labelme中已经内置了AI Model功能,能够通过模型智能识别图像中想要标注的区域,能够显著减少工作量。但是第一次使用这个功能的时候会要下载模型权重,此时一般速度会非常慢,或者出现报错无法下载,下面提出一种解决方法。
如图,有5种模型,每个模型需要分别下载encoder和decoder两个部分的.onnx文件,下载链接分别贴在下面(建议挂上魔法上网,直接复制到浏览器即可启动下载,速度很快,一般几秒钟就能下载完)
1.SegmentAnything (speed)
# encoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_b_01ec64.quantized.encoder.onnx
# decoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_b_01ec64.quantized.decoder.onnx
2.SegmentAnything (balanced)
# encoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_l_0b3195.quantized.encoder.onnx
# decoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_l_0b3195.quantized.decoder.onnx
3.SegmentAnything (accuracy)
# encoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_h_4b8939.quantized.encoder.onnx
# decoder
https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_h_4b8939.quantized.decoder.onnx
4.EfficientSam (speed)
# encoder
https://github.com/labelmeai/efficient-sam/releases/download/onnx-models-20231225/efficient_sam_vitt_encoder.onnx
# decoder
https://github.com/labelmeai/efficient-sam/releases/download/onnx-models-20231225/efficient_sam_vitt_decoder.onnx
5.EfficientSam (accuracy)
# encoder
https://github.com/labelmeai/efficient-sam/releases/download/onnx-models-20231225/efficient_sam_vits_encoder.onnx
# decoder
https://github.com/labelmeai/efficient-sam/releases/download/onnx-models-20231225/efficient_sam_vits_decoder.onnx
下载完成后,复制对应的网址,填入以下代码的url中,并运行代码
# 此处以SegmentAnything (speed)的encoder部分为例
# 那么网址为https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_l_0b3195.quantized.decoder.onnx
# 将该网址填入url中
url = "https://github.com/wkentaro/labelme/releases/download/sam-20230416/sam_vit_l_0b3195.quantized.decoder.onnx"
print(url.replace("/", "-SLASH-")
.replace(":", "-COLON-")
.replace("=", "-EQUAL-")
.replace("?", "-QUESTION-"))
此时终端输出
https-COLON--SLASH--SLASH-github.com-SLASH-wkentaro-SLASH-labelme-SLASH-releases-SLASH-download-SLASH-sam-20230416-SLASH-sam_vit_l_0b3195.quantized.decoder.onnx
在终端中复制输出的字符串,找到前面步骤下载的文件,即:
sam_vit_l_0b3195.quantized.decoder.onnx
将文件重命名为刚刚复制的字符串(注意连同.onnx的扩展名也要一起选定),此时文件名为:
https-COLON--SLASH--SLASH-github.com-SLASH-wkentaro-SLASH-labelme-SLASH-releases-SLASH-download-SLASH-sam-20230416-SLASH-sam_vit_l_0b3195.quantized.decoder.onnx
完成后,将文件复制到(xxx表示你当前的用户名):
C:\Users\xxx\.cache\gdown
如下图
重新打开labelme即可使用AI Model功能。
标签:Polygon,sam,Ai,onnx,SLASH,decoder,download,com,下载 From: https://blog.csdn.net/weixin_44474255/article/details/139304488