In this post I will show you the easiest way to combine AI, convolution neural network(CNN) and docker container to classified object in real time. So all thing you need to know is basic knowledge about docker and neural network. If you are very new to programming, don’t worry, just follow the step below, and you will have a program classified object in real time.
in the video above I’m driving a car go around with a camera on top, to tracking other car and person inside it. I use CUDA Yolo + Nvidia GPU. You can also do the same, all you need to do is download my Docker file and run it.
For who need to understand the theories behind, I will summaries like this. The docker file will create a Ubuntu Linux environment and install Nvidia GPU+OpenCV+darknet in to it. Darknet is a wonderful neural network, it was train by around 10 millions picture and can real-time recognize about 70 categories (car, dog, cat, ship, plane….). If you want to learn more about darknet, you can read my article : https://thanhnguyensite.net/2020/11/05/neural-network/
OK! now let’s go the AI world:
Darknet Nvidia-Docker Ubuntu 16.04
- Make sure you have the NVidia driver for your machine
Find out your the Graphics Card model
lspci | grep VGA
How to install NVidia Drivers on Linux https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07#install-nvidia-graphics-driver-via-runfile
- Install Docker and NVidia Docker https://github.com/NVIDIA/nvidia-docker
- Clone this repo:
git clone https://gitlab.com/thanhnguyen1181991/darknet-docker.git
- Build the machine (this step might take a while, go make some coffee)
docker build -t darknet .
start.shmake sure you have the correct address of your webcam, in file start.sh line 8, if you use laptop onboard webcam, then choose: device=/dev/bus/usb/003/004:/dev/video0, if use external webcam, then: device=/dev/bus/usb/003/004:/dev/video0
Find your webcam bus
Change the following line with the correct webcam bus
- Map a local folder to the Docker Container
start.sh change the following line
-v /home/projects:/dev/projects \
- Run the machine with Webcam
Make sure you have the weights for what you want to run
More information at https://pjreddie.com/darknet/