π¦ 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
- Medical Diagnosis: π₯ Assisting dermatologists in diagnosing melanoma from images.
- Skin Cancer Screening: π©Ί Enhancing early detection efforts in large-scale skin cancer screening programs.
- 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
- Preprocess the Image: Resize and normalize the image to 224x224 pixels with pixel values between 0 and 1.
- Feed the Image: Input the preprocessed image into the model.
- 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
- Downloads last month
- 13
Model tree for lizardwine/Melanoma-003
Base model
google/mobilenet_v2_1.0_224