Run YoloV4 and DeepSort Object Tracking in AWS
How to run YoloV4 and DeepSort Object Tracking in AWS Sagemaker Jupyter Notebook instance
AI Guy has excellent YouTube video and Github on how to run YoloV4 and DeepSort in Google Colab, but I hit a few issues running the same in AWS. I got indecipherable errors due to mismatch of drivers found on the AWS jupyter instance and the libraries needed for running tensorflow-gpu.
To get started in AWS, You will need to launch at least a p3.2xlarge to use GPU to achieve high FPS(Frames Per Second) when running the YoloV4 and DeepSort Object Tracking application.
Platform Identifier
When launching the notebook instance, select Amazon Linux 1(AL1). AL1 is based on CentOS/RHEL 7 mostly, while AL3 is based on CentOS/RHEL 10. Initially, when I chose Amazon Linux 3(AL3), I couldn't find matching CUDA Toolkit and CuDNN drivers from Nvidia that match the python and tensorflow-gpu libraries required by YoloV4 and DeepSort github package above.
GPU
To ensure the right versions of CUDA and CuDNN drivers are installed, check out the excellent article by Dr.Akutekwe. He also has steps on verifying that GPU is used with simple matrix operations.
But Note — To run the YoloV4 and DeepSort Object Tracking Application as shown by AI Guy, you will need to install CUDA 10.1 drivers.
wget https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.runsudo sh cuda_10.1.243_418.87.00_linux.run
Obtain the latest CuDNN library for CUDA 10.1 for Red Hat x86_64 from CuDNN Archive.
https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/10.1_20201106/RHEL7_3-x64/libcudnn8-8.0.5.39-1.cuda10.1.x86_64.rpm
With the above CUDA and CuDNN installation steps above, you should be able to run YoloV4 and DeepSort Object Tracking using AI Guy’s instructions for Conda Tensorflow GPU in the Jupyter Notebook Instance Terminal window.
The only minor update I needed to make was
conda-gpu.yml:
tensorflow-gpu==2.3.0
Because 2.3.0rc0 was not found.
Once you have installed the conda/pip dependencies and saved the model in Tensorflow format as outlined in the README file, When running the object_tracker.py in the terminal, add flag dont_show to not output the frame to the console, as shown below. Otherwise, the program will terminate abruptly.
python object_tracker.py --weights ./checkpoints/yolov4-tiny-416 --model yolov4 --video ./data/video/test.mp4 --output ./outputs/tiny.avi --tiny --dont_show True