In the previous week, I successfully obtained the live webcam feed for the digit classifier exercise. My goal for this week was to create a working demo of the digit classifier that performs inference on a pre-trained ONNX model using the webcam feed. The file structure is as follows:

To achieve this, I placed the pre-trained model within the ‘python-template/ros2_humble’ folder, which gets copied to ‘/workspace/code’ within the Docker container. I developed the code for running the inference and placed it within the Code Editor component of the exercise.

I removed certain sections like encode/decode, which are meant to be included when the model is uploaded for the UI. However, in our case, we are placing the model within the exercise folder. Therefore, I initialized an ort_session with the input model itself. The test code is as follows:

I successfully obtained live inference of digit classification on the webcam feed. The result can be seen below: