Coder Social home page Coder Social logo

cv-car-control's Introduction

Quick Start

Dependencies

Here is the list of dependcies:

In case you use Ubuntu or similar, run:

sudo snap install webots
pip3 install opencv-contrib-python

Project Files

Clone the project as:

git clone --depth=1 https://github.com/lukicdarkoo/cv-car-control.git

Make sure you have git lfs installed if you want to get pre-trained model as well.

Simulation

Standalone fist detector (without simulation) is located in ./controllers/steering_wheel_controller/wheel_detector.py and you can run it as:

python3 ./controllers/steering_wheel_controller/wheel_detector.py

However, if you want to have a fun and run the simulation, execute the following command:

webots ./worlds/city.wbt

(or simply open ./worlds/city.wbt in Webots GUI)

Training

If you want to improve the model provided within this project, here is an explanation on how to do it.

Make Dataset

Install labelImg and open it:

pip3 install labelImg
labelImg

In labelImg make sure to click YOLO and annotate all the images. Once all the images annotated move them, together with the corresponding *.txt files, to dataset/train and dataset/valid. It is very important to move 10-20 percent of the images to dataset/valid directory and the rest, move to dataset/train. YOLO also needs a list of images for validation and training written to *.txt files. You can make the files by invoking the following commands from the project's root:

cd ./dataset
find train -name '*.jpg' > train.txt
find valid -name '*.jpg' > valid.txt

Train Locally

If you have GPU and CUDA available then you may prefer to train the YOLO locally.

First, install darknet with GPU and CUDA support:

git clone https://github.com/pjreddie/darknet
cd darknet
sed -i 's/CUDNN=0/CUDNN=1/g' darknet/Makefile
sed -i 's/GPU=0/GPU=1/g' darknet/Makefile
make -j8

To accelerate training it is usually a good idea to start from pre-trained model. Download the pre-trained model in the project directory:

wget https://pjreddie.com/media/files/darknet53.conv.74

Finally, you can initiate the training as:

cd ./dataset
$HOME/darknet/darknet detector train ./custom.data ../yolov3-tiny_train.cfg ../darknet53.conv.74 

and your models will be available in ./dataset/backup.

Train on Google Colab

Google Colab

In case you don't have GPU it probably a good idea to use Google Colab (click on the badge above). After the Google Colab is ready, upload yolov3-tiny_train.cfg and ./dataset folder compressed as dataset.tar.xz.

You can create dataset.tar.xz as tar -cf ./dataset ./dataset.tar.xz

Run all cells and after approx. 1 hour of training the model will be ready waiting in ./dataset/backup.

cv-car-control's People

Contributors

lukicdarkoo avatar

Watchers

 avatar  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.