For testing, use a custom python tool for sending images to the board. The tool is provided by STMicroelectronics.
Return to your Anaconda Prompt, or start a new session and activate your environment for the lab.
conda activate ml_lab
Install necessary packages to run the tool.
python -m pip install -U opencv-python protobuf==3.20 tqdm==4.50.2
Navigate to the working folder, and then the Misc
folder. Execute the tool with:
python ui_python_ai_runner.py
If the board is not detected, click the black button on the board to reset, then click on Refresh NN and camera
.
X-CUBE-AI 7.0.0
. Later versions may not connect successfully.Select the model network from the list of models deployed on the board.
Select the network and the label file (Data/labels/cifar10_labels.txt
)
Open an image to test. The tool will automatically launch a new pane, and show the inference result.
Observe that the model correctly predicted the label. In addition, note the time taken to finish the prediction.
You can also use your workstation camera to test image classification. Hold an appropriate picture up to your camera, then press S
. The tool captures the image and sends it to the board.
You have now successfully ran the model on your STM32 board.