TF-A2RL: Automatic Image Cropping
[Project] [Paper] [Online Demo] [API] [Related Work: GP-GAN (for Image Blending)]
The official implementation for A2-RL: Aesthetics Aware Rinforcement Learning for Automatic Image Cropping
Overview
source | step 1 | step 2 | step 3 | step 4 | step 5 | output |
---|---|---|---|---|---|---|
A2-RL (aka. Aesthetics Aware Reinforcement Learning) is the author's implementation of the RL-based automatic image cropping algorithm described in:
A2-RL: Aesthetics Aware Reinforcement Learning for Automatic Image Cropping
Debang Li, Huikai Wu, Junge Zhang, Kaiqi Huang
Given a source image, our algorithm could take actions step by step to find almost the best cropping window on source image.
Contact: Hui-Kai Wu ([email protected])
Getting started
- Install the python libraries. (See
Requirements
). - Download the code from GitHub:
git clone https://github.com/wuhuikai/TF-A2RL.git
cd TF-A2RL
-
Download the pretrained models
vfn_rl.pk
from Google Drive, then put them in current directory (TF-A2RL/
). -
Run the python script:
python A2RL.py --image_path test_images/3846.jpg --save_path test_images/3846_cropped.jpg
or
sh example.sh
results)
Results compared with baseline methods (moreSource | VFN+Sliding window | A2-RL | Ground Truth |
---|---|---|---|
Requirements
The code requires the following 3rd party libraries:
- pickle
- numpy
- skimage
pip install scikit-image
Details see the official README for installing skimage.
Details see the official README for installing TensorFlow.
Command line arguments:
Type python A2RL.py --help
for a complete list of the arguments.
--image_path
: path of the input image--save_path
: path of output image
Citation
@article{li2017a2,
title={A2-RL: Aesthetics Aware Reinforcement Learning for Automatic Image Cropping},
author={Li, Debang and Wu, Huikai and Zhang, Junge and Huang, Kaiqi},
journal={arXiv preprint arXiv:1709.04595},
year={2017}
}