Skip to main content

Deep learning based segmentation refinement system.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segmentation-refinement-0.4.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file segmentation-refinement-0.4.tar.gz.

File metadata

  • Download URL: segmentation-refinement-0.4.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0.post20200616 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for segmentation-refinement-0.4.tar.gz
Algorithm Hash digest
SHA256 7f34f27186aebe1c789102704b3f1142125334b66b83656fce6d535083132561
MD5 f76a74966a401bcc1e718aa7d541c972
BLAKE2b-256 ee827b79c5a572b7ac28767bc71c606cbea7ada2be5bf0e6d5590875a79cbadc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page