HuiZeng / Grid-Anchor-based-Image-Cropping

Project page of the CVPR2019 paper "Reliable and Efficient Image Cropping: A Grid Anchor based Approach"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to specific the resolution and the cropping ratio in python code?

hamhochoi opened this issue · comments

I installed the python version code of this project. In README.md file, there is "Notification: the trained model naturally supports generating crops having fixed aspect ratios or resolutions. This function can be supported when necessary in the future.".
So how can I specific the ratio and resolutions of the output?

For generating crops having fixed aspect ratio, you need to change the generate_crop function to generate a set of candidate crops having fixed aspect ratio. You can refer to the implementations in testGAIC_qualitative_customer.m.

Where is the generate_crop function? Do you mean generate_bboxes() function in croppingDataset.py?

Yes.

Another way is to increase the bin number and change the aspect ratio constraint to generate crops having aspect ration in a certain range.

Thank you! I will try both way

It's worked, thank you so much!

I'm very sorry but I still don't understand how to accomplish this. Would you mind telling me how you did it @hamhochoi ?

You can change ratio constraint in generate_bboxes() to get output images have ratio close with the ratio you want. Example, if you want the ratio to be 4:3 (~1.333) then you should modify the lower and upper bound to close 1.3. Also, you man want to change the value of bins in the code to get the result. To better understand why do that, read the author's paper!

Screenshot from 2019-07-15 16-27-22