furthermore, this API for using pre-trained deep learning models is compatible with both the C++ API and the python bindings, making it dead simple to:
(1)load a model from disk
(2)pre-process an input image
(3)pass the image through the network and obtain the output classifications
in the remainder of this blog post i'll demonstrate the fundamentals of how to take a pre-trained deep learning network on the ImageNet dataset and apply it to input images
we'll then write a python script that will use opencv and GoogleLeNet (pre-trained on ImageNet) to classify images
with opencv3.3, we can utilize pre-trained networks with popular deep learning frameworks. the fact that they are pre-trained implies that we don't need to spend many hours training the network--rather we can complete a forward pass and utilize the output to make a decision within our application
since a network (such as a CNN) can be used as a classifier, it makes logical sense that OpenCV has a deep learning module that we can leverage easily within the opencv ecosystem
popular network architectures compatible with Opencv3.3 include:
(1)GoogleLeNet
(2)AlexNet
(3)SqueezeNet
(4)VGGNet
(5)ResNet
using opencv3.3 we can load images from disk using the following functions inside dnn:
(1)cv2.dnn.blobFromImage
(2)cv2.dnn.blobFromImages
we can directly import models from various frameworks via the create methods:
(1)cv2.dnn.createCaffeImporter
(2)cv2.dnn.createTensorFlowImporter
(3)cv2.dnn.createTorchImporter
i thick it's easier to simply use the read methods and load a serialized model from disk directly:
(1)cv2.dnn.readNetFromCaffe
(2)cv2.dnn.readNetFromTensorFlow
(3)cv2.dnn.readNetFromTorch
(4)cv2.dnn.readTorchBlob
once we have loaded a model from disk, the .forward method is used to forward-propagate our image and obtain the actual classification
the GoogleLeNet architecture (now known as "inception" after the novel micro-architecture) Going deeper with convolutions (2014)
if you are familiar with Caffe, you;ll recognize the prototxt file as a plain text configuration which follows a JSON-like structure
(1)load a model from disk
(2)pre-process an input image
(3)pass the image through the network and obtain the output classifications
in the remainder of this blog post i'll demonstrate the fundamentals of how to take a pre-trained deep learning network on the ImageNet dataset and apply it to input images
we'll then write a python script that will use opencv and GoogleLeNet (pre-trained on ImageNet) to classify images
with opencv3.3, we can utilize pre-trained networks with popular deep learning frameworks. the fact that they are pre-trained implies that we don't need to spend many hours training the network--rather we can complete a forward pass and utilize the output to make a decision within our application
since a network (such as a CNN) can be used as a classifier, it makes logical sense that OpenCV has a deep learning module that we can leverage easily within the opencv ecosystem
popular network architectures compatible with Opencv3.3 include:
(1)GoogleLeNet
(2)AlexNet
(3)SqueezeNet
(4)VGGNet
(5)ResNet
using opencv3.3 we can load images from disk using the following functions inside dnn:
(1)cv2.dnn.blobFromImage
(2)cv2.dnn.blobFromImages
we can directly import models from various frameworks via the create methods:
(1)cv2.dnn.createCaffeImporter
(2)cv2.dnn.createTensorFlowImporter
(3)cv2.dnn.createTorchImporter
i thick it's easier to simply use the read methods and load a serialized model from disk directly:
(1)cv2.dnn.readNetFromCaffe
(2)cv2.dnn.readNetFromTensorFlow
(3)cv2.dnn.readNetFromTorch
(4)cv2.dnn.readTorchBlob
once we have loaded a model from disk, the .forward method is used to forward-propagate our image and obtain the actual classification
the GoogleLeNet architecture (now known as "inception" after the novel micro-architecture) Going deeper with convolutions (2014)
if you are familiar with Caffe, you;ll recognize the prototxt file as a plain text configuration which follows a JSON-like structure