Skip to Content
OpenCV 4 with Python Blueprints - Second Edition
book

OpenCV 4 with Python Blueprints - Second Edition

by Dr. Menua Gevorgyan, Michael Beyeler (USD), Arsen Mamikonyan, Michael Beyeler
March 2020
Intermediate to advanced
366 pages
9h 8m
English
Packt Publishing
Content preview from OpenCV 4 with Python Blueprints - Second Edition

Preparing the pet type and breed classifier

As we are going to use the features as they are, let's first freeze the weights of the network layers so that they don't update during the training process:

for layer in base_model.layers:    layer.trainable = False

In general, each location of an activation map specifies whether there is a feature of the corresponding type in that location. As we work on the last layers of the network, we can suppose that different locations on the activation map contain similar information and reduce the dimensionality of our features by averaging the activation maps:

x = K.layers.GlobalAveragePooling2D()(base_model.output)

The operation is called AveragePooling2Dwe pool the average of the tensor in two dimensions ...

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

OpenCV with Python Blueprints

OpenCV with Python Blueprints

Michael Beyeler, Michael Beyeler (USD)
OpenCV 3 Computer Vision with Python Cookbook

OpenCV 3 Computer Vision with Python Cookbook

Aleksei Spizhevoi, Aleksandr Rybnikov
Mastering OpenCV 4 with Python

Mastering OpenCV 4 with Python

Alberto Fernández Villán

Publisher Resources

ISBN: 9781789801811Supplemental Content