Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
@@ -1,128 +1,13 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
> ```bibtex
|
15 |
-
> @article{edgeface,
|
16 |
-
> title={Edgeface: Efficient face recognition model for edge devices},
|
17 |
-
> author={George, Anjith and Ecabert, Christophe and Shahreza, Hatef Otroshi and Kotwal, Ketan and Marcel, Sebastien},
|
18 |
-
> journal={IEEE Transactions on Biometrics, Behavior, and Identity Science},
|
19 |
-
> year={2024}
|
20 |
-
> }
|
21 |
-
> ```
|
22 |
-
|
23 |
-
|
24 |
-
## Usage
|
25 |
-
### Clone Repositories
|
26 |
-
```bash
|
27 |
-
# Clone the repository
|
28 |
-
git clone https://github.com/danhtran2mind/SlimFace
|
29 |
-
|
30 |
-
# Navigate into the newly created 'slimface' directory.
|
31 |
-
cd SlimFace
|
32 |
-
```
|
33 |
-
### Install Dependencies
|
34 |
-
**If Open-CV (CV2) does not work, run below CLI**
|
35 |
-
```bash
|
36 |
-
sudo apt update
|
37 |
-
sudo apt install -y libglib2.0-0
|
38 |
-
sudo apt install -y libgl1-mesa-dev
|
39 |
-
```
|
40 |
-
### Default install Dependencies
|
41 |
-
```bash
|
42 |
-
pip install -r requirements/requirements.txt
|
43 |
-
```
|
44 |
-
### Other install Dependencies
|
45 |
-
- For My Compatible
|
46 |
-
```bash
|
47 |
-
pip install -r requirements/requirements_compatible.txt
|
48 |
-
```
|
49 |
-
- For `End2end Inference`
|
50 |
-
```bash
|
51 |
-
pip install -r requirements/requirements_inference.txt
|
52 |
-
```
|
53 |
-
### Download Model Checkpoints
|
54 |
-
```bash
|
55 |
-
python scripts/download_ckpts.py
|
56 |
-
```
|
57 |
-
### Setup Third Party
|
58 |
-
```bash
|
59 |
-
python scripts/setup_third_party.py
|
60 |
-
```
|
61 |
-
## Data Preparation
|
62 |
-
|
63 |
-
## Pre-trained Model preparation
|
64 |
-
For detailed instructions on how to process and manage your data effectively, refer to the [Full guide for data processing](./docs/data_processing.md).
|
65 |
-
|
66 |
-
This is fast usage for dataset preparation
|
67 |
-
```bash
|
68 |
-
python scripts/process_dataset.py
|
69 |
-
```
|
70 |
-
## Training
|
71 |
-
|
72 |
-
1. Configure the default settings for Accelerate:
|
73 |
-
```bash
|
74 |
-
accelerate config default
|
75 |
-
```
|
76 |
-
|
77 |
-
2. Launch the training script using Accelerate:
|
78 |
-
```bash
|
79 |
-
accelerate launch src/slimface/training/accelerate_train.py
|
80 |
-
```
|
81 |
-
|
82 |
-
For additional help, you can refer to the [Training Documentation](./docs/training/training_docs.md) for more details.
|
83 |
-
|
84 |
-
### Inference
|
85 |
-
#### Create Reference Images Data at `data/reference_data/images`
|
86 |
-
For each class, you store an image in `data/reference_data/images` folder which are maped with `index_to_class_mapping.json`.
|
87 |
-
|
88 |
-
The structure like:
|
89 |
-
```markdown
|
90 |
-
data/reference_data/images/
|
91 |
-
βββ 'Robert Downey Jr.jpg'
|
92 |
-
βββ 'Tom Cruise.jpg'
|
93 |
-
βββ ...
|
94 |
-
```
|
95 |
-
|
96 |
-
|
97 |
-
### Create Reference Dictionary from `index_to_class_mapping.json`
|
98 |
-
|
99 |
-
#### Steps
|
100 |
-
1. Place `index_to_class_mapping.json` in the `ckpts` folder.
|
101 |
-
2. Ensure reference images are in `data/reference_data/images`. Missing images will be set to `""` in `reference_image_data.json` (default in `data/reference_data` folder).
|
102 |
-
3. Run one of the following commands:
|
103 |
-
|
104 |
-
#### Commands
|
105 |
-
- **Default** (Output: `data/reference_data/reference_image_data.json`):
|
106 |
-
```bash
|
107 |
-
python scripts/create_reference_image_path.py
|
108 |
-
```
|
109 |
-
- **Custom Paths**:
|
110 |
-
```bash
|
111 |
-
python scripts/create_reference_image_path.py \
|
112 |
-
--input <path_to_index_to_class_mapping.json> \
|
113 |
-
--output <path_to_tests/reference_image_data.json>
|
114 |
-
```
|
115 |
-
|
116 |
-
#### Manual Option
|
117 |
-
Edit `reference_image_data.json` directly to add image paths as dictionary values.
|
118 |
-
|
119 |
-
## Demostration
|
120 |
-
```bash
|
121 |
-
python apps/gradio_app.py
|
122 |
-
```
|
123 |
-
|
124 |
-
https://huggingface.co/spaces/danhtran2mind/SlimFace-demo
|
125 |
-
|
126 |
-
## Project Description
|
127 |
-
|
128 |
-
This repository is trained from [](https://github.com/danhtran2mind/edgeface), a fork of [](https://github.com/otroshi/edgeface), with numerous bug fixes and rewritten code for improved performance and stability.
|
|
|
1 |
+
---
|
2 |
+
title: Slimface Demonstration
|
3 |
+
emoji: π¦
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.38.2
|
8 |
+
app_file: SlimFace/apps/gradio_app.py
|
9 |
+
pinned: true
|
10 |
+
license: mit
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|