BaşlayınÜcretsiz Başlayın

Calculate NMS

Having extracted the predicted bounding boxes and scores from your object recognition model, your next task is to ensure that only the most accurate and non-overlapping predicted bounding boxes are retained by using the non-max suppression technique.

boxes and scores you created in the previous exercise are available in your workspace and torch and torchvision have been imported.

Bu egzersiz

Deep Learning for Images with PyTorch

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import nms from torchvision.ops.
  • Set the IoU threshold to be equal 0.5.
  • Apply non-max suppression passing boxes, confidence_scores, and iou_threshold to the relevant function.
  • Use the output indices to filter predicted boxes.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import nms
____

# Set the IoU threshold
iou_threshold = ____

# Apply non-max suppression
box_indices = ____

# Filter boxes
filtered_boxes = ____

print("Filtered Boxes:", filtered_boxes)
Kodu Düzenle ve Çalıştır