This repository contains the implementation of a Convolutional Neural Network (CNN) model for image classification. The project aims to achieve high accuracy in identifying classes of images through an efficient deep learning approach. The repository also incorporates a robust CI/CD pipeline for seamless integration, testing, and deployment.
The CNN model is designed to classify images into predefined categories with high precision. We want to classify yes/no images that can be: circled, not circled, ticked and not ticked.
- Architecture: The model is a custom-built CNN with the following layers:
- Convolutional layers for feature extraction.
- Max-pooling layers for dimensionality reduction.
- Fully connected layers for classification.
- Dropout layers to prevent overfitting.
- Activation Functions: ReLU for intermediate layers and Softmax for the output layer.
- Optimizer: Adam optimizer for efficient gradient descent.
- Loss Function: Cross-entropy loss to measure prediction error.
- Performance:
- Training Accuracy:
- Validation Accuracy:
- Test Accuracy:
- Dataset:
- The dataset consists of >1000 images categorized into 4 classes.
- Preprocessing includes resizing, normalization. Data augmentation techniques such as flipping, rotation, and zooming has not been tried yet.
- Training:
- The model is trained on a GPU-enabled environment for faster computation.
- Training involves multiple epochs with checkpoints for saving the best model.
- Evaluation:
- The model's performance is evaluated using accuracy, precision, recall, and F1-score.
- Confusion matrix and classification report are generated for detailed insights.
repo/
├── dataset/ # folder with labelled images
├── .github/
│ ├── workflows # CI/CD pipeline configuration
│ ├── release.yml # workflow for automated semantic release tagging
│ ├── build_and_predict.yml # workflow to train and run prediction on built model
├── results_model/
│ ├── folder with annotated images after prediction
├── README.md # Project description and setup guide
├── requirements.txt # Dependencies
├── .gitignore # Ignored files and directories
├── main.py # utility functions
├── build_model.py # script to build and save the model
├── run_predictions.py # script to run prediction on a test dataset
├── notebook.ipynb # Jupyter Notebook for testing and debugging
- Data Preprocessing:
- Loads raw images and applies transformations such as normalization.
- Model Training:
- Defines and trains the CNN model.
- Saves the best-performing model based on validation metrics.
- Evaluation:
- Evaluates the trained model on test data.
- Generates performance metrics and visualizations such as confusion matrix.
- Deployment:
- Deploys the trained model using the CI/CD pipeline.
- Monitors the deployment environment for performance issues.
- Clone this repository:
git clone https://github.com/bruvio/image_detection.git cd repo - Install dependencies:
pip install -r requirements.txt
- Train the model:
python build_model.py
- Evaluate the model:
python run_predictions.py
Contributions are welcome! Please fork the repository and create a pull request with your proposed changes.
This project is open-source and available under the MIT License.
- bruvio - Initial work - bruvio