-
Setup and Imports:
- You import required libraries like TensorFlow, TensorFlow Hub, and others for image processing and visualization.
-
Utility Functions:
download_and_resize_image: Downloads an image, resizes it, and saves it locally.display_image: Displays an image using Matplotlib.draw_bounding_box_on_imageanddraw_boxes: Functions for drawing bounding boxes around detected objects.
-
Object Detection:
- You load the Faster R-CNN object detection model using TensorFlow Hub.
- You download a sample image of a kangaroo and process it.
- The
run_detectorfunction handles model inference, outputs detected objects, and overlays bounding boxes with class names and scores.
This project demonstrates object detection using TensorFlow and TensorFlow Hub. The Faster R-CNN model pre-trained on the Open Images V4 dataset is used to detect objects in images. The project includes visualization of detected objects with bounding boxes and class labels.
- Model: Faster R-CNN (Open Images V4 + Inception ResNet V2)
- Framework: TensorFlow and TensorFlow Hub
- Utilities:
- Download and resize an image
- Visualize object detection results
- Annotate images with bounding boxes and class labels
- Python 3.6+
- TensorFlow 2.x
- TensorFlow Hub
- NumPy
- Matplotlib
- Pillow ository-folder>
- Install dependencies:
pip install tensorflow tensorflow-hub numpy matplotlib pillow
- Download or provide an image URL.
- Run the detection script:
python object_detection.py
A kangaroo image from Wikimedia Commons.
Objects detected in the image, annotated with bounding boxes and labels.