https://github.com/pd-mera/gender-classification
Finetune torchvision pretrained model to classify gender
https://github.com/pd-mera/gender-classification
Last synced: 3 months ago
JSON representation
Finetune torchvision pretrained model to classify gender
- Host: GitHub
- URL: https://github.com/pd-mera/gender-classification
- Owner: PD-Mera
- Created: 2023-02-09T03:49:34.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-24T10:59:11.000Z (over 2 years ago)
- Last Synced: 2025-01-08T19:46:58.625Z (5 months ago)
- Language: Python
- Homepage:
- Size: 245 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gender Classification
This project simply classifies whether face is **Male** or **Female**
## Environments
- Python 3.10.9
- torch 1.13.1
- torchvision 0.14.1Install requirements
``` bash
pip install -r requirements.txt
```## Data
- I get my data from [here](https://www.kaggle.com/datasets/cashutosh/gender-classification-dataset) and use some of my own data
- Data in this format
``` files
|-- data
|-- train
| |-- class 1
| |-- class 2
| `-- ...
`-- valid
|-- class 1
|-- class 2
`-- ...
```## Config
Modify config in `./cfg/config.yaml` or create your own `.yaml` config file with the same format.
## Train
Simply run
``` bash
python train.py --cfg ./cfg/config.yaml
```## Experiment Results
Some experiment results
| Model | Accuracy | Confusion Matrix | Pretrained | Model size |
| --- | :---: | :---: | :---: | :---: |
| **Regnet_Y_32MF** | 97.33% |  | [Model](https://drive.google.com/file/d/1t7O0AZeKVIdLMMYIyGNnZm4D6py1YXjD/view?usp=share_link) | 554.10MB |You can download weight file above and put in `weights` folder and run inference
``` bash
python infer.py
```## Some inference results
| Male | Female |
| :---: | :---: |
|  |  |You can try on your own :wink: