Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi

Overview

Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi

Update 10/13/19: Setting up the TensorFlow Object Detection API on the Pi is much easier now! Two major updates: 1) TensorFlow can be installed simply using "pip3 install tensorflow". 2) The protobuf compiler (protoc) can be installed using "sudo apt-get protobuf-compiler. I have updated Step 3 and Step 4 to reflect these changes.

Bonus: I made a Pet Detector program (Pet_detector.py) that sends me a text when it detects when my cat wants to be let outside! It runs on the Raspberry Pi and uses the TensorFlow Object Detection API. You can use the code as an example for your own object detection applications. More info is available at the bottom of this readme.

Introduction

This guide provides step-by-step instructions for how to set up TensorFlow’s Object Detection API on the Raspberry Pi. By following the steps in this guide, you will be able to use your Raspberry Pi to perform object detection on live video feeds from a Picamera or USB webcam. Combine this guide with my tutorial on how to train your own neural network to identify specific objects, and you use your Pi for unique detection applications such as:

Here's a YouTube video I made that walks through this guide!

Link to my YouTube video!

The guide walks through the following steps:

  1. Update the Raspberry Pi
  2. Install TensorFlow
  3. Install OpenCV
  4. Compile and install Protobuf
  5. Set up TensorFlow directory structure and the PYTHONPATH variable
  6. Detect objects!
  7. Bonus: Pet detector!

The repository also includes the Object_detection_picamera.py script, which is a Python script that loads an object detection model in TensorFlow and uses it to detect objects in a Picamera video feed. The guide was written for TensorFlow v1.8.0 on a Raspberry Pi Model 3B running Raspbian Stretch v9. It will likely work for newer versions of TensorFlow.

Steps

1. Update the Raspberry Pi

First, the Raspberry Pi needs to be fully updated. Open a terminal and issue:

sudo apt-get update
sudo apt-get dist-upgrade

Depending on how long it’s been since you’ve updated your Pi, the upgrade could take anywhere between a minute and an hour.

2. Install TensorFlow

Update 10/13/19: Changed instructions to just use "pip3 install tensorflow" rather than getting it from lhelontra's repository. The old instructions have been moved to this guide's appendix.

Next, we’ll install TensorFlow. The download is rather large (over 100MB), so it may take a while. Issue the following command:

pip3 install tensorflow

