Skip to main content

Segmentation Refinement

This is an easy-to-use package version of the CVPR2020 paper CascadePSP. It can refines a binary input segmentation of an image. For details, please refer to the complete repository linked above and the paper.

Installation

Through pip:

pip install segmentation-refinement

or locally,

pip install -e .

Usage

The code has been tested on Ubuntu with PyTorch 1.4.

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) 

plt.imshow(output)
plt.show()

The pre-trained model will be downloaded automatically.

Output (4.77s):

Output image

Output (fast, 0.45s):

Output image

Release files for segmentation-refinement 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for segmentation-refinement 0.6
File Size Uploaded
segmentation-refinement-0.6.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for segmentation-refinement 0.6
File Interpreter ABI Platform
segmentation_refinement-0.6-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / segmentation-refinement-0.6.tar.gz

Download URL segmentation-refinement-0.6.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6656323dbd69ad12ef35f68efa6b6fec7474bf17d04e6600dddf88e6572ef9e7
BLAKE2b-256 checksum
How to use checksums
fb7fd4e99e2c5698da1bfdf97c0e130851b1869db0b9939891e5638d5a8d4312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release files / segmentation_refinement-0.6-py3-none-any.whl

Download URL segmentation_refinement-0.6-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c9b7531ee0c3ac69b74e7ee90976171e251a3691fd8391dbcd1d1ab67ed3027
BLAKE2b-256 checksum
How to use checksums
86cb35692e8823499bd28a5552e2c078eb72c1457d12a990e1bf06e4e07d4331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release history Release notifications | RSS feed

This release

0.6 This release

2 release files

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page