CascadePSP

hkchengrexMIT更新放缓

基于 PyTorch 的通用分割精修网络,通过全局与局部级联细化,把任意已有分割掩码提升到超高分辨率,无需针对特定类别重训。

[CVPR 2020] CascadePSP: Toward Class-Agnostic and Very High-Resolution Segmentation via Global and Local Refinement

v1.0发布于 2022-07-07 22:42 UTC888star97fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
pip install segmentation-refinement
硬件要求按 README 说明

README 未给出具体显存数值;Refiner 的 device 可设为 'cuda:0' 或 'cpu',说明支持 CPU 推理,GPU 型号未说明。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用全局加局部级联细化把粗糙分割掩码修成高分辨率精细结果

基于 PyTorch 的通用分割精修网络,通过全局与局部级联细化,把任意已有分割掩码提升到超高分辨率,无需针对特定类别重训。

核心能力

  • 全局步与局部步级联细化任意类别掩码
  • 提供 pip 包 segmentation-refinement 两行代码调用
  • Refiner 支持 cuda 或 cpu 设备推理
  • fast 模式只跑全局步,L 控制显存与速度
  • 附带 BIG 超高清数据集与预训练模型

容易踩的坑

首次创建 Refiner 时加载模型耗时较长;fast 模式与 L 参数会影响显存占用和速度,L 越大越占显存;README 称在 PyTorch 1.0 上测试,更高版本仅推测可用于推理。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v1.0
  1. v1.0最新正式版2022-07-07 · 2022-07-07 22:42 UTC

    Pretrained model

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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

    [arXiv] [PDF]

    [Supplementary Information (Comparisons with DenseCRF included!)]

    [Supplementary image results]

    gif

    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. teaser

    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 StepLocal Step
    Global StepLocal Step

    Refinement Module

    Refinement Module

    Table of Contents

    Running:

    Downloads:

    More Results

    Refining the masks of Human 3.6M

    ImageOriginal MaskRefined Mask
    ImageOriginalMaskRefinedMask
    ImageOriginalMaskRefinedMask
    ImageOriginalMaskRefinedMask

    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}
    }