---
title: PASD_image_super_resolutions
canonical_url: "https://www.modelscope.cn/models/damo/PASD_image_super_resolutions"
md_url: "https://www.modelscope.cn/models/damo/PASD_image_super_resolutions.md"
repository: damo/PASD_image_super_resolutions
chinese_name: "PASD图像超分模型"
last_updated: 2025-08-13
license: "Apache License 2.0"
parameters: 1.2B
tensor_type:
  - F16
library_name:
  - pytorch
  - safetensors
frameworks:
  - pytorch
domain:
  - cv
downloads: 5149
stars: 10
tags:
  - "Image Super-Resolution"
  - "Stable Diffusion"
  - "Pixel-Aware Stable Diffusion"
  - PASD
  - "图像修复"
  - "图像超分辨率"
---

# PASD_image_super_resolutions

> PASD_image_super_resolutions - damo 在 ModelScope 开源的模型。Pixel-Aware Stable Diffusion for Realistic Image Super-Resolution and Personlized Stylization 图像超分辨率和风格化 该模型为图像超分辨修复，输入一个低清晰度图像，返回修复的高清晰度图像。通过切换基模可以实现风格化。切换基模的方式可以在configuration.json文件中找到。

damo/PASD_image_super_resolutions 是 ModelScope 魔搭社区上的 1.2B 参数机器学习模型，采用 Apache License 2.0 许可。

- **Repository**: damo/PASD_image_super_resolutions
- **License**: Apache License 2.0
- **Parameters**: 1.2B
- **Tags**: Image Super-Resolution, Stable Diffusion, Pixel-Aware Stable Diffusion, PASD, 图像修复, 图像超分辨率
- **Downloads**: 5149
- **Stars**: 10
- **Last updated**: 2025-08-13

Source: https://www.modelscope.cn/models/damo/PASD_image_super_resolutions

---

# Pixel-Aware Stable Diffusion for Realistic Image Super-Resolution and Personlized Stylization 图像超分辨率和风格化
该模型为图像超分辨修复，输入一个低清晰度图像，返回修复的高清晰度图像。通过切换基模可以实现风格化。切换基模的方式可以在configuration.json文件中找到。

模型框架如下:

<img src="./pictures/pasd_arch.png">

## 模型描述
该模型基于Stable Diffusion v1.5与diffusers进行构建。
## 模型期望使用方式和适用范围

1. 该模型适用于多种场景的图像输入，特别的在人像场景有优异的表现；
2. 该模型推理时对机器GPU显存有一定要求；我们已经做了很多减少显存的操作，包括采用FP16、开启enable_model_cpu_offload以及VAE decoder的tiled操作等。如果没有GPU显卡或显存不足够，可以尝试使用CPU模式进行推理，但速度会特别慢。
3. 推荐使用torch2.0以上版本，否则显存很容易OOM。

### 如何使用Pipeline
在ModelScope框架上，提供输入低清图像，即可以通过简单的Pipeline调用来使用PASD图像超分辨率修复模型。
#### 依赖
```shell
pip install  'diffusers==0.28.0' 
```
#### 推理代码范例
```python
import cv2
import torch
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

input_location = 'http://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/results/output_test_pasd/0fbc3855c7cfdc95.png'
prompt = ''
output_image_path = 'result.png'

input = {
    'image': input_location,
    'prompt': prompt,
    'upscale': 2,
    'fidelity_scale_fg': 1.0,
    'fidelity_scale_bg': 1.0
}
pasd = pipeline(Tasks.image_super_resolution_pasd, model='damo/PASD_image_super_resolutions', model_revision='master')
output = pasd(input)[OutputKeys.OUTPUT_IMG]
cv2.imwrite(output_image_path, output)
print('pipeline: the output image path is {}'.format(output_image_path))
```
#### 推理代码说明
- Pipeline调用参数
  - 输入要求：输入字典中必须指定的字段有'image'，；其他可选输入字段及其默认值包括：
```python
'prompt': '',
'num_inference_steps': 20,
'guidance_scale': 7.5,
'added_prompt': 'clean, high-resolution, 8k, best quality, masterpiece, extremely detailed',
'negative_prompt': 'dotted, noise, blur, lowres, smooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality',
'upscale': 2,
'fidelity_scale_fg': 1.0,
'fidelity_scale_bg': 1.0,
'eta': 0.0
```
其中fidelity_scale_fg和fidelity_scale_bg两个值分别用于控制前景（人脸区域）和背景的控制强度，强度越弱（值越小），生成的能力越强；强度越强（值越大），保真能力越好。

如果遇到报错类似于：
```text
No module named 'transformers.models.qwen3'
```
请考虑卸载awq:
```shell
pip uninstall autoawq
```

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

- 在一些场景下，模型的处理效果可能不佳。可以通过更改种子或者调整prompt等尝试多次生成，取最佳的结果。
- 模型对显存的要求比较大，对于显存较小的机器，建议降低放大分辨率，调低upscale值。


## 说明与引用
本算法模型源自一些开源项目：

- [https://github.com/AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
- [https://github.com/huggingface/diffusers](https://github.com/huggingface/diffusers)
- [https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111](https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111)

如果你觉得这个模型对你有所帮助，请考虑引用下面的相关论文：
```
@misc{yang2023pasd,
      title={Pixel-Aware Stable Diffusion for Realistic Image Super-Resolution and Personalized Stylization}, 
      author={Tao Yang and Peiran Ren and Xuansong Xie and Lei Zhang},
      year={2023},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```
