Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,64 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
# Lung Cancer Detection Model
|
6 |
+
|
7 |
+
This repository contains a deep learning model for detecting lung cancer from CT scan images. The model is trained to classify CT images into three categories: **Benign**, **Malignant**, and **Normal**.
|
8 |
+
|
9 |
+
## Model Overview
|
10 |
+
|
11 |
+
The model architecture is a Convolutional Neural Network (CNN) built with TensorFlow and Keras. It uses multiple convolutional layers, pooling layers, batch normalization, and dropout for regularization. The final layer uses softmax activation to output probabilities for the three classes.
|
12 |
+
|
13 |
+
### Model Architecture:
|
14 |
+
- Input shape: (256, 256, 3) - Images resized to 256x256 pixels with 3 color channels (RGB).
|
15 |
+
- Convolutional layers with ReLU activation functions.
|
16 |
+
- Batch Normalization layers to stabilize learning.
|
17 |
+
- Pooling layers (Average and Max pooling).
|
18 |
+
- Dropout layers to reduce overfitting.
|
19 |
+
- Dense layers with ReLU and softmax activations.
|
20 |
+
|
21 |
+
## Dataset
|
22 |
+
|
23 |
+
The model was trained on the [IQ-OTHNCCD lung cancer dataset](https://www.kaggle.com/datasets/sfikas/iqothnccd-lung-cancer-dataset), which contains images classified into three categories: Benign, Malignant, and Normal cases.
|
24 |
+
|
25 |
+
### Data Augmentation:
|
26 |
+
- Rescaling of images (1./255).
|
27 |
+
- Augmentations like rotation, shift, and zoom can be optionally applied.
|
28 |
+
|
29 |
+
## Training
|
30 |
+
|
31 |
+
The model was trained with:
|
32 |
+
- Optimizer: SGD with a learning rate of 0.0001.
|
33 |
+
- Loss function: Categorical Crossentropy.
|
34 |
+
- Metrics: Accuracy.
|
35 |
+
- Early stopping and model checkpoints to prevent overfitting.
|
36 |
+
|
37 |
+
### Training Callbacks:
|
38 |
+
- Early Stopping: Monitors validation accuracy with patience of 15 epochs.
|
39 |
+
- ReduceLROnPlateau: Reduces learning rate by a factor of 0.5 if validation accuracy does not improve for 5 epochs.
|
40 |
+
- Model Checkpoint: Saves the best model based on validation accuracy.
|
41 |
+
|
42 |
+
## Evaluation
|
43 |
+
|
44 |
+
The model was evaluated on a separate test set with the following results:
|
45 |
+
- **Test Accuracy**: [insert test accuracy]
|
46 |
+
- **Test Loss**: [insert test loss]
|
47 |
+
|
48 |
+
### Confusion Matrix:
|
49 |
+
![Confusion Matrix](confusion_matrix.png)
|
50 |
+
|
51 |
+
## How to Use
|
52 |
+
|
53 |
+
### Load the Model
|
54 |
+
To load the model from the Hugging Face Hub, use the following code:
|
55 |
+
|
56 |
+
```python
|
57 |
+
import tensorflow as tf
|
58 |
+
|
59 |
+
# Load the model
|
60 |
+
model = tf.keras.models.load_model('https://huggingface.co/your_username/your_model_name/resolve/main/saved_model.pb')
|
61 |
+
|
62 |
+
# Use the model for predictions
|
63 |
+
predictions = model.predict(your_data)
|
64 |
+
|