Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 736 Bytes

README.md

File metadata and controls

21 lines (14 loc) · 736 Bytes

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)