Skip to content

Chaimaaorg/DermAid---AI-Copilot-for-Skin-Cancer-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DermAid - Your Dermatological Assistant to Prevent Skin Cancer Lesions

Welcome to DermAid, a solution powered by PyTorch designed to assist in the early detection of skin cancer lesions. This project utilizes a machine learning model to analyze and predict the risk level of skin lesions, providing insightful risk assessments for better decision-making.

The system is built using FastAPI for serving predictions via an API, and Dialogflow to integrate natural language processing for efficient user interaction.

Features

  • Predict Skin Cancer Risk: The system analyzes images of skin lesions and predicts whether they are high or low risk for skin cancer along with the confidence.
  • Dialogflow Integration: Communicate with the system via a conversational interface on platforms (Facebook Messenger).
  • Real-Time Analysis: Upload an image and get an instant prediction of the risk level for skin cancer.

Demo Video

Watch Demo Video

Click the image above to watch the demo.

System Components

  1. FastAPI Backend: Used for processing requests and serving model predictions.
  2. PyTorch Model: Pre-trained model for classifying skin lesions based on image input.
  3. Dialogflow Integration: To interact with users and handle requests such as image uploads.
  4. Ngrok: Exposes the local API to the internet, allowing real-time integration with Dialogflow.

Setup Instructions

Follow these steps to set up the system on your machine:

1. Clone or Download the Repository

Make sure you have access to the DermAid Kaggle Notebook where the model is trained. Download or clone the repository for the necessary files.

2. Install Prerequisites

Install the following dependencies:

  • FastAPI: The backend API framework.
  • PyTorch , albumentations and wtfml: For deep learning and model inference.
  • OpenCV and Numpy: For image processing.
  • Requests: To fetch images from URLs.
pip install -r requirements.txt

3. Install and Configure Ngrok

Ngrok is used to expose your local FastAPI app to the internet.

  1. Install Ngrok using Chocolatey:

    choco install ngrok
  2. Get your Ngrok authentication token from Ngrok's website.

  3. Authenticate Ngrok:

    ngrok config add-authtoken your-token

4. Run the FastAPI App

Start the FastAPI app locally:

python backend/main.py

Once the app is running, expose it using Ngrok by running:

ngrok http http://localhost:8080

Ngrok will provide a public URL (e.g., http://abcd1234.ngrok.io). Keep this URL handy.

5. Configure Dialogflow Webhook

  1. Go to your Dialogflow Console.
  2. In your agent's settings, navigate to Fulfillment.
  3. Enable the Webhook option and paste the Ngrok URL (http://abcd1234.ngrok.io) into the URL field.
  4. Click Save.

6. Set Up Intents in Dialogflow

Default Fallback Intent:

  • Training Sentences:
    • "What is the risk of this lesion?"
    • "Is this a dangerous skin lesion?"
    • "Help me analyze this skin lesion."
    • "Is this lesion cancerous?"

You can find the complete list of Training Sentences in the training_sentences.md file in this repository. Ensure that the Fulfillment toggle is ON in the Default Fallback Intent to use the FastAPI API for processing responses.

7. Running the Application

  1. Once everything is set up, you can interact with DermAid via Dialogflow.

  2. When a user sends an image of a skin lesion, the FastAPI backend will process the image and return a prediction.

  3. Based on the model's output, Dialogflow will reply with a message like:

    "The analysis indicates a high risk of skin cancer (score: 0.75)."


Model Details

The DermAid model is trained on various images of skin lesions and classifies them based on their likelihood of being cancerous. The model is a PyTorch-based neural network trained to classify skin lesions into "high" or "low" risk categories based on image analysis.

For detailed information on the training process and how the model was created, check out the DermAid Kaggle Notebook.


Example Use Case

  1. User: "Is this skin lesion dangerous?"

  2. DermAid (Dialogflow sends image to FastAPI backend): "Please upload an image of the skin lesion."

  3. User uploads an image of a skin lesion.

  4. DermAid: Processes the image using the PyTorch model and returns a message like:

    "The analysis indicates a high risk of skin cancer (score: 0.78)."


License

This project is open-source and available under the MIT License.

For any questions or further assistance, visit our Facebook page: DermAid - Votre Assistant Dermatologique


Let’s work together to fight skin cancer!

About

Skin cancer detection chatbot for a Facebook Page using computer vision and deep learning

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published