Collecting Samples by Detecting Faces in Multiple Image Files and Trimming the Face Regions
Previously
I implemented a feature that detects faces
in a specified image file.

This Time
First, let’s collect sample images.
I scraped and downloaded them from the web using BeautifulSoup.
(I’ll publish the script once I’ve cleaned it up.)
Roughly 13 images.
Since I eventually want to do machine learning I’d like to have more,
but this time the main focus is introducing the script,
so this many will do.
Trimming the Face Regions
Here’s the script. (for Python 3)
1 | // clone |
Here’s what running the script actually looks like.
You can see that the trimmed images are stored in the _trimming folder.
They are stored in the following order by No.
| No | Item | Explain |
|---|---|---|
| 1 | _resize | Resizes images of various sizes uniformly to a height of 500 or less. |
| 2 | _addbox | Stores images with a box drawn around the face. This is for verifying where in each image the face was detected. |
| 2 | _trimming | Stores images where the face region from the files in _addbox has been trimmed and resized to 64×64, and additionally rotated by a few degrees. |
I hope this helps make collecting samples easier.
Collecting Samples by Detecting Faces in Multiple Image Files and Trimming the Face Regions
https://kenzo0107.github.io/en/2016/08/04/detect-face-triming-sample/
