Skip to Content
Python Deep Learning - Second Edition
book

Python Deep Learning - Second Edition

by Ivan Vasilev, Daniel Slater, Gianmario Spacagna, Peter Roelants, Valentino Zocca
January 2019
Intermediate to advanced
386 pages
11h 13m
English
Packt Publishing
Content preview from Python Deep Learning - Second Edition

A code example of YOLOv3 with OpenCV

In this section, we'll demonstrate how to use the YOLOv3 object detector with OpenCV. For this example, you'll need OpenCV 3.4.2 or higher, and 250 MB of disk space for the pre-trained YOLO network. Let's begin with the following steps:

  1. Start with the imports:
import os.pathimport cv2  # opencv importimport numpy as npimport requests
  1. Add some boilerplate code, which downloads and stores the following:
    • The YOLOv3 network configuration. We'll use the YOLO author's GitHub and personal website to do this.
    • The names of the classes that the network can detect. We'll also load them from the file.
    • A test image from Wikipedia. We'll also load the image from the file:
# Download YOLO net config file# We'll ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Deep Learning

Python Deep Learning

Valentino Zocca, Gianmario Spacagna, Daniel Slater, Peter Roelants

Publisher Resources

ISBN: 9781789348460Supplemental Content