[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
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 (huikaiwu@icloud.com)
Evaluation We provide the evaluation script to reproduce our evaluation results on Flickr cropping dataset. For example,
$ python vfn_eval.py --spp false --snapshot snapshots/model-wo-spp You will need to get sliding_window.json and the test images from the Flickr cropping dataset and specify the path of your model when running vfn_eval.py. You can also try our pre-trained model, which can be downloaded from [here].
Copy pre-trained model to View_Finding Direcotry
If you want to get an aesthetic score of a patch, please take a look at the example featured by [ModelDepot]
- Install the python libraries. (See
Requirements
). - Download the code from GitHub:
git clone https://github.com/pjhool/TF-A2RL-Test.git
cd TF-A2RL-Test
-
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 --save_path ./test_images_cropped
or
sh example.sh
- To A2RL Test for AVA Landscape Images , download AVA Landscape Images
Results compared with baseline methods (more results)
Source | VFN+Sliding window | A2-RL | Ground Truth |
---|---|---|---|
The code requires the following 3rd party libraries:
- pickle
- numpy
- skimage
pip install scikit-image
Details see the official README for installing skimage.
- TensorFlow 1.4
Details see the official README for installing TensorFlow.
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
@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}
}