This project implements a pedestrian attribute recognition system using deep learning, based on the PA-100K dataset. It includes models for clothing classification, accessories detection, age and gender prediction, and view estimation. Pedestrian detection is handled via YOLO from video input, allowing attribute recognition in real-world scenes.
The implementation is inspired by the paper:
📄 A Framework for Pedestrian Attribute Recognition Using Deep Learning
And evaluated on the PA-100K benchmark paper.
⚡ Our models achieved a total accuracy of 88.29%, surpassing the baseline reported in the HydraPlus paper.
- Modular Training Scripts:
clothing.py— Upper, lower clothing & accessories (multi-task classification)accessories.py— Standalone accessories model (multi-label classification)gender_age.py— Joint age and gender predictionview.py— Pedestrian view classification (front/back/side)
- YOLO-based Evaluation:
eval.pydetects pedestrians in video input and applies trained models to extract attributes.
- Testing Scripts:
test_clothing.py,test_demographics.py,test_view.py— Evaluate respective models on the validation/test sets.
- Utilities:
- Custom PyTorch Dataset (
ImageDatasetPT), label group management, early stopping, and logging viawandb.
- Custom PyTorch Dataset (
Clone the repo and install dependencies:
git clone https://github.com/YasserRohaim/pedestrian-attribute-recognition.git
cd pedestrian-attribute-recognition
pip install -r requirements.txtWe use the PA-100K dataset, which contains over 100,000 pedestrian images annotated with 26 attributes.
Download the dataset and place the images and annotation CSVs inside a PA-100K/ directory as follows:
PA-100K/
├── data/
│ ├── <image files>
├── train.csv
├── val.csv
├── test.csv
Train each model with the respective script:
# Clothing + Accessories classifier
python clothing.py
# Accessories-only classifier
python accessories.py
# Age & Gender classifier
python gender_age.py
# View (pose) classifier
python view.pyEach script uses wandb for tracking and includes early stopping, checkpointing, and metrics logging.
You can evaluate trained models using:
python test_clothing.py # For clothing + accessories model
python test_demographics.py # For age and gender model
python test_view.py # For view estimation modelTo detect pedestrians from a video and recognize their attributes using your trained models:
python eval.py --video path/to/video.mp4YOLO is used to detect pedestrians, and each cropped region is passed through the trained models to infer demographic and clothing information.
| Task | Accuracy |
|---|---|
| View Estimation | 81.61% |
| Gender Classification | 84.54% |
| Age Classification | 96.50% |
| Upper Clothing | 87.90% |
| Lower Clothing | 88.42% |
| Accessories Detection | 88.47% |
| Total Accuracy | 88.29% ✅ |
✅ Outperforms the baseline of the HydraPlus-Net on PA-100K.
Feel free to reach out or open issues for any questions or suggestions.