简介
YOLACT / YOLACT++ 是在one-stage型检测器上添加一个mask分支来达到实例分割.
论文地址:
- YOLACT: Real-time Instance Segmentation
- YOLACT++: Better Real-time Instance Segmentation
- github开源地址: https://github.com/dbolya/yolact
优势:
- 速度快,因为one-stage;
- mask质量高,因为不包含repooling类操作;
- 普适性强,这种生成原型mask和mask系数的思路可以应用在目前很多留下的检测器上。
性能对比:
与其他一些现有的实例分割模型在COCO数据集上的表现对比如下图所示

结果展示:

YOLACT 安装与测试
安装:
-
github开源地址: https://github.com/dbolya/yolact
-
安装依赖:
Pytorch 1.0.1 (or higher),TorchVision,cython,opencv-python,pillow,matplotlib -
由于pycocotools 并不支持Windows系统, pip无法直接安装, 需要折腾一下 查看教程:
- 下载 Visual C++ 2015 Build Tools, 默认路径安装
- 执行pip命令:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPIgithub访问不稳定时, 多试几次
-
进入项目目录
.\yolact-master\ -
下载 预训练权重 至
.\yolact-master\weights\文件夹
图像输入测试:
- 将自己的测试图像放在该目录下
.\yolact-master\test.jpg - 执行命令
python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.15 --top_k=15 --image=test.jpg

webcam测试:
官方提供了测试api, 但我这里未能运行
python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.15 --top_k=15 --video_multiframe=4 --video=0
opencv开启摄像头测试:
- 完整代码已经上传: 点击下载
删除了命令参数输入与解析代码, 可以直接运行 - 关键代码如下: 使用opencv打开摄像头, 并显示检测结果
def evalimage(net: Yolact, camera_index=0):
camera = cv.VideoCapture(camera_index, cv.CAP_DSHOW)
if not camera

本文详细介绍YOLACT及YOLACT++实例分割模型的安装、测试与人体识别的重训练流程,涵盖COCO数据集调整、模型微调等关键技术。
最低0.47元/天 解锁文章
3万+





