Skip to content

lqrhy3/skin-disease-recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skin disease recognition

PyTorch Lightning

Description

This project consist of two parts:

  1. Acne detection
  2. Recognition of dark circles under the eyes

Acne detection

acne sample

Description

First part of project is focused on detecting acne in facial images using the YOLOv7 object detection model. We used this YOLOv7 implementation.

Installation and environment

Pip

# clone project
git clone https://github.com/lqrhy3/skin-disease-recognition.git
cd skin-disease-recognition/src/models/yolov7

# [OPTIONAL] create conda environment
conda create -n yolov7
conda activate yolov7

# install requirements
pip install -r requirements.txt

Dataset

We used the acne04 dataset for this project, which can be downloaded from the following page: link. The dataset consists of facial images with corresponding bounding boxes for acne.

Preparing data

# converting raw Acne04 dataset to VOC format
python3 src/data/convert_acne04_to_voc.py --raw_data_dir <path to raw Acne04 dataset> --baked_data_dir <destination folder>

# converting voc to yolo format
python3 src/data/convert_acne04_voc_to_yolo.py --voc_data_dir <path to acne dataset in voc format> --baked_data_dir <destination folder>

# splitting on train and validation part. this script creates train.txt and val.txt
python3 src/data/split_yolo.py --yolo_data_dir <path to yolo format dataset>

Visualizing

# visualizing acne dataset in VOC format
python3 src/visualization/fiftyone_acne04_voc.py --data_dir <path to data>

# visualizing acne dataset in yolo format
python3 src/visualization/fiftyone_acne04_yolo.py --data_dir <path to data>

# visualizing yolo predictions
python3 src/visualization/fiftyone_acne04_yolo_preds.py --source <path to data> --weights <path to yolo weights> --device <cpu or cuda> --img-size <img size (int)> --conf_thres <object confidence thr> --iou_thres <IoU thr for NMS>

Training and evaluating

Instructions for training and evaluating YOLOv7 can be found in original repository.

Results


Dark circles under the eyes recognition

dark circle sample

Description

This part focused on developing a solution for recognizing dark circles under the eyes on face images. Due to data privacy concerns, we are unable to share the dataset we used in this project.

Approach

Initially, we tried using the UNet-like architecture for this task, but we did not achieve good results, cause of low quality of ground truth masks. Therefore, we decided to use a unsupervised no-ML approach from this paper, and it performed well for our dataset.

Installation

Pip

# clone project
git clone https://github.com/lqrhy3/skin-disease-recognition.git
cd skin-disease-recognition

# [OPTIONAL] create conda environment
conda create -n skin-disease-project
conda activate skin-disease-project

# install requirements
pip install -r requirements.txt

Evaluating

python3 src/eval_noml_classification.py --data_dir <data_dir> --path_to_landmarks_predictor <landmarks_predictor>

Link to dlib landmarks predictor

Results

Image 1 Image 2 Image 3
$y = 0; \hat{y} = 0$ $y = 0; \hat{y} = 0$ $y = 0; \hat{y} = 0$
Image 4 Image 5 Image 6
$y = 1; \hat{y} = 1$ $y = 1; \hat{y} = 1$ $y = 1; \hat{y} = 1$

Segmentation approach

Data

Dataset contains a folder with facial images and a corresponding folder with segmentation masks for dark circles under the eyes. In order to process the dataset, we used morphological opening and closing techniques to remove noise from the masks.

python3 src/data_process_data_circles.py --raw_data_dir <raw dataset folder> --processed_dir <destination folder>

Training

python3 src/train.py experiment=unet_baseline.yaml

Evaluating

python3 src/eval_segmentation.py ckpt_path=<path to cktp> output_dir=<path to save predictions>

Visualization

# visualize dataset dark_circles, data_dir should contain 'data/' and 'labels/' folders
python3 src/visualization/fiftyone_dark_circles.py --data_dir <path to data folder>

# visualize dataset with predicted masks
python3 src/visualization/fiftyone_dark_circles_pred.py --data_dir <path to data folder> --preds_dir <path to predictions folder>

Contributors

This project was completed by Stanislav Mikhaylevskiy, Victor Pavlishen and Vladimir Chernyavskiy. If you have any questions or suggestions regarding this project, please feel free to contact us.

About

Acne and Dark Circles Detection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published