Skip to content

This repo uses a Tensorflow CNN model to classify yes/no images into 4 categories: ticked, not ticked, circled and not circled

Notifications You must be signed in to change notification settings

bruvio/image_detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CNN Image Classification Repository

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.

Purpose

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.

Model Details

  • 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:

Achieving the Goal

  1. 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.
  2. Training:
    • The model is trained on a GPU-enabled environment for faster computation.
    • Training involves multiple epochs with checkpoints for saving the best model.
  3. Evaluation:
    • The model's performance is evaluated using accuracy, precision, recall, and F1-score.
    • Confusion matrix and classification report are generated for detailed insights.

Repository Structure

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



Stages of the Pipeline

  1. Data Preprocessing:
    • Loads raw images and applies transformations such as normalization.
  2. Model Training:
    • Defines and trains the CNN model.
    • Saves the best-performing model based on validation metrics.
  3. Evaluation:
    • Evaluates the trained model on test data.
    • Generates performance metrics and visualizations such as confusion matrix.
  4. Deployment:
    • Deploys the trained model using the CI/CD pipeline.
    • Monitors the deployment environment for performance issues.

How to Use

  1. Clone this repository:
    git clone https://github.com/bruvio/image_detection.git
    cd repo
  2. Install dependencies:
    pip install -r requirements.txt
  3. Train the model:
    python build_model.py
  4. Evaluate the model:
    python run_predictions.py

Contributions

Contributions are welcome! Please fork the repository and create a pull request with your proposed changes.

License

This project is open-source and available under the MIT License.

Author

  • bruvio - Initial work - bruvio

About

This repo uses a Tensorflow CNN model to classify yes/no images into 4 categories: ticked, not ticked, circled and not circled

Resources

Stars

Watchers

Forks

Packages

No packages published