ijrios / Leukemia_Classification

This code employs a CNN model to classify medical images as "sick" or "not sick," using color segmentation for feature extraction and providing prediction timing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leukemia Classification and Prediction: Identifying Benign, Early, Pre, and Pro Conditions with CNN

The provided code is designed to perform image classification on a dataset of medical images. Specifically, it aims to distinguish between images representing different categories, such as "sick" and "not sick." The dataset is organized into folders, with each folder representing a different class or category. In this case, it appears that there are four classes: "Benign," "Early," "Pre," and "Pro," corresponding to different medical conditions.

The code first preprocesses the dataset by loading and resizing the images to a common size of 224x224 pixels. This step ensures that all images have consistent dimensions and can be fed into a Convolutional Neural Network (CNN), a popular deep learning architecture for image-related tasks. Additionally, the pixel values of the images are normalized to a range between 0 and 1, which is a common practice in deep learning to facilitate model training.

Next, the code defines a CNN model using the Keras library, which is a high-level neural networks API running on top of TensorFlow. The model architecture consists of convolutional layers for feature extraction, max-pooling layers for down-sampling, and fully connected layers for classification. The output layer has four neurons, one for each class, and uses the softmax activation function to produce class probabilities.

The model is then compiled with the Adam optimizer and sparse categorical cross-entropy loss, which is suitable for multi-class classification problems like this one. Additionally, accuracy is chosen as the evaluation metric.

The training process begins by splitting the preprocessed dataset into training and testing sets, with 80% of the data used for training and 20% for testing. The model is trained for 10 epochs, and the training progress is monitored using the validation data.

Once the model is trained, the code performs predictions on sample images. Specifically, it loads a test image, applies color segmentation techniques using the HSV color space to extract relevant features, resizes the segmented result, and then feeds it into the trained model. The predicted class for the image is printed, indicating whether the model categorizes it as "Benign," "Early," "Pre," or "Pro."

Additionally, as part of this project, there is a plan to develop an application that will implement the model. This application will allow doctors to upload patient images and receive predictions from the model, indicating whether the patient is sick or not. This has the potential to significantly reduce the workload of medical professionals and expedite the diagnostic process.

Finally, there is a plan to create a Python Flask API to enable the convenient and accessible uploading of images to the application and to display the results to the medical professionals

About

This code employs a CNN model to classify medical images as "sick" or "not sick," using color segmentation for feature extraction and providing prediction timing.

License:Apache License 2.0


Languages

Language:Jupyter Notebook 99.9%Language:Nix 0.1%