You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
importcv2importtimeimportmatplotlib.pyplotaspltimportsegmentation_refinementasrefineimage=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 modelrefiner=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 outputcv2.imwrite('output.png', output)
plt.imshow(output)
plt.show()
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}
}
About
[CVPR 2020] CascadePSP: Toward Class-Agnostic and Very High-Resolution Segmentation via Global and Local Refinement