Giter Site home page Giter Site logo

object-detection-on-aerial-videos's Introduction

object detection on stanford-drone-dataset

This repo contains the codes and steps to perform object detection on stanford drone dataset in DarkNet YOLO-V4 framework. Below you can see the visualization of detected objects with their accuracies.

Demo

Inferencing on scene deathCircle of Stanford Drone Dataset(Trained on very small data. So low accuracy). Let's start to get some cool detections like this!

Wait! Wait! There are lot more boring stuffs to do before diving into the deep learning. Since this is a video dataset, the major task is to preprocess and clean the data. There is no point to train with the whole dataset. First of all, you need to choose some of the videos according to your purpose of detection. But how you would choose them?? 80-90% of the dataset is occupied by pedestrians and bikers. For example, if you want to detect only cars, obviously random selection of videos will not work. I've made it easy for you. (If you want to skip this part, download the prepared dataset from my Drive). This dataset is balanced over 3 classes i.e. pedestrians, bikers and cars only.

Preparing the Dataset

Set up a python virtual environmet with requirements.txt.

  1. Download the dataset from here
  2. Modify the directoy format into this format from which ever format you got. This will make the process easier. fileformat
  3. Put the get_stats.py into the parent directory i.e the dataset directory. This will give you the whole summery into each directory for each video in a Bar chart format. Like this

This will also help you to overcome the class imbalances in your final dataset.

  1. Select the videos according to your detection task and put into another directory.
  2. Then rename the videos and labels into this format.
img1 img2

This is going to help you in your remaining tasks.

  1. $cd data_preparation and Put get_train.py, get_test.py, get_valid.py and run them by python3 get_train.py and similarly remianing two.
  2. This will split each video into frames and store each 30th, 89th and 91st frame for train, test & validation respectively (taking 1 frame per second) And also generate corresponding .csv files. Make sure your system have ffmpeg installed otherwise do sudo apt update then sudo apt install ffmpeg
  3. . It will convert the labels to YOLO format also. YOLO needs the labels in the format <class_id x_center_norm y_center_norm width height> where x_center_norm = x_center/width, y_center_norm = y_center/height . For example for image.jpg, the image.txt will contain
1 0.8778 0.0143 0.04311 0.0287
2 0.8040 0.0236 0.06959 0.0435
2 0.0083 0.1345 0.01664 0.0379

Now you are good to go.

Training

  1. Clone the repository git clone https://github.com/AlexeyAB/darknet.git

For training on Stanford Drone Data, follow the step 1 from AlexeyAB's Repo If you are training on local gpu, make sure you have cuda and cuDNN with compatible version installed in your system.

  1. Create file obj.names in the directory darknet/data/, with objects names - each in new line
  pedestrian
  biker
  skater
  car
  cart
  bus
  1. Create file obj.data in the directory darknet/data/, containing (where classes = number of objects):
classes = 6
train  = data/train.txt
valid  = data/test.txt
names = data/obj.names
backup = backup/
  1. Put image-files (.jpg) of your objects in the directory darknet/data/obj/
  2. Create file train.txt in directory darknet/data/, with filenames of your images, each filename in new line, for example containing:
data/obj/img1.jpg
data/obj/img2.jpg
data/obj/img3.jpg
  1. Download pre-trained weights for the convolutional layers and put to the directory build\darknet\x64

  2. Start training by using the command line: ./darknet detector train data/obj.data yolo-obj.cfg yolov4.conv.137

Inferencing

  1. For Image: !./darknet detector test data/obj.data cfg/yolov4-custom.cfg yolov4-custom_best.weights test_image.jpg -thresh 0.3 check darknet/predictions.jpg

  2. For video: !./darknet detector demo data/obj.data cfg/yolov4-custom.cfg yolov4-custom_best.weights -dont_show test_vid.mp4 -thresh 0.5 -i 0 -out_filename output.mp4

object-detection-on-aerial-videos's People

Contributors

soumyadbanik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

object-detection-on-aerial-videos's Issues

get_train.py cannot find

I cannot see the python scripts:get_train.py,get_test.py and get_valid.py,where can I get these scripts please?

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.