Code Monkey home page Code Monkey logo

object_detection_using_r-cnn's Introduction

Implementation of R-CNN Model for object detection from scratch.

In object detection, we have to classify the objects in an image and also locate where these objects are present in the image.

There are two types of object detection networks:

* Two-stage network: R-CNN and its variants.
* Single-stage network: YOLO. 

We have worked on two-stage network in this project.

> The initial stage of this network identifies region proposals: 

	* By using selective search segmentation algorithm, we will generate 2000 region proposals (bounding box) from an image that could contain an object. (x, y, width, height). 
	* IOU (Intersection over union) is calculated between each of these bounding boxes and ground truth bounding box (original object’s bounding box). 
	* Since we have decided to detect only one class (person) in an image, IOU > 0.7 is considered as an object (label = 1) and IOU < 0.3 as a background (label = 0). About 20 objects and 20 background are selected from a single image. 

> The second stage classifies the above cropped images(objects and background) using transfer learning(Resnet model)

Dataset: COCO dataset

* Coco dataset is a large-scale image dataset containing 328,000 images of 80 object categories. 
* The dataset was downloaded from fiftyone library. We have loaded all the images which contains person. These images may also contain other objects with person. 
* Details regarding the bounding boxes of objects in an image, image_id, category_id, etc will be available in the annotation file. 

region_proposal.ipynb --> Importing the dataset, creating a dataframe (image_id, bounding_box, image_path), dividing the dataset (training, validation, testing), creating regions using selective search segmentation, creating 20 object images with IOU > 0.7 and 20 background images with IOU < 0.3 from each image, and saving those cropped images.

cnn_model.ipynb --> loading the dataset, batching and balancing the dataset, image augmentation. Classifying objects and background by transfer learning (Resnet model). Achieved 90% accuracy and saved the best accuracy model as model1.pt.

inference.ipynb --> given an image, detect the objects present in that image. Using non-max suppression to select bounding box with maximum score for each object out of many overlapping objects.

utils.ipynb --> contains functions to calculate IOU and to save images to the given directory.

object_detection_using_r-cnn's People

Contributors

shalini-b-s avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.