How fast is Object Detection in a Google Cloud CPU Processor? — Steps to check Image detection speed of YOLOv3 Algorithm

Harinath Selvaraj
coding&stuff
Published in
3 min readSep 17, 2019

Hi, I am going to tell how much time does an object detection task take in a 15GB RAM CPU processor in Google Cloud. This involves step by step process to install YOLOv3 (You Look Only Once) library and test the same in Google Cloud CPU processor.

Object detection from YOLOv3 website

With the advancement of Computer Vision technologies, many kinds of researches are being done by famous companies, Google, Facebook & Microsoft in the field of Object detection

YOLOv3 is one of the famous libraries released in the year 2018 and is proven to be extremely fast and accurate. More information about the library can be found in the below link

Google Cloud offers $300 credits for using its cloud services for a new google account.

Creating a New VM Instance on Google Cloud

Go to cloud.google.com → Click on ‘Console’ on top right corner → Click on the Side menu → Compute Engine → VM Instances → Create Instance →

I chose the Machine type as n1-standard-4 (4 vCPUs, 15 GB memory) & Zone as us-west1-b for this experiment.

Creation of VM Instance under ‘Compute Engine’ in Google Cloud

Creating a Jupyter Notebook Instance on the VM

After the VM is created, the next step is to create a ‘Jupyter Notebook’ instance so that python programs can be executed on it. In order to do that, go to Side Menu → AI Platform → Notebooks → New Instance

Notebook Instance for writing Python code

After it is created, click on ‘Open JupyterLab’ and ‘Python3 Notebook’ to start writing the code.

Please execute the below commands to download the code from GitHub and also to make the code ready for Image prediction.

!git clone https://github.com/pjreddie/darknet
!cd ./darknet && make
!wget https://pjreddie.com/media/files/yolov3.weights # Load the weights

After this step, you can find the files created under the ‘darknet’ folder. Please rename the folder to any other name and move all the files inside this folder to the base folder. After it's done, the below command can be executed to get the predictions of ‘dog.jpg’ file.

!./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

The overall prediction time was 35 seconds. It should be less a second in a system having a GPU processor. Since Image processing involves processing a lot of graphics, it normally works super fast in GPU compared to CPU. Let me know how much time it takes on a GPU.

Note: After completing the work, don’t forget to turn off the VM Instance to avoid charges.

Happy coding! 😃

--

--