Skip to content

This project contains a Python script for training a simple object detection model using TensorFlow.

Notifications You must be signed in to change notification settings

IshikaBanga26/Object-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Object Detection with TensorFlow

This project contains a Python script for training a simple object detection model using TensorFlow. The model is trained to recognize and locate MNIST digits placed on a larger canvas.

Description

The main.py script performs the following steps:

  1. Loads the MNIST dataset using tensorflow_datasets.
  2. For each digit, it creates a larger image (75x75) and places the 28x28 digit at a random location.
  3. It defines a convolutional neural network (CNN) model with two outputs:
    • A classification head to predict the digit (0-9).
    • A regression head to predict the bounding box coordinates of the digit.
  4. The model is compiled with losses and metrics for both classification and bounding box regression.
  5. The script trains the model on the generated dataset.
  6. After training, it evaluates the model's performance, plots training metrics, and displays some predictions with bounding boxes.

Dependencies

The script requires the following Python libraries:

tensorflow
tensorflow-datasets
numpy
matplotlib
Pillow

You can install them using pip:

pip install -r requirements.txt

Usage

To run the script, execute the following command in your terminal:

python main.py

The script will start the training process, and you will see the model's progress for each epoch. After training is complete, it will display evaluation results and show plots for the training metrics.

Model Architecture

The model consists of three main parts:

  • Feature Extractor: A simple CNN with three Conv2D layers to extract features from the input image.
  • Classifier: A dense layer with a softmax activation function to predict the class of the digit.
  • Bounding Box Regressor: A dense layer with a linear activation to predict the coordinates of the bounding box.

About

This project contains a Python script for training a simple object detection model using TensorFlow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages