This project aims to classify lung tissue as normal or cancerous using a Convolutional Neural Network (CNN). The model is trained on histopathological images from the Kaggle Dataset. The dataset includes images of three classes:
- Normal Tissue
- Lung Adenocarcinomas
- Lung Squamous Cell Carcinomas
The model utilizes Python libraries like TensorFlow, Keras, OpenCV, and Scikit-learn to preprocess the images and build the classifier.
- Lung_Cancer_Detection.ipynb: The Jupyter Notebook containing code for data processing, visualization, model building, training, and evaluation.
- README.md: Project documentation (you're reading it right now).
The dataset contains 5000 histopathological images classified into three classes. The dataset can be downloaded from Kaggle: Lung and Colon Cancer Histopathological Images.
-
Clone the Repository: ```bash git clone https://github.com/SAI-ADITH/Lung-Cancer-Detection.git cd Lung-Cancer-Detection ```
-
Install Python Dependencies: Make sure you have Python and pip installed. Install the required packages by running: ```bash pip install -r requirements.txt ``` If `requirements.txt` is not available, manually install the key packages: ```bash pip install numpy pandas matplotlib scikit-learn opencv-python tensorflow keras pydot graphviz ```
-
Jupyter Notebook: To run the code, you need to have Jupyter Notebook installed. You can install it via: ```bash pip install notebook ```
-
Open Jupyter Notebook: In your terminal, navigate to the project directory and run: ```bash jupyter notebook ``` This will open a local server in your default web browser.
-
Load the `Lung_Cancer_Detection.ipynb` Notebook: In the Jupyter Notebook interface, navigate to and open `Lung_Cancer_Detection.ipynb`.
-
Execute the Cells:
- Follow the instructions provided in the notebook to run each code cell sequentially.
- Make sure the dataset is placed correctly as per the directory structure outlined above.
The Convolutional Neural Network (CNN) model consists of the following layers:
- Convolutional Layers: Three sets of Conv2D and MaxPooling2D layers.
- Flatten Layer: Converts the 2D matrix output to a 1D vector.
- Dense Layers: Two dense layers, one with `BatchNormalization` and `Dropout` for regularization.
- Output Layer: A dense layer with `softmax` activation to classify the image into one of three classes.
The model is compiled using:
- Optimizer: `Adam`
- Loss Function: `Categorical Crossentropy`
- Metrics: `Accuracy`
The model achieved an F1 score of over 90% for each class, indicating a high level of accuracy in predicting the presence of cancerous cells in lung tissues.