Skip to content

Commit

Permalink
scale_coords changed to scale_boxes in yolo
Browse files Browse the repository at this point in the history
  • Loading branch information
persts committed Dec 2, 2022
1 parent b30b762 commit f1cdcad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stage2_gen_bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import numpy as np
from PIL import Image
from utils.augmentations import letterbox
from utils.general import non_max_suppression, scale_coords, xyxy2xywh
from utils.general import non_max_suppression, scale_boxes, xyxy2xywh

MEGADETECTOR = './md_v5a.0.0.pt'
MEGADETECTOR_URL = 'https://github.com/microsoft/CameraTraps/releases/download/v5.0/md_v5a.0.0.pt'
Expand Down Expand Up @@ -86,7 +86,7 @@
device = 'cpu'
if torch.cuda.is_available():
device = 'cuda:0'

try:
if torch.backends.mps.is_built and torch.backends.mps.is_available():
device = 'mps'
Expand Down Expand Up @@ -122,7 +122,7 @@
entry = schema.annotation_file_entry()
for det in pred:
if len(det):
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], img_original.shape).round()
det[:, :4] = scale_boxes(img.shape[2:], det[:, :4], img_original.shape).round()
for *box, conf, cls in reversed(det):
annotation = schema.annotation()
annotation['created_by'] = 'machine'
Expand Down

0 comments on commit f1cdcad

Please sign in to comment.