Converting a NumPy image to a C-byte array
Our application will be running on a virtual platform with no access to a camera module. Therefore, we need to supply a valid test input image into our application to check whether the model works as expected.
In this recipe, we will get an image from the test dataset that must return a correct classification for the ship
class. The sample will then be converted to an int8_t
C array and saved as an input.h
file.
The following Colab file (refer to the Converting a NumPy image to a C-byte array section) contains the code referred to in this recipe:
prepare_model.ipynb
:
Getting ready
To get ready for this recipe, we just need to know how to prepare the C file containing the input test image. The structure of this file is quite simple and reported in the following figure: