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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pytorch_smartcrop-1.0.0.tar.gz.

File metadata

  • Download URL: pytorch_smartcrop-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for pytorch_smartcrop-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9f9344efd4269ef0d8b091ec083f37dcf80ba8c232e83fad7963539e82006520
MD5 36c58a2effbfe3f72ed0120be6dcb52e
BLAKE2b-256 4b59133eba0abf90b362569e9d9b8612be0138e07eaec085909a093166e4c94b

See more details on using hashes here.

File details

Details for the file pytorch_smartcrop-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytorch_smartcrop-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04e1b7a3ddbcd284e9bfdd69c845104396e0957322d6821b314853ea1bd10067
MD5 7609fdf02d0c71cf1aaeb0b5fe6b98a3
BLAKE2b-256 b79928e4c6324f101c21aa8d235daf6b0355b771487c29a3923af483c3620b0a

See more details on using hashes here.

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