From 5ec8b47e965940b61bf15f2b64bba4036a5bfdb4 Mon Sep 17 00:00:00 2001 From: LIHHAO Date: Thu, 30 Jul 2020 14:17:26 +0800 Subject: [PATCH] update --- MANIFEST.in | 6 +++++- README.md | 15 ++++++++++++++- visualization.py | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 92dc66a..e5317f0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,8 @@ -include *py *md LICENSE *txt +include demo.py +include README.md +include LICENSE +include MANIFEST.in +include visualization.py include autocrop/*py include autocrop/model/*py include autocrop/model/rod_align/functions/* diff --git a/README.md b/README.md index 91c99d7..e6a903a 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ crop_ret = autocropper.crop(img_, topK=1, crop_height=1, crop_width=1, - filter_face=True) + filter_face=True, # True: Crop result will not contain half face + single_face_center=True) # True: face in the crop result's width center ``` You can visualize the cropping results @@ -91,14 +92,26 @@ This project is mostly based on GAIC, and the modules are listed as follows: It is slightly different from GAIC in practice, as shown below: +1. **We can specify any crop ratio** + GAIC supports RoIs with uncertain aspect ratios and several RoIs with fixed aspect ratios(`1:1, 4:3, 16:9`). In practical applications, image cropping needs to select the cropping area according to the fixed aspect ratio. I modified the code of the bboxes generation part. For RoIs evaluation, I used the GAIC pre-trained model. +2. **If there is only half a face in the bounding box, filter out the bounding box** + At the same time, in practical applications, when the distribution of people in the picture is not fixed, for example, when two people stand on the left and right sides of the picture, the RoI selected by GAIC may tear the human body. We adopt the face detection method to filter out some non-conformities. The required RoI will be evaluated after. There is a comparison: comparison with face detection - w150 +3. **When the bounding box has only one face, the face should be in the middle of the box as much as possible** + +We have added additional options when generating anchor boxes. If there is only one face in a RoI, use the RoI with the face in the middle of the RoI's width direction. see `autocrop/cropper.py` for details. + +There is a comparison: + +comparison with face detection - w150 + ## Reference 1. [GAIC: Grid-Anchor-based-Image-Cropping-Pytorch](https://github.com/lld533/Grid-Anchor-based-Image-Cropping-Pytorch) MIT License diff --git a/visualization.py b/visualization.py index 50e3443..7d53221 100644 --- a/visualization.py +++ b/visualization.py @@ -143,4 +143,4 @@ def bbox_visualization(crop_height=1, if __name__ == '__main__': - bbox_visualization(crop_height=322, crop_width=436) + bbox_visualization(crop_height=7, crop_width=5)