Edit model card

🦠 Melanoma Detection Model

πŸ“„ Overview

πŸ€– Model Name: MDM-3

🧠 Model Type: Convolutional Neural Network (CNN)

πŸ“Š Input: 224x224 RGB images of skin lesions

πŸ”’ Output: A binary classification (Melanoma or Not Melanoma)

🎯 Purpose: To identify and classify skin lesions as melanoma or non-melanoma with high accuracy

☁️ Download: Click here to download


πŸ“š Description

This model is designed to detect melanoma from skin lesion images. It processes input images of size 224x224 pixels and outputs a binary classification indicating whether the lesion is melanoma or not. The model is trained to differentiate between malignant melanoma and benign conditions.


πŸ” Use Cases

  1. Medical Diagnosis: πŸ₯ Assisting dermatologists in diagnosing melanoma from images.
  2. Skin Cancer Screening: 🩺 Enhancing early detection efforts in large-scale skin cancer screening programs.
  3. Patient Monitoring: πŸ‘©β€βš•οΈ Helping in monitoring patients with a history of melanoma or high risk.

πŸ“ˆ Performance

πŸ” Accuracy: ~99% on the Skin Cancer Dataset

πŸ•’ Latency: Suitable for real-time analysis in clinical settings.


πŸ› οΈ Technical Details

  • Based on: MobileNetV2
  • Architecture: Convolutional Neural Network (CNN)
  • Layers: Convolutional layers, pooling layers, fully connected layers
  • Activation Functions: ReLU, Sigmoid

πŸ“₯ Input Format

  • Type: RGB image
  • Shape: 224x224 pixels
  • Range: 0-1 (pixel intensity)

πŸ“€ Output Format

  • Type: Binary classification
  • Shape: Scalar value
  • Range: 0 (Not Melanoma), 1 (Melanoma)

🧩 Model Training

  • Dataset: Skin Cancer Dataset πŸ“š
  • First step:
    • Training Epochs: 50
    • Batch Size: 32
    • Optimizer: Adam
    • Learning rate: 1e-5
    • Layers: Only last layer
  • Second step:
    • Training Epochs: 5
    • Batch Size: 32
    • Optimizer: Adam
    • Learning rate: 1e-5
    • Layers: All layers

πŸ’‘ How to Use

  1. Preprocess the Image: Resize and normalize the image to 224x224 pixels with pixel values between 0 and 1.
  2. Feed the Image: Input the preprocessed image into the model.
  3. Interpret the Output: Analyze the output to determine if the lesion is melanoma or not.

Loading the Model

To use the model, first, load it using your preferred framework.

import tensorflow as tf

# Load the pre-trained model
model = tf.keras.models.load_model('path/to/Melanoma-003.keras')

Preprocessing the Input

Preprocess the input image to fit the model's requirements.

import numpy as np
from tensorflow.keras.preprocessing import image

def preprocess_image(img_path):
    # Load the image
    img = image.load_img(img_path, target_size=(224, 224))
    # Convert to numpy array
    img_array = image.img_to_array(img)
    # Normalize the image
    img_array = img_array / 255.0
    # Reshape to add batch dimension
    img_array = np.expand_dims(img_array, axis=0)
    return img_array

# Example usage
img_path = 'path/to/your/image.jpg'
processed_image = preprocess_image(img_path)

Making Predictions

Use the model to predict if the lesion is melanoma.

# Predict the class
prediction = model.predict(processed_image)

# Interpret the result
if prediction[0] > 0.5:
    print('The lesion is classified as Melanoma.')
else:
    print('The lesion is classified as Not Melanoma.')

Full Example

Combining all steps into a single example.

import tensorflow as tf
import numpy as np
from tensorflow.keras.preprocessing import image

# Load the pre-trained model
model = tf.keras.models.load_model('path/to/MelanomaDetectionModel.h5')

def preprocess_image(img_path):
    img = image.load_img(img_path, target_size=(224, 224))
    img_array = image.img_to_array(img)
    img_array = img_array / 255.0
    img_array = np.expand_dims(img_array, axis=0)
    return img_array

img_path = 'path/to/your/image.jpg'
processed_image = preprocess_image(img_path)

prediction = model.predict(processed_image)
if prediction[0] > 0.5:
    print('The lesion is classified as Melanoma.')
else:
    print('The lesion is classified as Not Melanoma.')

⚠️ Limitations

  • Image Quality: Performance may be affected by poor-quality or low-resolution images.
  • Generalization: Model performance may vary with images not represented in the training data.

πŸ‘₯ Contributors

  • Developer: Lizardwine (x@lizardwine.com)
  • Organization: lizardwine
  • Date: 05/09/2024

πŸ“ References

  • Skin Cancer Dataset: Link
  • MobileNetV2: Link

Downloads last month
12
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for lizardwine/Melanoma-003

Finetuned
(31)
this model