MulaiMulai sekarang secara 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.

Latihan ini adalah bagian dari kursus

Deep Learning for Images with PyTorch

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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

# Extract boxes from the output
boxes = ____

# Extract scores from the output
scores = ____

print(boxes, scores)
Edit dan Jalankan Kode