1- # 📸 Nano -Face-PyTorch : Ultra-lightweight Face Detection
1+ # 📸 Tiny -Face: Ultra-lightweight Face Detection
22
3- [ ![ Downloads] ( https://img.shields.io/github/downloads/yakhyo/nano -face-pytorch/total )] ( https://github.com/yakhyo/nano -face-pytorch/releases )
4- [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/yakhyo/nano -face-pytorch )] ( https://github.com/yakhyo/nano -face-pytorch/stargazers )
5- [ ![ GitHub Repository] ( https://img.shields.io/badge/GitHub-Repository-blue?logo=github )] ( https://github.com/yakhyo/nano -face-pytorch )
6- [ ![ GitHub License] ( https://img.shields.io/github/license/yakhyo/nano -face-pytorch )] ( https://github.com/yakhyo/nano -face-pytorch/blob/main/LICENSE )
3+ [ ![ Downloads] ( https://img.shields.io/github/downloads/yakhyo/tiny -face-pytorch/total )] ( https://github.com/yakhyo/tiny -face-pytorch/releases )
4+ [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/yakhyo/tiny -face-pytorch )] ( https://github.com/yakhyo/tiny -face-pytorch/stargazers )
5+ [ ![ GitHub Repository] ( https://img.shields.io/badge/GitHub-Repository-blue?logo=github )] ( https://github.com/yakhyo/tiny -face-pytorch )
6+ [ ![ GitHub License] ( https://img.shields.io/github/license/yakhyo/tiny -face-pytorch )] ( https://github.com/yakhyo/tiny -face-pytorch/blob/main/LICENSE )
77
8- <video controls autoplay loop src =" https://github.com/user-attachments/assets/ad279fea-33fb-43f1-884f-282e6d54c809 " muted =" false " width =" 100% " ></video >
8+ <video controls autoplay loop src =" https://github.com/user-attachments/assets/faf65b91-db76-4538-beca-87fc65566e51 " muted =" false " width =" 100% " ></video >
99
10- Nano -Face-PyTorch is an ultra-lightweight face detection model optimized for mobile and edge devices. Built upon the concepts of RetinaFace, this model achieves high precision and speed in face detection with minimal resource requirements.
10+ Tiny -Face is an ultra-lightweight face detection model optimized for mobile and edge devices. Built upon the concepts of RetinaFace, this model achieves high precision and speed in face detection with minimal resource requirements.
1111
1212> ** Note**
13- > This repository refines lightweight architectures like Slim and RFB with a focus on Nano -level efficiency.
13+ > This repository refines lightweight architectures like RetinaFace (mobile), Slim and RFB with a focus on Tiny -level efficiency.
1414
1515<div align =" center " >
16- <img src =" assets/mv2_test .jpg " >
16+ <img src =" assets/test_retina .jpg " >
1717</div >
1818
1919## 📈 Performance on WiderFace
2020
2121### Multi-scale Image Size
2222
23- | Models | Pretrained on ImageNet | Easy | Medium | Hard | Model Size |
24- | ---------- | ---------------------- | ------ | ------ | ------ | ---------- |
25- | SlimFace | False | 81.65 % | 82.12 % | 74.35 % | 1.39 MB |
26- | RFB | False | 90.59 % | 89.14 % | 84.13 % | MB |
27- | RetinaFace | True | 89.00 % | 87.50 % | 81.00 % | MB |
23+ | Models | Pretrained on ImageNet | Easy | Medium | Hard | #Params(M) | Size(MB) |
24+ | ---------- | ---------------------- | ------ | ------ | ------ | ---------- | -------- |
25+ | SlimFace | False | 79.50 % | 79.40 % | 68.36 % | 0.359 | 1.4 |
26+ | RFB | False | 80.49 % | 81.51 % | 75.73 % | 0.343 | 1.5 |
27+ | RetinaFace | True | 87.69 % | 86.39 % | 80.21 % | 0.426 | 1.8 |
2828
2929### Original Image Size
3030
31- | Models | Pretrained on ImageNet | Easy | Medium | Hard | Model Size |
31+ | Models | Pretrained on ImageNet | Easy | Medium | Hard | #Params(M) |
3232| ---------- | ---------------------- | ------ | ------ | ------ | ---------- |
33- | SlimFace | False | 88.04 % | 85.47 % | 55.40 % | 1.39 MB |
34- | RFB | False | % | % | % | MB |
35- | RetinaFace | True | % | % | % | MB |
33+ | SlimFace | False | 87.10 % | 84.36 % | 67.38 % | 0.359 |
34+ | RFB | False | 87.09% | 84.61% | 69.22% | 0.343 |
35+ | RetinaFace | True | 90.26% | 87.48% | 72.85% | 0.426 |
3636
3737## ✨ Features
3838
39- - ** Nano -sized Efficiency** : Ultra-lightweight and optimized for low-resource devices.
39+ - ** Tiny -sized Efficiency** : Ultra-lightweight and optimized for low-resource devices.
4040- ** Mobile-friendly** : Includes Slim, RFB, and MobileNetV1_0.25 configurations.
4141- ** Pretrained Backbones** : Models suitable for mobile and embedded systems.
4242
43- ### Last Updated: November 9, 2024
43+ ### Download model weights
44+
45+ All weights are available in [ GitHub release v0.0.1] ( https://github.com/yakhyo/tiny-face-pytorch/releases/tag/v0.0.1 ) .
46+
47+ | Models | PyTorch Weights | ONNX Weights | Input Size |
48+ | ---------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------- |
49+ | SlimFace | [ slimface.pth] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/slimface.pth ) | [ slimface.onnx] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/slimface.onnx ) | 640x640 |
50+ | RFB | [ rfb.pth] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/rfb.pth ) | [ rfb.onnx] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/rfb.onnx ) | 640x640 |
51+ | RetinaFace | [ retinaface.pth] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/retinaface.pth ) | [ retinaface.onnx] ( https://github.com/yakhyo/tiny-face-pytorch/releases/download/v0.0.1/retinaface.onnx ) | 640x640 |
4452
4553## ⚙️ Installation
4654
47551 . Clone the repository:
4856
4957 ``` bash
50- git clone https://github.com/yakhyo/nano -face-pytorch.git
51- cd nano -face-pytorch
58+ git clone https://github.com/yakhyo/tiny -face-pytorch.git
59+ cd tiny -face-pytorch
5260 ```
5361
54622 . Install dependencies:
@@ -93,7 +101,7 @@ python train.py --network slim # Replace 'slim' with your choice of model
93101
94102** Available Models** :
95103
96- - ` mobilenetv1_0.25 `
104+ - ` retinaface `
97105- ` slim `
98106- ` rfb `
99107
@@ -102,14 +110,26 @@ python train.py --network slim # Replace 'slim' with your choice of model
102110Inference the model using:
103111
104112``` bash
105- python detect.py --network mobilenetv1_0.25 --weights mobilenetv1_0.25.pth
113+ python detect.py --network retinaface --weights weights/retinaface.pth
114+ slim weights/slim.pth
115+ rfb weights/rfb.pth
106116```
107117
118+ #### Model found following number of faces from large selfi image:
119+
120+ - ** RetinaFace** : 459
121+ - ** RFB** : 430
122+ - ** Slim** : 384
123+ <div align =" center " >
124+ <img src =" assets/largeselfi_retina.jpg " >
125+ <p >RetinaFace model inference result.</p >
126+ </div >
127+
108128## 🧪 Evaluating RetinaFace on WiderFace Dataset
109129
110130### 1. Get and Install WiderFace Evaluation Tool
111131
112- 1 . Clone the WiderFace evaluation repository inside the ` nano -face-pytorch` folder:
132+ 1 . Clone the WiderFace evaluation repository inside the ` tiny -face-pytorch` folder:
113133 ``` bash
114134 git clone https://github.com/yakhyo/widerface_evaluation
115135 ```
@@ -118,7 +138,7 @@ python detect.py --network mobilenetv1_0.25 --weights mobilenetv1_0.25.pth
118138 cd widerface_evaluation
119139 python3 setup.py build_ext --inplace
120140 ```
121- 3 . Return to the ` nano -face-pytorch` folder after installation is complete:
141+ 3 . Return to the ` tiny -face-pytorch` folder after installation is complete:
122142 ``` bash
123143 cd ..
124144 ```
@@ -128,7 +148,9 @@ python detect.py --network mobilenetv1_0.25 --weights mobilenetv1_0.25.pth
128148Run the following command to evaluate your model with WiderFace, specifying the model architecture (` mobilenetv1_0.25 ` in this example) and the path to the trained weights. Predictions will be stored in ` widerface_txt ` inside the ` widerface_evaluation ` folder.
129149
130150``` bash
131- python evaluate_widerface.py --network mobilenetv1_0.25 --weights weights/mobilenetv1_0.25.pth
151+ python evaluate_widerface.py --network retinaface --weights weights/retinaface.pth
152+ slim weights/slim.pth
153+ rfb weights/rfb.pth
132154```
133155
134156### 3. Run the Final Evaluation
0 commit comments