|
|
## **Installation** |
|
|
|
|
|
- Install PyTorch |
|
|
- Install required Python packages: |
|
|
|
|
|
```bash |
|
|
pip install datasets |
|
|
pip install huggingface_hub |
|
|
pip install ultralytics |
|
|
``` |
|
|
|
|
|
## Basic usage: Run the Filtering on WIT-base |
|
|
|
|
|
Run the Filtering with Command-Line Arguments |
|
|
|
|
|
|
|
|
```bash |
|
|
python wit_filter.py --device cuda:0 --batch_size 32 --output_filtered_data_file_path /path/to/filtered_data_file.parquet |
|
|
``` |
|
|
|
|
|
- `--device`: Set to "cpu" if GPU is unavailable (default: cuda:0) |
|
|
- `--batch_size`: Adjust based on your available memory (default: 32) |
|
|
- `--output_filtered_data_file_path`: Path to save the filtered results (default: filtered_data_file.parquet) |
|
|
|
|
|
The filtered dataset will be saved at the path specified by `--output_filtered_data_file_path`. |
|
|
|
|
|
## Evaluation Mode Usage: Evaluate Detection Performance on WIT-base Subset |
|
|
|
|
|
A curated evaluation subset of 30 WIT-base images is included to evaluate the detection model performance. |
|
|
|
|
|
|
|
|
To enable evaluation mode and save filtered images into category-specific folders, use the `--eval_mode` flag and specify the image directory: |
|
|
|
|
|
```bash |
|
|
python wit_filter.py --device cuda:0 --batch_size 32 --output_filtered_data_file_path /path/to/filtered_data_file.parquet --eval_mode --filtered_image_dir path/to/image_filter_result_dir |
|
|
``` |
|
|
|
|
|
- `--eval_mode`: Enable evaluation mode to save filtered images into category-specific folders |
|
|
- `--filtered_image_dir`: Directory where the filtered images will be saved (default: image_filter_result_dir) |
|
|
|
|
|
Filtered images will be organized into subfolders under `filtered_image_dir`: |
|
|
|
|
|
- `no_face/`: No valid face detected |
|
|
- `valid_face_no_glasses/`: Valid face detected, no glasses |
|
|
- `valid_face_with_eyeglasses/`: Valid face with eyeglasses |
|
|
- `valid_face_with_sunglasses/`: Valid face with sunglasses |
|
|
|
|
|
### Information about the Evaluation Data |
|
|
|
|
|
📎 `wit_eval_30.csv`: Metadata for the evaluation set. |
|
|
|
|
|
| Column | Description | |
|
|
| --- | --- | |
|
|
| `idx` | Index in the original WIT-base dataset | |
|
|
| `has_face` | 0 = No face or too small, 1 = Valid face | |
|
|
| `glasses_type` | 0 = No glasses, 1 = Eyeglasses, 2 = Sunglasses | |
|
|
|
|
|
📎 `data/`: Directory containing all 30 images in the evaluation subset. |