Skip to content

Commit

Permalink
Fixing unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqwang committed Oct 20, 2021
1 parent 1b9047e commit 3ba4a2a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch
from torch import Tensor
from yolort import models
from yolort.models import YOLOv5
from yolort.models import YOLO
from yolort.utils import (
FeatureExtractor,
get_image_from_url,
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_load_from_ultralytics_voc(
out_from_yolov5 = outs[0]

# Define yolort model
model_yolort = YOLOv5.load_from_yolov5(
model_yolort = YOLO.load_from_yolov5(
checkpoint_path,
score_thresh=conf,
version=version,
Expand All @@ -103,14 +103,10 @@ def test_load_from_ultralytics_voc(
with torch.no_grad():
out_from_yolort = model_yolort(img[None])

torch.testing.assert_allclose(out_from_yolort[0]["boxes"], out_from_yolov5[:, :4])
torch.testing.assert_allclose(out_from_yolort[0]["scores"], out_from_yolov5[:, 4])
torch.testing.assert_allclose(
out_from_yolort[0]['boxes'], out_from_yolov5[:, :4]
)
torch.testing.assert_allclose(
out_from_yolort[0]['scores'], out_from_yolov5[:, 4]
)
torch.testing.assert_allclose(
out_from_yolort[0]['labels'], out_from_yolov5[:, 5].to(dtype=torch.int64)
out_from_yolort[0]["labels"], out_from_yolov5[:, 5].to(dtype=torch.int64)
)


Expand Down

0 comments on commit 3ba4a2a

Please sign in to comment.