Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Advanced Computer Vision with TensorFlow/Week 2 - Object Detection/Copy of C3_W2_Lab_2_Object_Detection.ipynb
Views: 13370
Object Detection
This lab is similar to the previous lab, except now instead of printing out the bounding box coordinates, you can visualize these bounding boxes on top of the image!
Setup
Select and load the model
As in the previous lab, you can choose an object detection module. Here are two that we've selected for you:
ssd + mobilenet V2 small and fast.
FasterRCNN + InceptionResNet V2: high accuracy
Load the model
Next, you'll load the model specified by the module_handle
.
This will take a few minutes to load the model.
Choose the default signature
As before, you can check the available signatures using .signature.keys()
Please choose the 'default' signature for your object detector.
download_and_resize_image
As you saw in the previous lab, this function downloads an image specified by a given "url", pre-processes it, and then saves it to disk.
What new compared to the previous lab is that you an display the image if you set the parameter
display=True
.
Select and load an image
Load a public image from Open Images v4, save locally, and display.
Draw bounding boxes
To build on what you saw in the previous lab, you can now visualize the predicted bounding boxes, overlaid on top of the image.
You can use
draw_boxes
to do this. It will usedraw_bounding_box_on_image
to draw the bounding boxes.
run_detector
This function will take in the object detection model detector
and the path to a sample image, then use this model to detect objects.
This time, run_dtector also calls
draw_boxes
to draw the predicted bounding boxes.
Run the detector on your selected image!
Run the detector on more images
Perform inference on some additional images of your choice and check how long inference takes.