How to do it...

Go through the following steps:

  1. Import the modules:
import cv2import numpy as np
  1. Load a Caffe model:
net_caffe = cv2.dnn.readNetFromCaffe('../data/bvlc_googlenet.prototxt',                                      '../data/bvlc_googlenet.caffemodel')
  1. Load a model from Torch:
net_torch = cv2.dnn.readNetFromTorch('../data/torch_enet_model.net')
  1. Read and parse a TensorFlow trained model:
net_tensorflow = cv2.dnn.readNetFromTensorflow('../data/tensorflow_inception_graph.pb')

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.