---
title: structured_model_probing
canonical_url: "https://www.modelscope.cn/models/iic/structured_model_probing"
md_url: "https://www.modelscope.cn/models/iic/structured_model_probing.md"
repository: iic/structured_model_probing
chinese_name: "基础视觉模型高效调优-SMP"
last_updated: 2024-04-25
license: "Apache License 2.0"
pipeline_tag: vision-efficient-tuning
tasks:
  - vision-efficient-tuning
model_type:
  - Transformer
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 661
stars: 1
tags:
  - Alibaba
  - Probing
  - "Strcutred Model Probing"
  - "Image Classification"
  - "Vision Transformer"
---

# structured_model_probing

> structured_model_probing - iic 在 ModelScope 开源的模型。基础视觉模型高效调优：Structured Model Probing (SMP) Structured Model Probing (SMP) 是一种适用于基础模型的下游任务迁移的高效方法，可大幅减少任务迁移模型调优过程中对基础模型的前向、反向传播，从而降低训练开销。

iic/structured_model_probing 是 ModelScope 魔搭社区上的vision-efficient-tuning模型，采用 Apache License 2.0 许可。

- **Repository**: iic/structured_model_probing
- **License**: Apache License 2.0
- **Tasks**: vision-efficient-tuning
- **Tags**: Alibaba, Probing, Strcutred Model Probing, Image Classification, Vision Transformer
- **Downloads**: 661
- **Stars**: 1
- **Last updated**: 2024-04-25

Source: https://www.modelscope.cn/models/iic/structured_model_probing

---

# 基础视觉模型高效调优：Structured Model Probing (SMP) 
Structured Model Probing (SMP) 是一种适用于基础模型的下游任务迁移的高效方法，可大幅减少任务迁移模型调优过程中对基础模型的前向、反向传播，从而降低训练开销。

## 方法描述
传统基于基础模型精调的方法涉及到对基础模型全部参数的更新，大幅增加训练开销；同时，基础模型的预训练数据与下游任务存在域相似度差异，影响不同任务的迁移性能。Structured Model Probing (SMP) 对基础模型进行结构化特征抽取，训练外置小型探针模型，从而节省训练开销；此外，基于结构化特征选择正则与线性探针模型参数度量，自动判断迁移任务难易，并自适应决定非线性探针模型复杂度，从而在域相似度不同的下游任务上均能取得较好效果。基本框架如下图所示：

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

* 结构化特征提取：对基础模型特征进行完整的结构化提取，为探针模型提供丰富且多样的特征；
* 结构化正则：对探针模型进行结构化正则，通过结构化特征选择正则控制线性探针模型的复杂度，以判断下游任务难易，并基于此控制非线性模型复杂度。


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

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

* 图像分类 Food-101

### 如何使用

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

#### 代码示例

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

recognition_pipeline = pipeline(Tasks.image_classification, 'damo/structured_model_probing')
file_name = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_structured_model_probing_test_image.jpg'
result = recognition_pipeline(file_name)
print(f'recognition output: {result}.')
```



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

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



## 训练数据介绍

1. [Food-101](https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/) 细粒度食物分类数据集，包含 101 个类别。

## 数据评估及结果

| Method        | Dataset     | Results                  |
| ------------- | ----------- | ------------------------ |
| CLIP-L/14     | Food-101 | 94.67 % (Top-1 Accuracy) |


## 论文引用

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

``` bibtex
@inproceedings{smp2023,
	title = {Structured Model Probing: Empowering Efficient Adaptation by Structured Regularization},
	author = {Zhi-Fan Wu, Chaojie Mao, Xue Wang, Jianwen Jiang, Yiliang Lv, Rong Jin},
	year = {2023},
}
```
