Giter Club home page Giter Club logo

object-detection-and-ranging's Introduction

Computer Vision - Object Detection and Distance Ranging

Originally made for my university's Department of Computer Science's course Software, Systems & Applications under the sub-module Computer Vision, as part of the coursework in 2018/2019.

This project aims to "develop an object detection system that correctly detects one or more types of dynamic objects within the scene in-front of the vehicle and estimates the range (distance in metres) to those objects.", given a set of stereo images taken from a moving car in real world traffic.

A few directories/files are not committed to this repository due to their unwieldy sizes, their availability on the web, or their proprietary status. These include the training data, which is a cut-down copy of the original INRIA pedestrain data set from http://pascal.inrialpes.fr/data/human/. The stereo images themselves, which, due to their large amount, occupy a large amount of space, and are copyright of my university, are also part of the uncommitted files.

Quick Brief

This repository offers two options of object detection.

The first utilizes HoG descriptors fed into a Support Vector Machine Classifier, utilizing Selective Search for region proposals. This is where the bulk of the work went into and can detect persons in the images. This repo had great influence on this section of the work.

The second utilizes a MaskRCNN implementation taken from this repo, which can detect 80 different classes of objects via weights pre-trained on the COCO dataset. Most of the work with regards to this second option was in integrating it into the main script, detect_and_range.py.

Both options utilize the same method for estimating the depth to the detections, namely SGBM. This section of the work borrows a lot from this repo.

Getting Set up

This project was built in Python 3.5 and hence will require a version of Python 3.x to work.

It should be noted that if one only wishes to run the SVM implementation, then they only need to ensure that OpenCV 3.4.x is installed. To try out the MaskRCNN implementation, please proceed with the following steps

  1. Ensure that the following modules are installed:

On the University DUDE machines, running opencv3-4.init and tensorflow.init before proceeding with the rest of the installation should cover it.

  1. Then cd into Scripts/Deep/ and run pip3 install --user -r requirements.txt.
  2. In the same directory, run python3 setup.py install --user.
  3. In any directory, run pip3 install --user pycocotools.
  4. Finally, if not already present in Scripts/Deep/, download the pre-trained weights mask_rcnn_coco.h5 from here (should already be there for Uni Submission)

Usage

Before running any script after setup is complete, ensure you are in the Scripts/ directory.

Object Detection

This is done via the main script, detect_and_range.py. To use it, type python3 detect_and_range <model> <start_image> into the terminal.

  • Here, <model> is to be replaced either by:
    • SVM if one wishes to utilize the SVM implementation
    • MRCNN if one wishes to utilize the MaskRCNN implementation
  • Furthermore, <start_image> is to be replaced with:
    • start if one wishes to cycle from the start of the images directory
    • Or simply the filename of the desired image to start from.

Additional Notes

  • Set the path to the directory containing the stereo images in line 44 of detect_and_range.py under the variable name master_path_to_dataset
  • For SVM, there are different trained models saved in Write/. Currently what we consider the best from our training is set for usage. To change the model to be used, set it in line 66 of params.py under the variable name HOG_SVM_PATH_SAVED.

Training

Custom training can be performed for the SVM implementation.

This is done via hog_train.py. To train a model, set the training parameters in params.py and then run python3 SVM/hog_train.py in the terminal. Ensure to change the HOG_SVM_PATH_TRAIN variable after successive trainings to avoid overwriting.

object-detection-and-ranging's People

Contributors

thesofakillers avatar

Stargazers

makeplayer avatar

Watchers

James Cloos avatar paper2code - bot 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.