March 2020
Intermediate to advanced
366 pages
9h 8m
English
Our inference script is quite simple. It will first prepare a drawing function, then load the model and connect it to the camera. Then, it will loop over the frames from the video stream. In the loop, for each frame of the stream, it will use the imported model to make an inference and the drawing function to display the results. Let's create a complete script using the following steps:
import numpy as npimport cv2import tensorflow.keras as K
In this code, besides importing NumPy and OpenCV, we have also imported Keras. We are going to use Keras to make predictions in this script; additionally, we will use it to create and train our models throughout the chapter.