How to use Custom Vision Model in the Raspberry Pi 4 for Object Detection

Amogh Palasamudram 11 Reputation points
2021-01-25T05:30:30.377+00:00

I have created a computer vision model using Azure Custom Vision. I exported it by selecting the Tensorflow Lite option. I then deployed the model onto a Raspberry Pi 4 and adapted this program from Edje Electronics so my model could take inputs from a webcam’s live stream.

https://github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/TFLite_detection_webcam.py

However, when I run the program, I get the following error message: “IndexError: list index out of range” from the line: “ classes = interpreter.get_tensor(output_details[1][‘index’])[0] # Class index of detected objects”.

I searched online and found that the author of the Edje Electronics program said that this error occurs when the model is an image classifier, while the program is built for objection detection models.

However, the model I created in Azure Custom Vision can be used for object detection (I boxed the training images). When I exported the model, I found that it also gave me 2 python programs along with the model files: one to run objection detection and the other to run image classification. When I opened the object detection program, it said that the code for detecting objects was not implemented.

Now, I do not know how to use my Azure model for object detection in the Raspberry Pi with the Edje Electronics program I mentioned above.

I would really appreciate it if anyone could help me out.

Azure AI Custom Vision
Azure AI Custom Vision
An Azure artificial intelligence service and end-to-end platform for applying computer vision to specific domains.
220 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,183 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 46,986 Reputation points
    2021-01-26T18:54:21.503+00:00

    Hi Amogh,

    Thanks for reaching out to us. I think SO "Raspberry-pi" forum will be a better place for this question: https://stackoverflow.com/questions/tagged/raspberry-pi

    At the meantime, I am trying to reproduce your issue, will let you know.

    Regards,
    Yutong

    0 comments No comments