Author: Ayush Deep
Dataset: https://www.kaggle.com/datasets/mohamedhanyyy/chest-ctscan-images
This project implements a Convolutional Neural Network (CNN) to detect lung cancer from CT scan images. The model analyzes chest CT images and classifies them into different categories of lung conditions.
Deep learning models such as CNNs are highly effective in medical image analysis because they automatically learn important features like edges, textures, and shapes that indicate abnormalities.
The goal of this project is to demonstrate how CNNs can assist in early lung cancer detection, helping doctors identify potential issues faster.
The dataset used for training and testing is the Chest CT-Scan Images Dataset available on Kaggle.
Dataset Link:
https://www.kaggle.com/datasets/mohamedhanyyy/chest-ctscan-images
For this project, the dataset was simplified into two categories:
- Normal – Healthy lung CT scan images
- Cancer – CT scans showing lung cancer
Reducing the dataset to a binary classification problem helps the CNN focus on distinguishing between healthy and abnormal lung structures.
- Python
- TensorFlow / Keras
- NumPy
- Matplotlib
- Streamlit
- Convolutional Neural Networks (CNN)
The CNN model consists of several layers used to extract and learn features from CT scan images:
- Convolutional Layers – Detect patterns such as edges and textures.
- ReLU Activation Function – Adds non-linearity to the model.
- Max Pooling Layers – Reduce image dimensions while preserving important features.
- Flatten Layer – Converts feature maps into a one-dimensional vector.
- Dense (Fully Connected) Layers – Perform classification.
- Output Layer (Softmax/Sigmoid) – Generates probability scores for each class.
Before training, the images go through preprocessing steps such as:
- Image resizing
- Normalization
- Splitting dataset into training and validation sets
- Optimizer: Adam
- Loss Function: Categorical/Binary Crossentropy
- Epochs: 20
- Batch Size: Configurable
The model learns to classify CT images by minimizing prediction error during training.
git clone https://github.com/your-repo/lung-detection-cnn.git
cd lung-detection-cnnpip install -r requirements.txtpython train.pystreamlit run app.pyThe Streamlit interface allows users to upload CT scan images and receive predictions from the trained CNN model.
The CNN model successfully learns patterns from CT scan images and predicts lung conditions with promising accuracy.
This project demonstrates the potential of deep learning in medical image classification.
Possible improvements include:
- Increasing dataset size
- Applying data augmentation
- Using transfer learning models such as ResNet or EfficientNet
- Improving model accuracy
- Deploying the model on cloud platforms
This project is intended for educational and research purposes only.
It should not be used as a substitute for professional medical diagnosis.