Original Source Here
So the first thing we have to do is load this image and process it to the expected format for the TensorFlow model.
Basically, we used OpenCV to load and do a couple of transformations on the raw image to an RGB tensor in the model format.
Now we can load the model and the labels:
The model is being loaded directly from the website however, you can download it to your computer for better performance on the loading. The text labels CSV is available on the project repo.
Now we can create the predictions and put in the image the boxes and labels found:
Now if we run plt.imshow(img_boxes) we get the following output:
Live Webcam Video
Now we can move on to detecting objects live using the webcam on your pc.
This part is not as hard as it seems, we just have to insert the code we used for one image in a loop:
Then we get:
We used VideoCapture from open cv to load the video from the computer webcam. Then we did the same processing that we used on the static image and predicted the labels and positions. The main difference is that the image input is continuous so we inserted the code inside a while loop.
All the code and notebooks used are in this repository:
In the near future, I will load this into a raspberry pi to create some interactions using a model capable of detecting objects, and post the results here.
Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot