lykius / bdd-yolo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YOLOv3 and Berkeley Deep Drive

A repository for my studies on implementing YOLOv3 and using it on the Berkeley Deep Drive dataset.

Dataset preparation (Darknet style)

Download python scripts

  1. Run git clone https://github.com/lykius/bdd-yolo.git
  2. Navigate inside the new directory named "bdd-yolo"
  3. Create a new Python3 virtual environment with the command python3 -m venv venv
  4. Activate the new virtual environment with source venv/bin/activate
  5. Run pip3 install -r requirements.txt to install all the needed libraries

Download images and labels

  1. Create an account here: https://bdd-data.berkeley.edu/login.html
  2. Access the download page (https://bdd-data.berkeley.edu/portal.html#download)
  3. Click on the "Images" button to download a 6.5 GB zip file called "bdd100k_images.zip"
  4. Click on the "Labels" button to download an other archive called "bdd100k_labels_release.zip"
  5. Place both the zip files in a directory "archives" inside the directory "bdd-yolo" created in the section above

Run python scripts

  1. Navigate inside the directory "bdd-yolo"
  2. Run python3 dataset_prep.py. This will:
    • Unzip the two archives and rearrange files and directories
    • Resize images from 1280x720 to 416x256 (the size has been chosen to be multiple of 32)
    • Create files with the lists of training, validation and test images
    • Create one labels file for every training and validation image

Test

If everything went fine, you can run python3 dataset_test.py and see one image at a time of the validation set (with bounding boxes and labels taken from the dataset info).
Alternatively, you can play around with jupyter notebook bdd.ipynb.

Darknet test

The repository contains an implementation of Darknet (YOLOv3), made in python with the framework PyTorch. The program loads the network architecture and the weights from two files:

  • bdd.cfg with the network architecture and other configuration parameters
  • bdd.weights with the weights for all the network parameters

The first is already inside the directory yolo/cfg.
The second can be downloaded from mediafire or from google drive. After downloading it, place it in the directory yolo/cfg.
Weights have been generated by training the official version of darknet (https://github.com/pjreddie/darknet) for a week on the Berkeley Deep Drive dataset (prepared as described above).
To test the network, just run python3 darknet_test.py and the program will forward one image at a time of the validation set through the darknet implementation. Predictions will be printed out and displayed on the processed image.
It is also possible to use the jupyter notebook darknet.ipynb.

About


Languages

Language:Jupyter Notebook 92.8%Language:Python 7.2%