Skip to content
MathWorks - Mobile View
  • Accedere al proprio MathWorks AccountAccedere al proprio MathWorks Account
  • Access your MathWorks Account
    • Il Mio Account
    • Il mio Profilo utente
    • Associa Licenza
    • Disconnettiti
  • Prodotti
  • Soluzioni
  • Università
  • Assistenza
  • Community
  • Eventi
  • Acquista MATLAB
MathWorks
  • Prodotti
  • Soluzioni
  • Università
  • Assistenza
  • Community
  • Eventi
  • Acquista MATLAB
  • Accedere al proprio MathWorks AccountAccedere al proprio MathWorks Account
  • Access your MathWorks Account
    • Il Mio Account
    • Il mio Profilo utente
    • Associa Licenza
    • Disconnettiti

Video e Webinar

  • MathWorks
  • Video
  • Home Video
  • Cerca
  • Home Video
  • Cerca
  • Contatta l’ufficio addetto alle vendite
  • Software di prova
4:24 Video length is 4:24.
  • Description
  • Full Transcript
  • Related Resources

Real-Time Object Detection with YOLO v2 Using GPU Coder

Walk through an example of real-time object detection using YOLO v2 in MATLAB®. We start with a published example in MATLAB that explains how to train a YOLO v2 object detector and, using GPU Coder™, we generate optimized CUDA code. 

We verify the generated code by compiling it into a MEX file using nvcc and we find the generated MEX to run at about 80 frames per second on the test video file. 

Using the hardware support package for NVIDIA® GPUs, we deploy the generated code to the Jetson Xavier board as a standalone application.

Hi, I am Ram Cherukuri, product manager here at Mathworks, and in this video I am going to walk you through an example of real-time object detection using Yolo V2 in MATLAB.

What is Yolo?

YOLO stands for “You only look once” and it is a popular approach for object detection.

A common approach to object detection was to repurpose classifiers to perform detection.

So, for instance, RCNN uses region proposal methods to first generate potential bounding boxes in an image and then run a classifier on these proposed boxes and then refine the predictions. As you can see, this requires multiple evaluations.

Yolo, on the other hand, frames detection as a regression problem, and unifies the separate components of object detection into a single neural network.

It divides the input image into a grid and each grid cell predicts a certain number of bounding boxes along with confidence scores for the boxes. The scores reflect how confident the model is that the box contains an object and also how accurate it thinks the box is that it predicts. Each grid cell also predicts conditional class probabilities.

That’s a lot to process and I would suggest referring to a few papers and articles to understand the nuances of this unique approach as it’s not possible to cover all that in this short video.

Yolo has become very popular and important as it is considered the state-of-the-art technique since it uses a single network and is very fast for real-time object detection.

Even if you are not familiar, you can get started with Yolo v2 with this published example in MATLAB® that explains how you can train a Yolov2 object detector on your data.

Then, using GPU Coder™, you can generate optimized CUDA code to target NVIDIA® boards like the Jetson Xavier directly from MATLAB.

The hardware support package enables you to deploy the generated code to the Jetson and the drive platforms, as we will see in the demo that follows.

Here in MATLAB, I have taken the trained object detector from the example as my starting point and I am going to run inference on a test image here.

In fact, we ran a simple test comparing the Faster RCNN model with YolO v2 and you can see that Yolo v2 is about 25 times faster on my local machine here.

Now, using GPU Coder, we are going to generate CUDA code from this function and compile it using nvcc into a MEX file so we can verify the generated code on my desktop machine.

You can see that the generated MEX runs at about 80 frames per sec on this video file on my desktop that has a Titan Xp GPU.

Please note that these are not official benchmarking numbers, as I have some other programs also running in the background, but this should give you an idea of the performance of the Yolo v2 network.

Now, using the hardware support package for NVIDIA GPUs, I can get live data from the camera connected to my Jetson Xavier board and we can run inference using the same generated MEX file.

 Here I am using the live data from outside my window overlooking the traffic on Route 9.

Finally, I can generate code from our algorithm here that takes the input from the webcam, uses Yolo v2 for object detection, and displays the output.

The NVIDIA hardware support package supports code generation for these interfaces and once code is generated and built, we can run the executable as a standalone application on the Jetson Xavier board.

So, we have real-time object detection using Yolo v2 running standalone on the Jetson Xavier here, taking live input from the webcam connected to it.

A few takeaways from this example are summarized here. You can target NVIDIA boards like the Jetson Xavier and Drive PX with simple APIs directly from MATLAB without needing to write any CUDA code.

Please refer to the links below the video to learn more about the hardware support package and to find more object detection examples in MATLAB.

Related Products

  • GPU Coder
  • Computer Vision Toolbox
  • Deep Learning Toolbox
  • MATLAB Coder

Object Detection Using Deep Learning
Object Detection Using YOLO v2 Deep Learning
NVIDIA GPU Support from GPU Coder

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper
Related Information
Related Information
Get started with Deep learning for your application

Feedback

Featured Product

GPU Coder

  • Request Trial
  • Get Pricing

Up Next:

46:56
Computer Vision with MATLAB for Object Detection and...

Related Videos:

11:24
Addressing Implementation Constraints Using MATLAB Coder
2:58
Unit Testing Your Generated Code Using MATLAB Coder
0:26
Deploying to iPhone and iPad Apps Using MATLAB Coder
4:17
Integrate Code into Visual Studio Using MATLAB Coder

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contatta l’ufficio addetto alle vendite
  • Software di prova

MathWorks

Accelerating the pace of engineering and science

MathWorks è leader nello sviluppo di software per il calcolo matematico per ingegneri e ricercatori

Scopri…

Scopri i nostri prodotti

  • MATLAB
  • Simulink
  • Software per studenti​
  • Supporto hardware
  • File Exchange

Prova o Acquista

  • Download
  • Software di prova
  • Contattaci
  • Prezzi e licenze
  • Come acquistare

Impara ad utilizzare i nostri prodotti

  • Documentazione
  • Tutorial
  • Esempi
  • Video e Webinar
  • Formazione

Ricevi supporto tecnico

  • Aiuto all'installazione
  • MATLAB Answers
  • Consulenza
  • License Center
  • Contatta l'assistenza

Informazioni su MathWorks

  • Lavora con noi
  • Sala stampa
  • Missione sociale​
  • Casi dei clienti
  • Informazioni su MathWorks
  • Select a Web Site United States
  • Centro di fiducia
  • Marchi
  • Informativa sulla privacy
  • Antipirateria
  • Stato dell'applicazione

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Unisciti alla discussione