IniziaInizia gratis

Bounding boxes prediction

You have trained an object recognition model. Now, you want to use to generate bounding boxes and classifications for a test image.

The model is available as model and it's already in the evaluation mode. The test_image is also available, and torch and torch.nn as nn have been imported.

Questo esercizio fa parte del corso

Deep Learning for Images with PyTorch

Visualizza il corso

Istruzioni dell'esercizio

  • Get the model's output for the test_image and assign it to output.
  • Extract the predicted bounding boxes from the output and assign them to boxes.
  • Extract the predicted scores from the output and assign them to scores.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Get model's prediction
with torch.no_grad():
    output = ____

# Extract boxes from the output
boxes = ____

# Extract scores from the output
scores = ____

print(boxes, scores)
Modifica ed esegui il codice