---
title: cv_resnet50_fast-instance-segmentation_coco
canonical_url: "https://www.modelscope.cn/models/iic/cv_resnet50_fast-instance-segmentation_coco"
md_url: "https://www.modelscope.cn/models/iic/cv_resnet50_fast-instance-segmentation_coco.md"
repository: iic/cv_resnet50_fast-instance-segmentation_coco
chinese_name: "FastInst快速实例分割"
last_updated: 2023-06-20
license: "Apache License 2.0"
pipeline_tag: image-segmentation
tasks:
  - image-segmentation
model_type:
  - fastinst
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 50301
stars: 25
tags:
  - Alibaba
  - "real-time segmentation"
  - FastInst
  - cvpr2023
---

# cv_resnet50_fast-instance-segmentation_coco

> cv_resnet50_fast-instance-segmentation_coco - iic 在 ModelScope 开源的模型。FastInst是一种简单的基于查询的图像分割框架。它的关键设计包括实例激活引导的查询、双路径更新策略和真值掩码引导的学习。这些组件使我们能够使用更轻量的像素解码器、更少的Transformer解码器层，同时获得更好的性能。 实验表明，FastInst在速度和准确性方面优于大多数最先进的实时实例分割模型，包括强大的全卷积网络基线。其结构示意图如下所示

iic/cv_resnet50_fast-instance-segmentation_coco 是 ModelScope 魔搭社区上的image-segmentation模型，采用 Apache License 2.0 许可。

- **Repository**: iic/cv_resnet50_fast-instance-segmentation_coco
- **License**: Apache License 2.0
- **Tasks**: image-segmentation
- **Tags**: Alibaba, real-time segmentation, FastInst, cvpr2023
- **Downloads**: 50301
- **Stars**: 25
- **Last updated**: 2023-06-20

Source: https://www.modelscope.cn/models/iic/cv_resnet50_fast-instance-segmentation_coco

---

# FastInst快速实例分割模型介绍

## 模型描述

FastInst是一种简单的基于查询的图像分割框架。它的关键设计包括实例激活引导的查询、双路径更新策略和真值掩码引导的学习。这些组件使我们能够使用更轻量的像素解码器、更少的Transformer解码器层，同时获得更好的性能。 实验表明，FastInst在速度和准确性方面优于大多数最先进的实时实例分割模型，包括强大的全卷积网络基线。其结构示意图如下所示

![FastInst模型结构](description/fastinst.png)

以下是一些实验结果

![FastInst模型结构](description/results.png)

## 期望模型使用方式以及适用范围

本模型适用范围较广，能对图片中包含的一般物体（COCO 80类）进行实例级别的分割。

### 如何使用

在ModelScope框架上，提供输入图片，即可通过简单的Pipeline调用来使用。

#### 代码范例
```python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

input_img = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_instance_segmentation.jpg'
segmentation_pipeline = pipeline(Tasks.image_segmentation, 'damo/cv_resnet50_fast-instance-segmentation_coco')
result = segmentation_pipeline(input_img)
```

### 模型局限性以及可能的偏差

- 部分非常规图片或感兴趣物体占比太小或遮挡严重可能会影响分割结果
- 当前版本在python 3.7环境测试通过，其他环境下可用性待测试
- 本模型依赖mmcv，需用户在机器上正确安装[mmcv](https://mmcv.readthedocs.io/en/latest/get_started/installation.html)

## 训练数据介绍

- [COCO2017](https://cocodataset.org/#detection-2017)：COCO全称是Common Objects in Context，是Microsoft团队提供的一个可以用来图像识别、检测和分割的数据集。COCO2017包含训练集118287张、验证集5000张、测试集40670张，共有80类物体。

## 模型训练流程

- 请参考原论文

### 预处理

测试时主要的预处理如下：
- Resize：先将原始图片的短边Resize到640，等比例缩放。此时如果长边超过了864，则按照最长边为864，重新计算Resize的scale进行Resize
- Normalize：图像归一化，减均值除以标准差
- Pad：图像高宽补零至32的倍数

## 数据评估及结果

模型在COCO2017val上进行测试，结果如下:

| Backbone |  Pretrain   | Epochs | mask mAP | #params | GFLOPs | FPS (V100) | 
|:--------:|:-----------:|:------:|:--------:|:-------:|:------:|:----------:|
| ResNet50 | ImageNet-1k |   50   |   37.9   |   34M   |  75.5  |    35.5    |

更多结果请参见原论文。

## 引用
如果你觉得该模型对你有所帮助，请考虑引用下面的相关论文：

```BibTeX
@article{he2023fastinst,
  title={FastInst: A Simple Query-Based Model for Real-Time Instance Segmentation},
  author={He, Junjie and Li, Pengyu and Geng, Yifeng and Xie, Xuansong},
  journal={arXiv preprint arXiv:2303.08594},
  year={2023}
}
```
