syaha commited on
Commit
13e369c
1 Parent(s): 1caa29b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +54 -30
README.md CHANGED
@@ -22,52 +22,76 @@ model-index:
22
  metrics:
23
  - name: Accuracy
24
  type: accuracy
25
- value: 0.85
26
  ---
27
 
28
  # Skin Cancer Detection Model
29
 
30
- ## Overview
31
- This model was created as part of a final project for an AI bootcamp. It is a **skin cancer detection** model trained to classify skin lesions from dermatoscopic images using the **HAM10000 dataset**. The model is capable of predicting **seven different types of skin lesions**, each corresponding to various forms of skin cancer and other skin conditions.
32
 
33
- The model has been trained using a **Convolutional Neural Network (CNN)** with **TensorFlow** and **Keras**. The goal of this project is to help in early detection of skin cancer by classifying images into seven distinct categories, which could assist healthcare professionals in diagnosis.
 
 
 
 
 
 
34
 
35
- ## Model Architecture
36
- The model utilizes a CNN architecture fine-tuned for image classification tasks. Below is a brief description of the architecture:
37
- - **Input size**: 224x224 RGB images
38
- - **Base architecture**: Pretrained CNN (e.g., ResNet, VGG)
39
- - **Output layer**: 7 softmax units, each corresponding to one of the skin lesion categories
40
 
41
- ## Model Performance
42
- The model was trained on the HAM10000 dataset and achieved an accuracy of **85%** on the validation set. Further improvements could be made by additional fine-tuning and hyperparameter optimization.
43
 
44
- ## Datasets
45
- The model was trained using the **HAM10000 dataset**, which consists of over 10,000 dermatoscopic images of skin lesions. The dataset includes seven types of lesions, described as follows:
 
 
 
46
 
47
- | Label | Full Name | Description |
48
- |-------|------------|-------------|
49
- | **akiec** | Actinic Keratoses and Intraepithelial Carcinoma | A type of skin lesion that can develop into squamous cell carcinoma if left untreated. |
50
- | **bcc** | Basal Cell Carcinoma | A common form of skin cancer that rarely metastasizes. |
51
- | **bkl** | Benign Keratosis | Non-cancerous skin lesions like seborrheic keratosis. |
52
- | **df** | Dermatofibroma | A benign skin lesion usually found on the lower legs. |
53
- | **nv** | Melanocytic Nevus | Commonly known as a mole, usually benign but can develop into melanoma. |
54
- | **vasc** | Vascular Lesions | Skin lesions that involve blood vessels, like angiomas. |
55
- | **mel** | Melanoma | The most dangerous form of skin cancer, often caused by UV radiation exposure. |
56
 
57
- ### Gradio Demo
58
 
59
- You can try out the **skin cancer detection model** using the interactive demo hosted on Hugging Face Spaces [here](https://huggingface.co/spaces/syaha/skin-cancer-detection-gradio/app.py).
 
 
 
 
 
 
 
60
 
61
- ## Usage
62
 
63
- To use this model for inference, you can load it using TensorFlow:
 
 
64
 
65
  ```python
66
  from tensorflow.keras.models import load_model
 
 
67
 
68
  # Load the model
69
- model = load_model("path_to_model.h5")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- # Preprocess input image and make predictions
72
- image = preprocess_image("path_to_image.jpg") # Custom image preprocessing function
73
- prediction = model.predict(image)
 
 
22
  metrics:
23
  - name: Accuracy
24
  type: accuracy
25
+ value: 0.73
26
  ---
27
 
28
  # Skin Cancer Detection Model
29
 
30
+ This AI model is designed to detect various types of skin cancer from dermatoscopic images. It uses the HAM10000 dataset and is capable of classifying skin lesions into seven categories:
 
31
 
32
+ 1. **akiec** - Actinic Keratoses and Intraepithelial Carcinoma
33
+ 2. **bcc** - Basal Cell Carcinoma
34
+ 3. **bkl** - Benign Keratosis
35
+ 4. **df** - Dermatofibroma
36
+ 5. **nv** - Melanocytic Nevus
37
+ 6. **vasc** - Vascular Lesions
38
+ 7. **mel** - Melanoma
39
 
40
+ ## Model Overview
 
 
 
 
41
 
42
+ The model is built using TensorFlow and Keras. It is a convolutional neural network (CNN) trained on the HAM10000 dataset, which contains over 10,000 images of skin lesions. This model can be used for automated skin cancer screening and classification, which can help assist dermatologists in diagnosing patients.
 
43
 
44
+ ### Features:
45
+ - **Image classification** for seven types of skin cancer.
46
+ - **Accuracy**: The model achieved an accuracy of 73% on the validation set.
47
+ - Built with **TensorFlow** and **Keras**.
48
+ - Open-sourced under the **MIT license**.
49
 
50
+ ## Dataset
 
 
 
 
 
 
 
 
51
 
52
+ The HAM10000 ("Human Against Machine with 10000 training images") dataset is a collection of dermatoscopic images used to train this model. The dataset contains images of seven different classes of benign and malignant skin lesions.
53
 
54
+ ### Dataset Classes:
55
+ - **akiec**: Actinic keratoses and carcinoma
56
+ - **bcc**: Basal cell carcinoma
57
+ - **bkl**: Benign keratosis
58
+ - **df**: Dermatofibroma
59
+ - **nv**: Melanocytic nevus
60
+ - **vasc**: Vascular lesions
61
+ - **mel**: Melanoma
62
 
63
+ More information on the dataset can be found [here](https://www.kaggle.com/kmader/skin-cancer-mnist-ham10000).
64
 
65
+ ## How to Use the Model
66
+
67
+ You can load the model directly in your Python environment and use it to classify new images. Here's an example of how to use the model:
68
 
69
  ```python
70
  from tensorflow.keras.models import load_model
71
+ import tensorflow as tf
72
+ import numpy as np
73
 
74
  # Load the model
75
+ model = load_model('path_to_your_model.h5')
76
+
77
+ # Preprocess the image
78
+ def preprocess_image(image_path):
79
+ img = tf.image.decode_image(tf.io.read_file(image_path), channels=3)
80
+ img = tf.image.resize(img, [224, 224])
81
+ img = np.expand_dims(img, axis=0)
82
+ img = img / 255.0 # Normalize the image
83
+ return img
84
+
85
+ # Predict the class of the image
86
+ def predict(image_path):
87
+ image = preprocess_image(image_path)
88
+ prediction = model.predict(image)
89
+ predicted_class = np.argmax(prediction, axis=1)[0]
90
+
91
+ class_names = ['akiec', 'bcc', 'bkl', 'df', 'nv', 'vasc', 'mel']
92
+ return class_names[predicted_class]
93
 
94
+ # Example usage
95
+ image_path = 'your_image.jpg'
96
+ prediction = predict(image_path)
97
+ print(f'The predicted class is: {prediction}')