---
title: cv_vit-b16_vision-middleware
canonical_url: "https://www.modelscope.cn/models/iic/cv_vit-b16_vision-middleware"
md_url: "https://www.modelscope.cn/models/iic/cv_vit-b16_vision-middleware.md"
repository: iic/cv_vit-b16_vision-middleware
chinese_name: "ViM视觉中间件-通用领域-Base"
last_updated: 2023-09-18
license: "Apache License 2.0"
pipeline_tag: image-segmentation
tasks:
  - image-segmentation
  - vision-efficient-tuning
model_type:
  - Transformer
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 1096
stars: 6
tags:
  - Alibaba
  - "Vision Middleware"
  - "Image Classification"
  - "Semantic Segmentation"
  - "Vision Transformer"
  - Adapter
---

# cv_vit-b16_vision-middleware

> cv_vit-b16_vision-middleware - iic 在 ModelScope 开源的模型。基于一系列中游任务（分类/检测/分割）等训练的基础模型中间件，能够将单一模型快速适配至多种任务。

iic/cv_vit-b16_vision-middleware 是 ModelScope 魔搭社区上的image-segmentation、vision-efficient-tuning模型，采用 Apache License 2.0 许可。

- **Repository**: iic/cv_vit-b16_vision-middleware
- **License**: Apache License 2.0
- **Tasks**: image-segmentation, vision-efficient-tuning
- **Tags**: Alibaba, Vision Middleware, Image Classification, Semantic Segmentation, Vision Transformer, Adapter
- **Downloads**: 1096
- **Stars**: 6
- **Last updated**: 2023-09-18

Source: https://www.modelscope.cn/models/iic/cv_vit-b16_vision-middleware

---

# Vision Middleware (ViM) 视觉中间件模型介绍
本模型为基于中游任务训练的基础模型多任务中间件模块组，其基础模型为 CLIP-ViT-B/16。

## 模型描述
基础模型的预训练与下游任务存在差异，影响不同任务的迁移性能。Vision Middleware (ViM) 通过引入中游阶段的多任务学习，以视觉中间件模块的方式实现基础模型的通用迁移能力支持，其框架如下图所示：

<center> <img src="./resources/pipeline.png" alt="pipeline" width="800"/> <br> <div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #999; padding: 2px;">ViM 框架示意图</div> </center>

* 上游阶段：基础模型的大规模预训练（数据量 Billion-level+）
* 中游阶段：引入一系列不同的中游任务（如不同数据集的分类/检测/分割等），每个任务独立训练一个适配该任务的中间件模块，基础模型固定（数据量 Million-level）
* 下游阶段：针对特定下游任务，对训练的中间件模块进行自适应聚集，快速将基础模型适配至当前任务（数据量可为百/千级别）



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

目前，本仓库所开源的模型提供了以下两类任务支持：

* 图像分类 ImageNet-1K
* 语义分割 PASCAL VOC

### 如何使用

基于 ModelScope 框架，通过调用预定义的 Pipeline 可实现快速调用（目前支持语义分割任务、GPU 运行）。

#### 代码示例

``` python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys

vim_pipeline = pipeline(Tasks.image_segmentation, 'damo/cv_vit-b16_vision-middleware', model_revision='v0.1.1')
result_status = vim_pipeline('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/vision_middleware_test1.jpg')
result = result_status[OutputKeys.MASKS]
```



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

本模型基于公开的通用数据集训练，且仅适用于训练数据的覆盖类别，在具体应用场景下可能存在偏差。



## 训练数据介绍

1. [ImageNet-1K](https://image-net.org/) 数据集，通用的图像分类数据集，包含 1K 类别。

2. [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/) 数据集，通用的语义分割数据集，包含 21 类别（含背景类）

   

## 数据评估及结果

#### head-only tuning

| Method        | Dataset     | Results                  |
| ------------- | ----------- | ------------------------ |
| CLIP-B/16     | ImageNet-1K | 80.20 % (Top-1 Accuracy) |
| CLIP-B/16+ViM | ImageNet-1K | 82.04 % (Top-1 Accuracy) |
| CLIP-B/16     | PASCAL VOC  | 78.56 % (mIoU)           |
| CLIP-B/16+ViM | PASCAL VOC  | 83.70 % (mIoU)           |



## 在线体验

开发中



## 论文引用

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

``` bibtex
@misc{feng2023vim,
      title={ViM: Vision Middleware for Unified Downstream Transferring}, 
      author={Yutong Feng and Biao Gong and Jianwen Jiang and Yiliang Lv and Yujun Shen and Deli Zhao and Jingren Zhou},
      year={2023},
      eprint={2303.06911},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```
