# Download the model_rcnn.pth file from the link below

https://mega.nz/folder/nzgGCTzI#m1wr5sm4JgR8iGlndlXfMA and store in the ./SkinTone_code directory.

# Skin Tone Detection with ITA Calculation

This project performs skin tone detection from images using ITA (Individual Typology Angle) calculation. The project also uses object detection tools like facenet and Fingerphoto RCNN for skin segmentation, bounding box filtering, and image cropping. All other process is explained as per the skintone pipeline explined in the paper. 


## Requirements

To run this project, ensure you have the required Python libraries installed. You can install them by running:


```
pip install -r requirements.txt
```

Required Libraries
1. torch
2. opencv-python
3. numpy
4. Pillow
5. detecto
6. torchvision
7. matplotlib
8. scikit-image
9. facenet-pytorch

Usage:

```
python SkinTone_face.py
```


```
python Skintone_fingerphoto.py
```

After running **SkinTone_face.py** and **Skintone_fingerphoto.py** files. The script will calculate the ITA value and categorize the skin tone using the following classifications:

Very Light
Light
Intermediate
Tan
Brown
Dark

Output:  The ITA value and skin tone classification will be printed as following

Example: 
ITA value = "-20.54"
Skin tone = "Brown"

Cropped image will be saved in the folder named after the skintone. Eg: brown skin tone images are saved in  "Brown"- directory path inside the SkinTone_Code.