Update README.md
Browse files
README.md
CHANGED
@@ -27,71 +27,76 @@ model-index:
|
|
27 |
|
28 |
# Skin Cancer Detection Model
|
29 |
|
30 |
-
This
|
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 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
## Dataset
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
##
|
|
|
|
|
|
|
66 |
|
67 |
-
|
|
|
68 |
|
69 |
```python
|
70 |
from tensorflow.keras.models import load_model
|
71 |
-
|
72 |
import numpy as np
|
73 |
|
74 |
-
# Load the model
|
75 |
-
model = load_model('
|
76 |
-
|
77 |
-
# Preprocess the image
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
#
|
86 |
-
|
87 |
-
|
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}')
|
|
|
27 |
|
28 |
# Skin Cancer Detection Model
|
29 |
|
30 |
+
This model is built to detect different types of skin cancer from dermatoscopic images. It was trained using the **HAM10000** dataset and is designed to classify seven types of skin lesions. The goal of this model is to assist in the early detection of skin cancer, particularly in regions where temperatures are rising, making skin cancer detection increasingly important.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
## Model Overview
|
33 |
+
The model is a Convolutional Neural Network (CNN) developed using **TensorFlow** and **Keras**. It takes input images of skin lesions and predicts one of the seven skin cancer classes. The model achieved an accuracy of **85%**, which can be further improved with fine-tuning and larger datasets.
|
34 |
+
|
35 |
+
## Classes Detected
|
36 |
+
The model predicts the following seven types of skin cancer:
|
37 |
+
|
38 |
+
1. **akiec**: Actinic Keratoses and Intraepithelial Carcinoma (pre-cancerous)
|
39 |
+
2. **bcc**: Basal Cell Carcinoma (a common type of skin cancer)
|
40 |
+
3. **bkl**: Benign Keratosis (non-cancerous lesion)
|
41 |
+
4. **df**: Dermatofibroma (benign skin lesion)
|
42 |
+
5. **nv**: Melanocytic Nevus (a common mole)
|
43 |
+
6. **vasc**: Vascular Lesions (non-cancerous lesions of blood vessels)
|
44 |
+
7. **mel**: Melanoma (most dangerous type of skin cancer)
|
45 |
+
|
46 |
+
### Explanation of Each Class:
|
47 |
+
- **Actinic Keratoses (akiec)**: A rough, scaly patch on the skin that develops from years of sun exposure. It is considered pre-cancerous and can lead to squamous cell carcinoma.
|
48 |
+
- **Basal Cell Carcinoma (bcc)**: A type of skin cancer that starts in the basal cells and is often caused by UV radiation. It rarely spreads to other parts of the body.
|
49 |
+
- **Benign Keratosis (bkl)**: Non-cancerous skin growths that resemble moles but do not pose any risk.
|
50 |
+
- **Dermatofibroma (df)**: A common, benign fibrous skin lesion, usually found on the legs.
|
51 |
+
- **Melanocytic Nevus (nv)**: Also known as a mole, these are benign proliferations of melanocytes but can sometimes develop into melanoma.
|
52 |
+
- **Vascular Lesions (vasc)**: Benign growths formed by abnormal blood vessels, generally harmless.
|
53 |
+
- **Melanoma (mel)**: The most serious type of skin cancer, arising from melanocytes. Early detection is critical for effective treatment.
|
54 |
|
55 |
## Dataset
|
56 |
+
The **HAM10000** dataset, which contains 10,015 dermatoscopic images of different skin lesions, was used to train this model. The dataset is publicly available and widely used for research on skin lesion classification.
|
57 |
+
|
58 |
+
## Model Architecture
|
59 |
+
The model is based on a Convolutional Neural Network (CNN) architecture with multiple layers of convolution, max-pooling, and fully connected layers to classify images. The input images were resized to **224x224** pixels and normalized to ensure uniformity across the dataset.
|
60 |
|
61 |
+
Key architecture components include:
|
62 |
+
- Convolution layers with ReLU activation
|
63 |
+
- Max Pooling layers for down-sampling
|
64 |
+
- Fully connected dense layers
|
65 |
+
- Softmax activation for the final classification
|
66 |
|
67 |
+
## Training
|
68 |
+
The model was trained on 80% of the HAM10000 dataset, with 20% used for validation. **Data augmentation** was applied to the training set to improve generalization, including techniques like rotation, flipping, and scaling.
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
+
The training configuration:
|
71 |
+
- Optimizer: **Adam**
|
72 |
+
- Loss function: **Categorical Crossentropy**
|
73 |
+
- Batch size: **32**
|
74 |
+
- Epochs: **50**
|
75 |
|
76 |
+
## Metrics
|
77 |
+
- **Accuracy**: The primary evaluation metric was accuracy. The model achieved **73%** accuracy on the validation set.
|
78 |
+
|
79 |
+
Further improvements can be achieved with additional training or fine-tuning using transfer learning methods.
|
80 |
|
81 |
+
## How to Use
|
82 |
+
You can use this model to classify skin lesion images. Below is an example code snippet to load the model and make predictions:
|
83 |
|
84 |
```python
|
85 |
from tensorflow.keras.models import load_model
|
86 |
+
from tensorflow.keras.preprocessing import image
|
87 |
import numpy as np
|
88 |
|
89 |
+
# Load the model from Hugging Face
|
90 |
+
model = load_model('path_to_model.h5')
|
91 |
+
|
92 |
+
# Preprocess the image and make a prediction
|
93 |
+
img = image.load_img('test_image.jpg', target_size=(224, 224))
|
94 |
+
img_array = image.img_to_array(img)
|
95 |
+
img_array = np.expand_dims(img_array, axis=0) / 255.0
|
96 |
+
|
97 |
+
predictions = model.predict(img_array)
|
98 |
+
predicted_class = np.argmax(predictions, axis=1)[0]
|
99 |
+
|
100 |
+
# Mapping class index to class name
|
101 |
+
class_names = ['akiec', 'bcc', 'bkl', 'df', 'nv', 'vasc', 'mel']
|
102 |
+
print(f"Predicted class: {class_names[predicted_class]}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|