This repository implements a Convolutional Neural Network (CNN) to analyze MRI scans and determine whether a brain tumor is present. The project is designed to function as a backend system, providing the necessary infrastructure to train and deploy the model.
- Python 3.x installed on your system
- A stable internet connection to download the dataset and dependencies
-
Clone the repository:
git clone https://github.com/Cleveridiot07/BrainTumorClassificationUsingOpenCV cd BrainTumorClassificationUsingOpenCV
-
Initialize a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Download the dataset:
-
Unzip the dataset:
- After downloading, unzip the dataset:
- On Windows: Right-click the file and select Extract All....
- On macOS/Linux: Use the command:
unzip datasets.zip
- After downloading, unzip the dataset:
-
Place the dataset:
- After unzipping, place the dataset in the following directory structure:
backend/ ├── model/ │ ├── maintrain.py │ └── <dataset-folder>
- After unzipping, place the dataset in the following directory structure:
-
Navigate to the
model/
directory:cd model
-
Run the training script:
python maintrain.py
-
After training, the
.h5
file for the model will be generated automatically in themodel/
directory.
-
Return to the
backend
directory:cd ..
-
Start the backend:
uvicorn main:app --reload
- This will run the backend at
http://127.0.0.1:8000
. - You can proceed to
http://127.0.0.1:8000/docs
to test the app using the interactive API documentation provided by Swagger UI. - Press
CTRL+C
to stop the server.
- This will run the backend at
Feel free to fork the repository, create a branch, and submit a pull request to contribute to the project.