Image Classification with Raspberry Pi

I have problems with the tensorflow lite example for image classification for raspberry pi.
It doesn´t want to load the cv2 module.

Does anyone here have experience with Keras, tensorflow on raspberry pi with his own created dataset and can help me with my problem on deploying it on raspberry pi?

Thank you for your help.

I want to deploy a model on raspberry pi with my own created dataset.
I already failed to do the example with tensorflow lite somehow.
Is there somebody who did a image classification on raspi with tensorflow keras and can tell me what to do?

Were you able to resolve this issue?
Anyhow I present a solution that might help.
The open-cv package requires some additional packages when being installed in raspberry pi(I’m using model 4B).

pip3 install opencv-python 
sudo apt-get install libcblas-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev 
sudo apt-get install libqtgui4 
sudo apt-get install libqt4-testv
echo "deb coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl | sudo apt-key add -

Installing these dependencies would make cv2 work on your RPi.

Chances are you will face the same issue when using opencv for object detection using a Linux(I use Ubuntu 20.04 LTS) system where you will get an error like :-

cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

This can be resolved by following the steps:-

Dont install opencv-python, install from the source
To get over this error uninstall opencv-python and reinstall it using source following the tutorial below:

During the setup of opencv in the build in addition to the given configs also add -D WITH_QT=ON -D WITH_GTK=ON
This basically installs the GUI backend for running Opencv in Linux sytems
Hopefully it will start working fine after that

@ariG23498 could you ask Abhishek if he could provide any guidance on this? Asking this since he has extensive experience with OpenCV and TensorFlow especially for Pis.

1 Like