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: 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segmentation_refinement-0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file segmentation_refinement-0.1-py3-none-any.whl.

File metadata

  • Download URL: segmentation_refinement-0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for segmentation_refinement-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db00c3a21c0ff14607e78be82d49c2bd2cb505cd04d1b678b2f575c28e82eafe
MD5 b3a7077fb7d4f1407a9510d4e1ed3275
BLAKE2b-256 05f5bcf45654302b73cd2fbbbb2cd4521a18792b41f99a2a1e7af93a6a64450b

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