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:
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
Close
Hashes for segmentation_refinement-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21b8d8aeab4dc797597b18c4efec7175d2bb0895d0f01f04cc11eb774842a9df |
|
MD5 | 9e48f9cdcf655029653990d445a488a8 |
|
BLAKE2b-256 | 4a2adf2b5b750c2baad93fb348d9f28d9e826955413476cbffef0829c3de9d4f |