Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlov721 committed Sep 25, 2024
1 parent 0bdec98 commit 7f12681
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def CIFAR10_subset_generator():

@pytest.fixture
def config(train_overfit: bool) -> dict[str, Any]:
if train_overfit:
if train_overfit: # pragma: no cover
epochs = 100
else:
epochs = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def train_and_test(
model = LuxonisModel(config, opts)
model.train()
results = model.test(view="val")
if train_overfit:
if train_overfit: # pragma: no cover
for name, value in results.items():
if "/map_50" in name or "/kpt_map_medium" in name:
assert value > 0.8, f"{name} = {value} (expected > 0.8)"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def train_and_test(
model = LuxonisModel(config, opts)
model.train()
results = model.test(view="val")
if train_overfit:
if train_overfit: # pragma: no cover
for name, value in results.items():
if "metric" in name:
assert value > 0.8, f"{name} = {value} (expected > 0.8)"
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_invalid(packet: Packet[Tensor]):
node.wrap({"inp": torch.rand(3, 224, 224)})


def tets_in_sizes():
def test_in_sizes():
node = DummyNode(
input_shapes=[{"features": [Size((3, 224, 224)) for _ in range(3)]}]
)
Expand Down
11 changes: 6 additions & 5 deletions tests/unittests/test_utils/test_boxutils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Literal

import pytest
import torch

Expand All @@ -13,7 +15,10 @@


def generate_random_bboxes(
n_bboxes: int, max_width: int, max_height: int, format: str = "xyxy"
n_bboxes: int,
max_width: int,
max_height: int,
format: Literal["xyxy", "xywh", "cxcywh"],
):
x1y1 = torch.rand(n_bboxes, 2) * torch.tensor(
[max_width - 1, max_height - 1]
Expand All @@ -33,10 +38,6 @@ def generate_random_bboxes(
elif format == "cxcywh":
cxcy = x1y1 + wh / 2
bboxes = torch.cat((cxcy, wh), dim=1)
else:
raise ValueError(
"Unsupported format. Choose from 'xyxy', 'xywh', 'cxcywh'."
)

return bboxes

Expand Down

0 comments on commit 7f12681

Please sign in to comment.