Question: Obtain the model predictions on the test dataset. Create a list of computed IoUs for each class. Each list should have a length equal to
Obtain the model predictions on the test dataset. Create a list of computed IoUs for each class. Each list should have a length equal to the size of the test dataset. If there is no predicted bounding box on a particular image, put None instead of the IoU.
# Import computeiou function from Keras CV
from kerascvboundingbox import computeiou
# Get the model predictions. This will take some time.
# Save the model predictions to objdetpreds variable
### YOUR CODE HERE ###
## I KEEP GETTING ERRORS HERE
# Extract the predicted and ground truth boxes for each object class
### YOUR CODE HERE ###
classbananagt dstestsamplebatchnumpy
#classapplegt dstestsampleimagesboundingboxes"
#classorangegt dstestsampleimagesboundingboxes"
# Compute the IoU of the bounding boxes for each object in each image
# Set the appropriate boxes parameters
# There should be three IoU lists
# Iterate through the prediction output of the model
# Save them to appleious, bananaious, and orangeious variables, respectively
### YOUR CODE HERE ###
appleious
bananaious
orangeious
for i in rangelenobjdetpreds:
predboxes objdetpredsiboxes
gtboxesapple classapplegti
gtboxesbanana classbananagti
gtboxesorange classorangegti
appleiou
bananaiou
orangeiou
for j in rangelenpredboxes:
appleiou.appendcomputeioupredboxesj gtboxesapple
bananaiou.appendcomputeioupredboxesj gtboxesbanana
orangeiou.appendcomputeioupredboxesj gtboxesorange
appleious.appendappleiou
bananaious.appendbananaiou
orangeious.appendorangeiou
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
