Skip to main content

Smartcrop transform for PyTorch

Project description

pytorch-smartcrop

This is a PyTorch implementation of the smartcrop algorithm. The smartcrop algorithm is a content aware image cropping algorithm that is used to crop images to the most interesting part of the image. The algorithm is based on the pyvips smartcrop implementation.

Prerequisites

  • requires libvips shared library to be installed on the system. For further information on how to install libvips, please refer to the libvips installation guide

Usage

from pytorch_smartcrop import SmartCrop
from PIL import Image

# load image
image = Image.open('image.jpg')

# crop image to 256x256
sc = SmartCrop(patch_size=(256, 256))
cropped_image = sc(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

pytorch_smartcrop-1.0.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

pytorch_smartcrop-1.0.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

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