TensorFlow also needs the LibAtlas package. Install it by issuing the following command. (If this command doesn't work, issue "sudo apt-get update" and then try again).

sudo apt-get install libatlas-base-dev

While we’re at it, let’s install other dependencies that will be used by the TensorFlow Object Detection API. These are listed on the installation instructions in TensorFlow’s Object Detection GitHub repository. Issue:

sudo pip3 install pillow lxml jupyter matplotlib cython
sudo apt-get install python-tk

Alright, that’s everything we need for TensorFlow! Next up: OpenCV.

3. Install OpenCV

TensorFlow’s object detection examples typically use matplotlib to display images, but I prefer to use OpenCV because it’s easier to work with and less error prone. The object detection scripts in this guide’s GitHub repository use OpenCV. So, we need to install OpenCV.

To get OpenCV working on the Raspberry Pi, there’s quite a few dependencies that need to be installed through apt-get. If any of the following commands don’t work, issue “sudo apt-get update” and then try again. Issue:

sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install qt4-dev-tools libatlas-base-dev

Now that we’ve got all those installed, we can install OpenCV. Issue:

sudo pip3 install opencv-python

Alright, now OpenCV is installed!

4. Compile and Install Protobuf

The TensorFlow object detection API uses Protobuf, a package that implements Google’s Protocol Buffer data format. You used to need to compile this from source, but now it's an easy install! I moved the old instructions for compiling and installing it from source to the appendix of this guide.

sudo apt-get install protobuf-compiler

Run protoc --version once that's done to verify it is installed. You should get a response of libprotoc 3.6.1 or similar.

5. Set up TensorFlow Directory Structure and PYTHONPATH Variable

Now that we’ve installed all the packages, we need to set up the TensorFlow directory. Move back to your home directory, then make a directory called “tensorflow1”, and cd into it.

mkdir tensorflow1
cd tensorflow1

Download the tensorflow repository from GitHub by issuing:

git clone --depth 1 https://github.com/tensorflow/models.git

Next, we need to modify the PYTHONPATH environment variable to point at some directories inside the TensorFlow repository we just downloaded. We want PYTHONPATH to be set every time we open a terminal, so we have to modify the .bashrc file. Open it by issuing:

sudo nano ~/.bashrc

Move to the end of the file, and on the last line, add:

export PYTHONPATH=$PYTHONPATH:/home/pi/tensorflow1/models/research:/home/pi/tensorflow1/models/research/slim

Then, save and exit the file. This makes it so the “export PYTHONPATH” command is called every time you open a new terminal, so the PYTHONPATH variable will always be set appropriately. Close and then re-open the terminal.

Now, we need to use Protoc to compile the Protocol Buffer (.proto) files used by the Object Detection API. The .proto files are located in /research/object_detection/protos, but we need to execute the command from the /research directory. Issue:

cd /home/pi/tensorflow1/models/research
protoc object_detection/protos/*.proto --python_out=.

This command converts all the "name".proto files to "name_pb2".py files. Next, move into the object_detection directory:

cd /home/pi/tensorflow1/models/research/object_detection

Now, we’ll download the SSD_Lite model from the TensorFlow detection model zoo. The model zoo is Google’s collection of pre-trained object detection models that have various levels of speed and accuracy. The Raspberry Pi has a weak processor, so we need to use a model that takes less processing power. Though the model will run faster, it comes at a tradeoff of having lower accuracy. For this tutorial, we’ll use SSDLite-MobileNet, which is the fastest model available.

Google is continuously releasing models with improved speed and performance, so check back at the model zoo often to see if there are any better models.

Download the SSDLite-MobileNet model and unpack it by issuing:

wget http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz
tar -xzvf ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz

Now the model is in the object_detection directory and ready to be used.

6. Detect Objects!

Okay, now everything is set up for performing object detection on the Pi! The Python script in this repository, Object_detection_picamera.py, detects objects in live feeds from a Picamera or USB webcam. Basically, the script sets paths to the model and label map, loads the model into memory, initializes the Picamera, and then begins performing object detection on each video frame from the Picamera.

If you’re using a Picamera, make sure it is enabled in the Raspberry Pi configuration menu.

Download the Object_detection_picamera.py file into the object_detection directory by issuing:

wget https://raw.githubusercontent.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/master/Object_detection_picamera.py

Run the script by issuing:

python3 Object_detection_picamera.py 

The script defaults to using an attached Picamera. If you have a USB webcam instead, add --usbcam to the end of the command:

python3 Object_detection_picamera.py --usbcam

Once the script initializes (which can take up to 30 seconds), you will see a window showing a live view from your camera. Common objects inside the view will be identified and have a rectangle drawn around them.

With the SSDLite model, the Raspberry Pi 3 performs fairly well, achieving a frame rate higher than 1FPS. This is fast enough for most real-time object detection applications.

You can also use a model you trained yourself (here's a guide that shows you how to train your own model) by adding the frozen inference graph into the object_detection directory and changing the model path in the script. You can test this out using my playing card detector model (transferred from ssd_mobilenet_v2 model and trained on TensorFlow v1.5) located at this dropbox link. Once you’ve downloaded and extracted the model, or if you have your own model, place the model folder into the object_detection directory. Place the label_map.pbtxt file into the object_detection/data directory.

Then, open the Object_detection_picamera.py script in a text editor. Go to the line where MODEL_NAME is set and change the string to match the name of the new model folder. Then, on the line where PATH_TO_LABELS is set, change the name of the labelmap file to match the new label map. Change the NUM_CLASSES variable to the number of classes your model can identify.

Now, when you run the script, it will use your model rather than the SSDLite_MobileNet model. If you’re using my model, it will detect and identify any playing cards dealt in front of the camera.

Note: If you plan to run this on the Pi for extended periods of time (greater than 5 minutes), make sure to have a heatsink installed on the Pi's main CPU! All the processing causes the CPU to run hot. Without a heatsink, it will shut down due to high temperature.

Thanks for following through this guide, I hope you found it useful. Good luck with your object detection applications on the Raspberry Pi!

Bonus: Pet Detector!

Description

The Pet_detector.py script is an example application of using object detection on the API to alert users when a certain object is detected. I have two indoor-outdoor pets at my parents' home: a cat and a dog. They frequently stand at the door and wait patiently to be let inside or outside. This pet detector uses the TensorFlow MobileNet-SSD model to detect when they are near the door. It defines two regions in the image, an "inside" region and an "outside" region. If the pet is detected in either region for at least 10 consecutive frames, the script uses Twilio to send my phone a text message.

Here's a YouTube video demonstrating the pet detector and explaining how it works!

Link to my YouTube video!

Usage

Run the pet detector by downloading Pet_detector.py to your /object_detection directory and issuing:

python3 Pet_detector.py

Using the Pet_detector.py program requires having a Twilio account set up (see tutorial here). It also uses four environment variables that have to be set before running the program: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, MY_DIGITS, and TWILIO_DIGITS. These can be set using the "export" command, as shown below. More information on setting environment variables for Twilio is given here.

export TWILIO_ACCOUNT_SID=[sid_value]
export TWILIO_AUTH_TOKEN=[auth_token]
export MY_DIGITS=[your cell phone number]
export TWILIO_DIGITS=[phone number of the Twilio account]

The sid_value, auth_token, and phone number of the Twilio account values are all provided when a Twilio account is set up.

If you don't want to bother with setting up Twilio so the pet detector can send you texts, you can just comment out the lines in the code that use the Twilio library. The detector will still display a message on the screen when your pet wants inside or outside.

Also, you can move the locations of the "inside" and "outside" boxes by adjusting the TL_inside, BR_inside, TL_outside, and BR_outside variables.

Appendix

Old instructions for installing TensorFlow

These instructions show how to install TensorFlow using lhelontra's repository. They were replaced in my 10/13/19 update of this guide. I am keeping them here, because these are the instructions used in my video.

In the /home/pi directory, create a folder called ‘tf’, which will be used to hold all the installation files for TensorFlow and Protobuf, and cd into it:

mkdir tf
cd tf

A pre-built, Rapsberry Pi-compatible wheel file for installing the latest version of TensorFlow is available in the “TensorFlow for ARM” GitHub repository. GitHub user lhelontra updates the repository with pre-compiled installation packages each time a new TensorFlow is released. Thanks lhelontra! Download the wheel file by issuing:

wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.8.0/tensorflow-1.8.0-cp35-none-linux_armv7l.whl

At the time this tutorial was written, the most recent version of TensorFlow was version 1.8.0. If a more recent version is available on the repository, you can download it rather than version 1.8.0.

Alternatively, if the owner of the GitHub repository stops releasing new builds, or if you want some experience compiling Python packages from source code, you can check out my video guide: How to Install TensorFlow from Source on the Raspberry Pi, which shows you how to build and install TensorFlow from source on the Raspberry Pi.

Link to TensorFlow installation video!

Now that we’ve got the file, install TensorFlow by issuing:

sudo pip3 install /home/pi/tf/tensorflow-1.8.0-cp35-none-linux_armv7l.whl

TensorFlow also needs the LibAtlas package. Install it by issuing (if this command doesn't work, issue "sudo apt-get update" and then try again):

sudo apt-get install libatlas-base-dev

While we’re at it, let’s install other dependencies that will be used by the TensorFlow Object Detection API. These are listed on the installation instructions in TensorFlow’s Object Detection GitHub repository. Issue:

sudo pip3 install pillow lxml jupyter matplotlib cython
sudo apt-get install python-tk

TensorFlow is now installed and ready to go!

Old instructions for compiling and installing Protobuf from source

These are the old instructions from Step 4 showing how to compile and install Protobuf from source. These were replaced in the 10/13/19 update of this guide.

The TensorFlow object detection API uses Protobuf, a package that implements Google’s Protocol Buffer data format. Unfortunately, there’s currently no easy way to install Protobuf on the Raspberry Pi. We have to compile it from source ourselves and then install it. Fortunately, a guide has already been written on how to compile and install Protobuf on the Pi. Thanks OSDevLab for writing the guide!

First, get the packages needed to compile Protobuf from source. Issue:

sudo apt-get install autoconf automake libtool curl

Then download the protobuf release from its GitHub repository by issuing:

wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-all-3.5.1.tar.gz

If a more recent version of protobuf is available, download that instead. Unpack the file and cd into the folder:

tar -zxvf protobuf-all-3.5.1.tar.gz
cd protobuf-3.5.1

Configure the build by issuing the following command (it takes about 2 minutes):

./configure

Build the package by issuing:

make

The build process took 61 minutes on my Raspberry Pi. When it’s finished, issue:

make check 

This process takes even longer, clocking in at 107 minutes on my Pi. According to other guides I’ve seen, this command may exit out with errors, but Protobuf will still work. If you see errors, you can ignore them for now. Now that it’s built, install it by issuing:

sudo make install

Then move into the python directory and export the library path:

cd python
export LD_LIBRARY_PATH=../src/.libs

Next, issue:

python3 setup.py build --cpp_implementation 
python3 setup.py test --cpp_implementation
sudo python3 setup.py install --cpp_implementation

Then issue the following path commands:

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=3

Finally, issue:

sudo ldconfig

That’s it! Now Protobuf is installed on the Pi. Verify it’s installed correctly by issuing the command below and making sure it puts out the default help text.

protoc

For some reason, the Raspberry Pi needs to be restarted after this process, or TensorFlow will not work. Go ahead and reboot the Pi by issuing:

sudo reboot now

Protobuf should now be installed!

Comments
  • ImportError: libImath-2_2.so.12: cannot open shared object file: No such file or directory

    ImportError: libImath-2_2.so.12: cannot open shared object file: No such file or directory

    Heya I'm trying to run the command "python3 Object_detection_picamera.py " and I keep getting the this stack being returned:

    Traceback (most recent call last):
      File "Object_detection_picamera.py", line 23, in <module>
        import cv2
      File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 3, in <module>
        from .cv2 import *
    ImportError: libImath-2_2.so.12: cannot open shared object file: No such file or directory
    
    

    I have followed all the instructions and just wondering what is the problem - have I missed something or is there something else that I need to install?

    Thank you

    Osian

    opened by osianSmith 13
  •  File error">

    File "Object_detection_picamera.py", line 137, in error

    pi@raspberrypi:~/tensorflow1/models/research/object_detection $ python3 Object_detection_picamera.py
    Traceback (most recent call last):
      File "Object_detection_picamera.py", line 137, in <module>
        frame.setflags(write=1)
    ValueError: cannot set WRITEABLE flag to True of this array
    
    help wanted 
    opened by VictorTagayun 11
  • Help wanted: Avoid having to clone ENTIRE tensorflow/models repository

    Help wanted: Avoid having to clone ENTIRE tensorflow/models repository

    When I originally wrote this guide, the tensorflow/models repository (https://github.com/tensorflow/models) was much smaller than it is today. The git clone --recurse-submodules https://github.com/tensorflow/models.git command in Step 5 downloaded about 200MB worth of data. Today, it's a 900MB download! The download takes too long for people who have poor internet connections.

    Is there a way around downloading the full tensorflow/models repository? We can't only download the object_detection folder, because the Object Detection API uses files from the models/research and models/research/slim directories. It probably uses files from other places in the repository, too (I haven't checked to see all the modules the API uses).

    I know I can just use TensorFlow Lite. I'm already working on a guide showing how to set up TensorFlow Lite on the Pi. However, I'd like to find a less data-hungry way to get the regular TensorFlow Object Detection API downloaded on the Pi.

    How can we get the TensorFlow Object Detection API working without downloading the full tensorflow/models repository?

    help wanted 
    opened by EdjeElectronics 4
  • OpenCV install fails

    OpenCV install fails

    (This is my first post, so please let me know if I should be following some other protocol. Thanks.)

    While following the guide (Many thanks for putting this guide together, BTW), I get the following error on the "pip3 install opencv-python" command:

    Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

    Any suggestions as to a solution?

    opened by technotrope 4
  • BGR or RGB?

    BGR or RGB?

    Thank you for the great tutorial! I have a question: your code gets the image in BGR (for both the picamera and USB). I thought that the tensorflow pre-built models expect RGB.

    Don't you need to convert (e.g. frame= frame[:, :, [2, 1, 0]]) ?

    opened by rafitzadik 4
  • Slower inference time on modified models

    Slower inference time on modified models

    I trained 2 different models on top of the ssdlite_mobilenet_v2_coco from the tensorflow object api model zoo, but I get different speeds on each model when running on the Raspberry Pi 3:

    ssdlite_mobilenet_v2_coco (90 classes) = 1.3 fps retrained_ssdlite_1 (2 classes) = 0.7 fps retrained_ssdlite_2 (3 classes) = 0.8 fps

    My trained models are experimenting an drop of almost half the speed of the original model

    Is anybody having the same issue? Am I missing some step to make the model efficient at inference time?

    opened by eduagarcia 4
  • cat-pet detector.py error: frame.setFlags

    cat-pet detector.py error: frame.setFlags

    i wanted to try cat-detection, (object-detection already running fine) disabled twilio in the script, but got this error:

    root@raspimax7219:/usr/src/tensorflow1/models/research/object_detection# python3 Pet_detector.py
    Traceback (most recent call last):
      File "Pet_detector.py", line 275, in <module>
        frame.setflags(write=1)
    ValueError: cannot set WRITEABLE flag to True of this array
    root@raspimax7219:/usr/src/tensorflow1/models/research/object_detection#
    

    may you can help me out, shorthand? dont understand the array-constrution...but you? what to do here?

    thanks, tozett

    opened by ozett 3
  • ImportError: libvtkInteractionStyle-6.3.so.6.3: cannot open shared object file: No such file or directory

    ImportError: libvtkInteractionStyle-6.3.so.6.3: cannot open shared object file: No such file or directory

    Hi! I am getting the following error when I try to run step 6:

    ImportError: libvtkInteractionStyle-6.3.so.6.3: cannot open shared object file: No such file or directory

    Any idea how to resolve this? Thanks!

    opened by rdoebler 3
  • Step 6: python3 Object_detection_picamera.py

    Step 6: python3 Object_detection_picamera.py

    Please note I followed the tutorial step by step apart from ignoring step 3 'git checkout v1.8.0', it resulted to deletion of previously downloaded files as highlighted in issue 1. Again very grateful to your efforts @EdjeElectronics . Running the command 'python3 Object_detection_picamera.py ' generated the following error. image What would be the best foot forward? Thanks

    Some notes: (Not sure if relevant) On checking the files (not sure if what I didnt was correct) i noticed there is no file with 'string_int_label_map_pb2' but found 'string_int_label_map.proto'.

    opened by otieno-o 3
  • "pip3 install opencv-python" is failed

    It's strange. The "pip3 install opencv-python" command generates a error message as following:

    pi@raspberrypi:~ $
    pi@raspberrypi:~ $ pip3 install opencv-python
    Traceback (most recent call last):
      File "/usr/bin/pip3", line 9, in <module>
        from pip import main
    ImportError: cannot import name 'main'
    pi@raspberrypi:~ $
    
    
    • System environment
    
    pi@raspberrypi:~ $ cat /etc/debian_version
    9.8
    pi@raspberrypi:~ $ cat /etc/*release*
    PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
    pi@raspberrypi:~ $
    
    
    opened by leemgs 2
  • " sudo pip3 install jupyter" command is failed on Raspbian OS

    When I ran " sudo pip3 install jupyter" command, I had got the below error message.

    • System environment
    
    pi@raspberrypi:~ $ cat /etc/debian_version
    9.8
    pi@raspberrypi:~ $ cat /etc/*release*
    PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
    pi@raspberrypi:~ $
    
    
    
    • Log message:
    
     . . . OMISSION . . . 
    Collecting nbformat>=4.4 (from nbconvert->jupyter)
      Using cached https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl
    Collecting jupyter-core (from nbconvert->jupyter)
      Downloading https://files.pythonhosted.org/packages/1d/44/065d2d7bae7bebc06f1dd70d23c36da8c50c0f08b4236716743d706762a8/jupyter_core-4.4.0-py2.py3-none-any.whl (126kB)
        100% |################################| 133kB 236kB/s
    Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)
    Exception:
    Traceback (most recent call last):
      File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
        chunked=chunked)
      File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
        six.raise_from(e, None)
      File "<string>", line 2, in raise_from
      File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
        httplib_response = conn.getresponse()
      File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
        response.begin()
      File "/usr/lib/python3.5/http/client.py", line 297, in begin
        version, status, reason = self._read_status()
      File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
        raise RemoteDisconnected("Remote end closed connection without"
    http.client.RemoteDisconnected: Remote end closed connection without response
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
        wb.build(autobuilding=True)
      File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
        self.requirement_set.prepare_files(self.finder)
      File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
        ignore_dependencies=self.ignore_dependencies))
      File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
        require_hashes
      File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
        self.link = finder.find_requirement(self, upgrade)
      File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
        all_candidates = self.find_all_candidates(req.name)
      File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
        for page in self._get_pages(url_locations, project_name):
      File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
        page = self._get_page(location)
      File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
        return HTMLPage.get_page(link, session=self.session)
      File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
        "Cache-Control": "max-age=600",
      File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
        return self.request('GET', url, **kwargs)
      File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
        return super(PipSession, self).request(method, url, *args, **kwargs)
      File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
        resp = self.send(prep, **send_kwargs)
      File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
        r = adapter.send(request, **kwargs)
      File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
        resp = super(CacheControlAdapter, self).send(request, **kw)
      File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
        timeout=timeout
      File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
        _stacktrace=sys.exc_info()[2])
      File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
        total -= 1
    TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
    pi@raspberrypi:~ $
    
    
    opened by leemgs 2
  • OpenCV `ImportError: libIlmImf-2_2.so.23: cannot open shared object file: No such file or directory` error

    OpenCV `ImportError: libIlmImf-2_2.so.23: cannot open shared object file: No such file or directory` error

    ImportError: libIlmImf-2_2.so.23: cannot open shared object file: No such file or directory

    Hello,

    I am using python3.7 Raspberry Pi 3 B+ and I an trying install opencv to start a project that is a Self-Driving Robotic Car by Use of Computer Vision. The only library I am having trouble with is OpenCV. I first attempt sudo apt-get install python3-opencv. It worked. However, I need it for python3.7. It installs to python 3.9. I then remove it and try pip3.7 install opencv-python. That didn't work. For some reason the version 4.5.5.62 is not installing. So, I was specific by typing pip3.7 install opencv-python==4.5.3.56 because I read it is compatible with python 3.7. This version installs; however, I recieved the following message:

    (driving_cv) pi@raspberrypi:~ $ python3
    Python 3.7.4 (default, Jan 29 2022, 23:25:05) 
    [GCC 10.2.1 20210110] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cv2
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/pi/.local/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
        from .cv2 import *
    ImportError: libIlmImf-2_2.so.23: cannot open shared object file: No such file or directory
    >>> 
    

    I did some research and read I should try the follow command. sudo apt install libopenexr23. However, when executing, it says to replace with libopenexr25 which I do. I recheck python3.7 -c "import cv2" again and get the same error.

    Can someoneassist with this issue, please?

    opened by MWimbish1988 1
  • How to detect a perticular object in Object Detection model

    How to detect a perticular object in Object Detection model

    I am using the TFLite detection webcam script in which I need to detect a particular object. Can someone help me with the process of doing so?

    I want to detect only person and potted plants in the detection model.

    Thank you in advance !!

    opened by gauti-22 0
  • Trying to install OpenCV, but sudo apt-get update doesn't help.

    Trying to install OpenCV, but sudo apt-get update doesn't help.

    Hi,

    Really want this tutorial to work. I am unable to install OpenCV. When running sudo apt-get install qt4-dev-tools libatlas-base-dev and sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev, I get an error where I am unable to fetch some archives. It tells me to do the sudo apt-get update, but it doesn't help.

    What do I do?

    opened by gabriel-bronfman 0
  • 2 cameras

    2 cameras

    Hi, For the Pet Detector!, would it be possible to change the code to run on a RPi camera for inside and USB camera for outside. My problem is that I have a solid wooden door, so I cannot see outside with only one camera connected. Or maybe use a Camera Scheduler, any idea on how to do this please https://www.waveshare.com/wiki/Camera_Scheduler

    opened by man4567890 0
Owner
Evan
Hardware engineer and computer vision specialist!
Evan
Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR 2022)

Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR2022)[paper] Authors: Chenhang He, Ruihuang Li, Shuai Li, L

Billy HE 141 Dec 30, 2022
Automatically download the cwru data set, and then divide it into training data set and test data set

Automatically download the cwru data set, and then divide it into training data set and test data set.自动下载cwru数据集,然后分训练数据集和测试数据集

null 6 Jun 27, 2022
This repository is related to an Arabic tutorial, within the tutorial we discuss the common data structure and algorithms and their worst and best case for each, then implement the code using Python.

Data Structure and Algorithms with Python This repository is related to the Arabic tutorial here, within the tutorial we discuss the common data struc

Mohamed Ayman 33 Dec 2, 2022
MohammadReza Sharifi 27 Dec 13, 2022
Run object detection model on the Raspberry Pi

Using TensorFlow Lite with Python is great for embedded devices based on Linux, such as Raspberry Pi.

Dimitri Yanovsky 6 Oct 8, 2022
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022
Tensorflow 2 Object Detection API kurulumu, GPU desteği, custom model hazırlama

Tensorflow 2 Object Detection API Bu tutorial, TensorFlow 2.x'in kararlı sürümü olan TensorFlow 2.3'ye yöneliktir. Bu, görüntülerde / videoda nesne a

null 46 Nov 20, 2022
Using Tensorflow Object Detection API to detect Waymo open dataset

Waymo-2D-Object-Detection Using Tensorflow Object Detection API to detect Waymo open dataset Result CenterNet Training Loss SSD ResNet Training Loss C

null 76 Dec 12, 2022
Rethinking Transformer-based Set Prediction for Object Detection

Rethinking Transformer-based Set Prediction for Object Detection Here are the code for the ICCV paper. The code is adapted from Detectron2 and AdelaiD

Zhiqing Sun 62 Dec 3, 2022
Official code of the paper "Expanding Low-Density Latent Regions for Open-Set Object Detection" (CVPR 2022)

OpenDet Expanding Low-Density Latent Regions for Open-Set Object Detection (CVPR2022) Jiaming Han, Yuqiang Ren, Jian Ding, Xingjia Pan, Ke Yan, Gui-So

csuhan 64 Jan 7, 2023
This is our ARTS test set, an enriched test set to probe Aspect Robustness of ABSA.

This is the repository for our 2020 paper "Tasty Burgers, Soggy Fries: Probing Aspect Robustness in Aspect-Based Sentiment Analysis". Data We provide

null 35 Nov 16, 2022
Open-Set Recognition: A Good Closed-Set Classifier is All You Need

Open-Set Recognition: A Good Closed-Set Classifier is All You Need Code for our paper: "Open-Set Recognition: A Good Closed-Set Classifier is All You

null 194 Jan 3, 2023
Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of images as "pixels"

picinpics Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of

RodrigoCMoraes 1 Oct 24, 2021
Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera.

Tools to create pixel-wise object masks, bounding box labels (2D and 3D) and 3D object model (PLY triangle mesh) for object sequences filmed with an RGB-D camera. This project prepares training and testing data for various deep learning projects such as 6D object pose estimation projects singleshotpose, as well as object detection and instance segmentation projects.

null 305 Dec 16, 2022
Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

Mask R-CNN for Object Detection and Segmentation This is an implementation of Mask R-CNN on Python 3, Keras, and TensorFlow. The model generates bound

Matterport, Inc 22.5k Jan 4, 2023
Tensorflow 2.x implementation of Panoramic BlitzNet for object detection and semantic segmentation on indoor panoramic images.

Deep neural network for object detection and semantic segmentation on indoor panoramic images. The implementation is based on the papers:

Alejandro de Nova Guerrero 9 Nov 24, 2022