Skip to content

About

Python code to analyse skin images (specifically moles/cancer).

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

Repository files navigation

Python code to analyse skin images (specifically moles/cancer).
Usage | Citing

License: MIT PRs welcome code with hearth by jpope8

Contents


Introduction

This repository provides source code for evaluating tone bias in skin lesion images. The dataset images are a subset from the International Skin Imaging Collaboration (ISIC) Archive.

  • Code to train machine learning models (convolutional neural networks) to determine the diagnosis ({benign,malignant}) given an input image.
  • Code to analyse how well the diagnosis classification performs (traditional test set accuracy metrics).
  • Code to analyse the tone bias of the trained model.

PyTorch is used as the deep learning framework to train/evaluate the models. The original backend was MPS (Mac M2 Max series) but was also tested with CPU backend.

The hyper-parameter tuning used Optuna and was carried out on the Isambard-AI supercomputer in Bristol, UK, using the Open MPI backend.

Installation

First create a virtual python environment. The virtual environment only installs pip and python.

python3 -m venv skin-image-analysis
cd ./skin-image-analysis
source ./bin/activate

Clone the repository.

git clone git clone https://<git username>@github.com/jpope8/skin-image-analysis.git
(enter your git token)

Install dependencies via the requirements.txt file.

pip install -r requirements.txt 

This completes the installation.

Dataset

The data was downloaded from the ISIC archive using the cli tool (need to install this first).

See https://pypi.org/project/isic-cli/

See https://github.com/ImageMarkup/isic-cli

mkdir tone

cd tone

isic image download --search 'fitzpatrick_skin_type:I OR fitzpatrick_skin_type:II OR fitzpatrick_skin_type:III OR fitzpatrick_skin_type:IV OR fitzpatrick_skin_type:V OR fitzpatrick_skin_type:VI' .

Usage

These instructions assume you have installed common Python analysis libraries using the provided requirements.txt. Python3 is assumed and required.

To train a new model, run the tone_bias_train module.

Usage: <'balance' or 'imbalanced' | path to existing model>")

cd skin-image-analysis
python python ./src/tone_bias_train.py tone 20 balance

This will take some time depending on your machine but should finish within an hour. When finished, the model will be saved in the experiments folder.

Buena Suerte.

References

  • [1] This work was supported by the Jean Golding Institute Staff Seed Corn Funding Call 2023-2024, "Pilot Study to determine Tone Bias in Open-Source Skin Cancer Datasets".
  • [2] @misc{pope2025skincancermachinelearning, title={Skin Cancer Machine Learning Model Tone Bias}, author={James Pope and Md Hassanuzzaman and William Chapman and Huw Day and Mingmar Sherpa and Omar Emara and Nirmala Adhikari and Ayush Joshi}, year={2025}, eprint={2410.06385}, archivePrefix={arXiv}, primaryClass={eess.IV}, url={https://arxiv.org/abs/2410.06385 }, }

License

This project is licensed under the MIT License.

See LICENSE for more information.

About

Python code to analyse skin images (specifically moles/cancer).

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages