in

A Python scripts for detecting objects of any class in an image without knowing their label


Python TFLite scripts for detecting objects of any class in an image without knowing their label.

Image taken from the OpenCV AI Kit – Lite, make sure to check it out: https://www.kickstarter.com/projects/opencv/opencv-ai-kit-oak-depth-camera-4k-cv-edge-object-detection



⚠️
The object detector works better with images with few objects and it starts to fail in more complex scenes. The model is suitable for automatically labelling objects for custom object detection models.

  • OpenCV, imread-from-url and tensorflow or tflite_runtime. Also, pafy and youtube-dl are required for youtube video inference.
pip install -r requirements.txt
pip install pafy youtube-dl

For the tflite runtime, you can either use tensorflow(make sure it is version 2.6.0 or above) pip install tensorflow==2.6.0 or the TensorFlow Runtime binary

The original models was taken from Tensorflow Hub, download it, and place it in the models folder.

Use the following script to download the model:

python download_model.py

Use this other repository for detecting object in Tensorflow (recommended for computer with GPU): https://github.com/ibaiGorordo/Tensorflow-Mobile-Generic-Object-Localizer

  • Image inference:
python imageObjectDetection.py 
  • Webcam inference:
python webcamObjectDetection.py 
  • Video inference:
python videoObjectDetection.py

Generic object detector figures

Original video by Animist: https://youtu.be/uKyoV0uG9rQ

Cabybara detection

Capybara TFLite detection Original image: https://commons.wikimedia.org/wiki/File:Capybara_portrait.jpg

Coin detection

Coin TFLite detection Original image: https://commons.wikimedia.org/wiki/File:Japanese_Coins.jpg

Shoe detection

Shoe TFLite detection Original image: https://commons.wikimedia.org/wiki/File:Japanese_Coins.jpg

Spaceship detection

Spaceship TFLite detection Original image: https://en.wikipedia.org/wiki/Spacecraft#/media/File:SpaceX_Crew_Dragon_(More_cropped).jpg

Window detection

Window TFLite detection Original image: https://commons.wikimedia.org/wiki/File:Window_-_Paddington_-_London.JPG

And many more

GitHub

https://github.com/ibaiGorordo/TFLite-Mobile-Generic-Object-Localizer


Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

GIPHY App Key not set. Please check settings

Hybrid Work is Here to Stay, and Software Teams Need to Adapt

Install WordPress Using aaPanel (BT)