skin-cancer-detector Svelte Themes

Skin Cancer Detector

Detect malignant skin conditions with AI

🩺🔬 SkinScan

SkinScan Overview SkinScan is a skin cancer detector web application that allows users to upload images of their skin conditions. Our system uses a multi-class ML-model that analyses uploaded images, in conjunction with other features such as age and sex, to determine the probable type of condition and whether it is benign (noncancerous) or malignant (cancerous).





AI Explainability Example For legal and ethical concerns, the aim of this system is not to provide any medical diagnosis but rather a recommendation on whether the user should seek out professional medical assistance. The goal is to minimise false negatives (i.e., optimise recall) while retaining acceptable overall model accuracy.🎯 This ensures users can trust the model’s predictions for benign conditions. The model slightly overrepresents malignant conditions to avoid missing true positives, as the risks of missing malignant conditions far outweigh the inconvenience of recommending medical advice for benign conditions.

Admin Panel Overview To enhance transparency 🔍 and build user trust 🤝, the results include AI explainability measures.🤖💡 These measures display a percentage score for each feature’s relative impact on the prediction, along with a heatmap overlay highlighting the areas of the input image that our ML model focused on during processing.





Analytics Dashboard The system’s web application includes an admin panel UI for administrator users. This panel provides access to system analytics📊 and other functionalities, such as managing the ML-pipeline to train new models or replace the current active model used for running inference on user data. Administrators can view previous model versions, review their hyperparameters, and compare performance metrics across different versions using visual graphs. The admin panel also provides detailed insights into the usage and accuracy of the system, helping developers and healthcare professionals make informed improvements. This ensures the tool remains accurate, effective, and trustworthy.

📑 Table of Contents

Svelte Web-app [Frontend]

To run locally, refer to the instructions inside the Client directory README.

Running Django [Backend]

Create .env File in Repository Root Folder

Make sure the .env file contains the following:

# Django secret key
SECRET_KEY = <KEY_VALUE>

# Use "False" for production
DEBUG = "True"

Run development server

macOS/Linux:

  1. Navigate to the Django project root folder
    cd server
    
  2. Run the Django development server
    python3 manage.py runserver
    
  3. Open browser and navigate to:
    http://127.0.0.1:8000
    

Windows WSL:

  1. Navigate to the Django project root folder
    cd server
    
  2. Run the Django development server
    python manage.py runserver
    
  3. Open browser and navigate to:
    http://127.0.0.1:8000
    

Database Migrations

If any changes are made to the Django models (database schemas), the changes need to be migrated to the database(s). Execute the following commands from the Django project root folder:

python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py migrate --database=db_images

Unit Tests

To run the Django unit tests, execute the following commands from the Django project root folder:

python3 manage.py test    

Deactivating the Virtual Environment

Once you are done, deactivate the Python virtual environment using:

deactivate

Installation [Backend]

macOS/Linux:

Set Up Python Virtual Environment & Install Dependencies

  1. Navigate to the repository root folder in your terminal

    cd /path/to/repository
    
  2. Create a Python virtual environment

    python3 -m venv venv
    
  3. Activate the virtual environment

    source venv/bin/activate
    
  4. Install the required dependencies

    on Linux:

    pip install -r requirements.txt
    

    on macOS:

    pip install -r requirements-mac.txt
    

Windows WSL:

Note: this guide is written for WSL2 using Ubuntu 22.04 LTS (Jammy).

Installing Python 3.11 on Ubuntu WSL

Show/Hide

Python 3.11 is not included in the default Ubuntu repository so we need to add a PPA in order to install. If you are using a different Ubuntu version you need to verify that Python 3.11 is provided here or use a different PPA.

  1. Add deadsnakes PPA to the system
    sudo add-apt-repository ppa:deadsnakes/ppa
    
  2. Update package list to ensure the new repository is included
    sudo apt update
    
  3. Install Python 3.11 and tk dependencies
    sudo apt install python3.11 python3-tk tk-dev
    
  4. Verify installation & base Python installation intact
    python3 --version
    python3.11 --version
    
  5. Intall venv for Python 3.11
    sudo apt install python3.11-venv
    

Set Up Python Virtual Environment & Install Dependencies

  1. Navigate to the repository root folder in your terminal
    cd /path/to/repository
    
  2. Create a Python virtual environment
    python3.11 -m venv venv
    
  3. Activate the virtual environment
    source venv/bin/activate
    
  4. Upgrade pip inside the virtual environment
    pip install --upgrade pip
    
  5. Install the required dependencies
    pip install -r requirements.txt
    

Optional: Enable Nvidia CUDA GPU Support [Linux / WSL]

In order to utilize the GPU for TensorFlow operations, additional setup is needed.

Show/Hide

Note: verify that you have the hardware & system requirements needed: TensorFlow website

Step 1: Update Nvidia Drivers

Ensure that you have the latest Nvidia GPU drivers installed. Most cards with updated drivers should support CUDA: Nvidia website

Step 2: Install CUDA Toolkit

Download the CUDA Toolkit 12.3.2 installer for x86 from the Nvidia website

Open WSL in terminal and navigate to the directory you saved the installer - run the following commands:

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin

sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600

wget https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda-repo-wsl-ubuntu-12-3-local_12.3.2-1_amd64.deb

sudo dpkg -i cuda-repo-wsl-ubuntu-12-3-local_12.3.2-1_amd64.deb

sudo cp /var/cuda-repo-wsl-ubuntu-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install cuda-toolkit-12-3

Verify installation using the following command:

nvcc --version

If the last command doesn't work, you need to add the CUDA Toolkit to the environment variables:

  1. Open the shell configuration in nano (or any other editor)
    nano ~/.bashrc
    
  2. Add the following lines to the end of the file (to keep your custom configurations separate)
    export PATH=/usr/local/cuda/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
    
  3. Save the file and reload the shell configuration
    source ~/.bashrc
    
  4. Verify that the nvcc command now works
    nvcc --version
    

Step 3: Install cuDNN

Note: for this step you need to create an Nvidia developer account (for free) to download the library.

Download cuDNN v8.9.7 (December 5th, 2023), for CUDA 12.x for Ubuntu x86 from the Nvidia website.

Open WSL in terminal and navigate to the directory you saved the installer - run the following commands:

  1. Install the local repository
    sudo dpkg -i cudnn-local-repo-ubuntu2204-8.9.7.29_1.0-1_amd64.deb
    

    Note: if you get the message about the keyring, copy the command from the output and run it in the terminal before proceeding with the next step.

  2. Update package list
    sudo apt update
    
  3. Install the cuDNN library
    sudo apt install -y libcudnn8
    
  4. Verify installation success
    dpkg -l | grep libcudnn
    
    Note: you should see output similar to:
    ii  libcudnn8    8.9.7.29-1+cuda12.2   amd64    cuDNN runtime libraries
    

Step 4: Run Test Script to Verify GPU Utilization

  1. Navigate to the repository root folder in your terminal
    cd /path/to/repository
    
  2. Activate the virtual environment
    source venv/bin/activate
    
  3. Run the GPU test script
    python3.11 dev_utils/test_gpu.py
    

    Note: TensorFlow will silently default to using the CPU. If you suspect that your GPU is not being utilized you can enable explicit device logging by editing the script and changing the parameter in the following line to True:

    tf.debugging.set_log_device_placement(False)
    

Development Team👩‍💻👨‍💻

The project has been developed over the course of 8 weeks by the following:

  • Kaisa Arumeel
  • Amirpooya Asadollahnejad
  • Erik Lindstrand
  • Arvin Rahimi
  • Konstantinos Rokanas
  • Alexander Säfström

Top categories

Loading Svelte Themes