Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,135 @@
|
|
| 1 |
-
|
| 2 |
-
license:
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- computer-vision
|
| 6 |
+
- face-detection
|
| 7 |
+
- image-classification
|
| 8 |
+
|
| 9 |
+
# Cropped Faces from WIDER FACE Dataset
|
| 10 |
+
|
| 11 |
+
## Dataset Description
|
| 12 |
+
|
| 13 |
+
This repository provides two key datasets for face-related computer vision tasks, delivered as two separate `.zip` archives:
|
| 14 |
+
|
| 15 |
+
1. **`WIDER_val.zip`**: A compressed archive of the original **validation set** from the well-known WIDER FACE dataset. It contains 3,226 images with a wide variety of scales, poses, and occlusions.
|
| 16 |
+
2. **`WIDER_val_cropped_faces.zip`**: A new, high-quality dataset of **18,000+ cropped faces** generated from the images in `WIDER_val.zip`. These images are ideal for training generative models (like GANs or Diffusion Models) or face recognition systems.
|
| 17 |
+
|
| 18 |
+
The cropped faces were generated using a custom, high-performance Rust application. For more information on the generation process and to view the source code, please see the [**GitHub Repository: r4plh/rustFaceCrop**](https://github.com/r4plh/rustFaceCrop).
|
| 19 |
+
|
| 20 |
+
## How to Use
|
| 21 |
+
|
| 22 |
+
The data is provided as `.zip` files. You can download them directly from the "Files and versions" tab or use `git` to clone the repository.
|
| 23 |
+
|
| 24 |
+
Once downloaded and unzipped, you can easily load the images using Python.
|
| 25 |
+
|
| 26 |
+
### Loading the Original Validation Images
|
| 27 |
+
```python
|
| 28 |
+
import glob
|
| 29 |
+
from PIL import Image
|
| 30 |
+
|
| 31 |
+
# Make sure you have unzipped WIDER_val.zip
|
| 32 |
+
validation_image_paths = glob.glob("WIDER_val/**/*.jpg", recursive=True)
|
| 33 |
+
|
| 34 |
+
print(f"Found {len(validation_image_paths)} original validation images.")
|
| 35 |
+
|
| 36 |
+
# Example of loading the first image
|
| 37 |
+
if validation_image_paths:
|
| 38 |
+
img = Image.open(validation_image_paths[0])
|
| 39 |
+
img.show()
|
| 40 |
+
````
|
| 41 |
+
|
| 42 |
+
### Loading the Cropped Face Images
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
import glob
|
| 46 |
+
from PIL import Image
|
| 47 |
+
|
| 48 |
+
# Make sure you have unzipped WIDER_val_cropped_faces.zip
|
| 49 |
+
# The images are inside a folder named 'cropped_faces' within the zip.
|
| 50 |
+
cropped_face_paths = glob.glob("cropped_faces/*.jpg")
|
| 51 |
+
|
| 52 |
+
print(f"Found {len(cropped_face_paths)} cropped faces.")
|
| 53 |
+
|
| 54 |
+
# Example of loading the first cropped face
|
| 55 |
+
if cropped_face_paths:
|
| 56 |
+
face_img = Image.open(cropped_face_paths[0])
|
| 57 |
+
print(f"Image size: {face_img.size}")
|
| 58 |
+
face_img.show()
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Files Included
|
| 62 |
+
|
| 63 |
+
* **`WIDER_val.zip`**
|
| 64 |
+
|
| 65 |
+
* **Description:** A zip archive containing the complete, original WIDER FACE validation dataset (3,226 images) organized into 61 subdirectories, preserving the original structure.
|
| 66 |
+
|
| 67 |
+
* **`WIDER_val_cropped_faces.zip`**
|
| 68 |
+
|
| 69 |
+
* **Description:** A zip archive containing 18,000+ cropped face images generated from the WIDER FACE validation set. Upon unzipping, all images are located in a single, flat folder named `cropped_faces` for easy access.
|
| 70 |
+
|
| 71 |
+
## Dataset Structure
|
| 72 |
+
|
| 73 |
+
After unzipping the archives, your directory will be structured as follows:
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
.
|
| 77 |
+
βββ WIDER_val/
|
| 78 |
+
β βββ 0--Parade/
|
| 79 |
+
β β βββ 0_Parade_marchingband_1_1.jpg
|
| 80 |
+
β β βββ ...
|
| 81 |
+
β βββ 1--Handshaking/
|
| 82 |
+
β β βββ ...
|
| 83 |
+
β βββ ... (61 subdirectories in total)
|
| 84 |
+
β
|
| 85 |
+
βββ cropped_faces/
|
| 86 |
+
βββ 0--Parade_0_Parade_marchingband_1_1_face_1.jpg
|
| 87 |
+
βββ 0--Parade_0_Parade_marchingband_1_1_face_2.jpg
|
| 88 |
+
βββ ... (18,000+ image files)
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## Dataset Creation
|
| 92 |
+
|
| 93 |
+
### Source Data
|
| 94 |
+
|
| 95 |
+
The source images are from the **WIDER FACE** dataset, one of the most widely used benchmarks for face detection. The original dataset was created by the Chinese University of Hong Kong (CUHK).
|
| 96 |
+
|
| 97 |
+
### Generation Process
|
| 98 |
+
|
| 99 |
+
The `cropped_faces` dataset was generated by processing all 3,226 images from the `WIDER_val` set with a custom Rust application.
|
| 100 |
+
|
| 101 |
+
* **Repository for the Rust Code:** [**github.com/r4plh/rustFaceCrop**](https://github.com/r4plh/rustFaceCrop)
|
| 102 |
+
* **Detection Model:** `yolov11n-face.onnx`, a lightweight and accurate YOLO model.
|
| 103 |
+
|
| 104 |
+
The generation pipeline involved several key steps to ensure quality:
|
| 105 |
+
|
| 106 |
+
1. **Decoding Model Output:** The program correctly decodes the model's complex, transposed output shape (`[1, 5, 8400]`) to get accurate bounding box data.
|
| 107 |
+
2. **Filtering with NMS:** Non-Max Suppression (NMS) with an IoU threshold of `0.45` was used to eliminate noisy and overlapping detections, ensuring only the single best box for each face was kept.
|
| 108 |
+
3. **Safe Cropping:** The code uses safe math (`saturating_sub`) to add padding to the bounding boxes without crashing on faces near the image edge. It also performs a final sanity check to ensure crop dimensions are valid before saving the file.
|
| 109 |
+
|
| 110 |
+
### Curation Rationale
|
| 111 |
+
|
| 112 |
+
The primary goal of this dataset is to provide a clean, ready-to-use set of aligned and cropped faces. This saves researchers and developers the significant time and computational effort required for the detection and preprocessing steps, allowing them to focus directly on training generative models or other face-specific tasks.
|
| 113 |
+
|
| 114 |
+
## Considerations for Using the Data
|
| 115 |
+
|
| 116 |
+
* **Bias:** This dataset inherits any biases present in the original WIDER FACE dataset regarding demographics, geography, and scenarios.
|
| 117 |
+
* **Model Limitations:** The quality and completeness of the `cropped_faces` set are dependent on the performance of the `yolov11n-face` model. Some very small, heavily occluded, or non-frontal faces may have been missed.
|
| 118 |
+
* **File Naming:** The filenames for the cropped faces are programmatically generated and can be long, reflecting the original subdirectory and filename.
|
| 119 |
+
|
| 120 |
+
## Licensing Information
|
| 121 |
+
|
| 122 |
+
The original WIDER FACE dataset does not specify a license but is widely used for academic and research purposes. The new dataset of cropped faces is provided under the **MIT License**. However, the use of these images is still subject to any terms and conditions of the original source data.
|
| 123 |
+
|
| 124 |
+
## Citation
|
| 125 |
+
|
| 126 |
+
If you use this dataset in your work, please cite the original WIDER FACE paper:
|
| 127 |
+
|
| 128 |
+
```bibtex
|
| 129 |
+
@inproceedings{yang2016wider,
|
| 130 |
+
Author = {Yang, Shuo and Luo, Ping and Chen Change, Loy and Tang, Xiaoou},
|
| 131 |
+
Booktitle = {IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
|
| 132 |
+
Title = {WIDER FACE: A Face Detection Benchmark},
|
| 133 |
+
Year = {2016}
|
| 134 |
+
}
|
| 135 |
+
```
|