首次创建 Refiner 时加载模型耗时较长;fast 模式与 L 参数会影响显存占用和速度,L 越大越占显存;README 称在 PyTorch 1.0 上测试,更高版本仅推测可用于推理。
CascadePSP
hkchengrexMIT更新放缓基于 PyTorch 的通用分割精修网络,通过全局与局部级联细化,把任意已有分割掩码提升到超高分辨率,无需针对特定类别重训。
[CVPR 2020] CascadePSP: Toward Class-Agnostic and Very High-Resolution Segmentation via Global and Local Refinement
pip install segmentation-refinementREADME 未给出具体显存数值;Refiner 的 device 可设为 'cuda:0' 或 'cpu',说明支持 CPU 推理,GPU 型号未说明。
用全局加局部级联细化把粗糙分割掩码修成高分辨率精细结果
基于 PyTorch 的通用分割精修网络,通过全局与局部级联细化,把任意已有分割掩码提升到超高分辨率,无需针对特定类别重训。
核心能力
- 全局步与局部步级联细化任意类别掩码
- 提供 pip 包 segmentation-refinement 两行代码调用
- Refiner 支持 cuda 或 cpu 设备推理
- fast 模式只跑全局步,L 控制显存与速度
- 附带 BIG 超高清数据集与预训练模型
容易踩的坑
- v1.0最新正式版2022-07-07 · 2022-07-07 22:42 UTC
Pretrained model
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
CascadePSP: Toward Class-Agnostic and Very High-Resolution Segmentation via Global and Local Refinement
Ho Kei Cheng*, Jihoon Chung*, Yu-Wing Tai, Chi-Keung Tang
[Supplementary Information (Comparisons with DenseCRF included!)]

Introduction
CascadePSP is a deep learning model for high-resolution segmentation refinement. This repository contains our PyTorch implementation with both training and testing functionalities. We also provide the annotated UHD dataset BIG and the pretrained model.
Here are some refinement results on high-resolution images.

Quick Start
Tested on PyTorch 1.0 -- though higher versions would likely work for inference as well.
Check out this folder. We have built a pip package that can refine an input image with two lines of code.
Install with
pip install segmentation-refinement
Code demo:
import cv2
import time
import matplotlib.pyplot as plt
import segmentation_refinement as refine
image = cv2.imread('test/aeroplane.jpg')
mask = cv2.imread('test/aeroplane.png', cv2.IMREAD_GRAYSCALE)
# model_path can also be specified here
# This step takes some time to load the model
refiner = refine.Refiner(device='cuda:0') # device can also be 'cpu'
# Fast - Global step only.
# Smaller L -> Less memory usage; faster in fast mode.
output = refiner.refine(image, mask, fast=False, L=900)
# this line to save output
cv2.imwrite('output.png', output)
plt.imshow(output)
plt.show()
Network Overview
Global Step & Local Step
| Global Step | Local Step |
|---|---|
![]() | ![]() |
Refinement Module

Table of Contents
Running:
Downloads:
More Results
Refining the masks of Human 3.6M
| Image | Original Mask | Refined Mask |
|---|---|---|
![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
The first row is the failure case (see neck).
Credit
PSPNet implementation: https://github.com/Lextal/pspnet-pytorch
SyncBN implementation: https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
If you find our work useful in your research, please cite the following:
@inproceedings{cheng2020cascadepsp,
title={{CascadePSP}: Toward Class-Agnostic and Very High-Resolution Segmentation via Global and Local Refinement},
author={Cheng, Ho Kei and Chung, Jihoon and Tai, Yu-Wing and Tang, Chi-Keung},
booktitle={CVPR},
year={2020}
}










