Spaces:
Sleeping
Sleeping
✅ [Pass] test on new framework and file name
Browse files
tests/test_tools/test_module_helper.py
CHANGED
|
@@ -7,7 +7,7 @@ from torch import nn
|
|
| 7 |
|
| 8 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 9 |
sys.path.append(str(project_root))
|
| 10 |
-
from yolo.
|
| 11 |
|
| 12 |
|
| 13 |
@pytest.mark.parametrize(
|
|
@@ -29,10 +29,10 @@ def test_auto_pad(kernel_size, dilation, expected):
|
|
| 29 |
[("ReLU", nn.ReLU), ("leakyrelu", nn.LeakyReLU), ("none", nn.Identity), (None, nn.Identity), (False, nn.Identity)],
|
| 30 |
)
|
| 31 |
def test_get_activation(activation_name, expected_type):
|
| 32 |
-
result =
|
| 33 |
assert isinstance(result, expected_type), f"get_activation does not return correct type for {activation_name}"
|
| 34 |
|
| 35 |
|
| 36 |
def test_get_activation_invalid():
|
| 37 |
with pytest.raises(ValueError):
|
| 38 |
-
|
|
|
|
| 7 |
|
| 8 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 9 |
sys.path.append(str(project_root))
|
| 10 |
+
from yolo.utils.module_utils import auto_pad, create_activation_function
|
| 11 |
|
| 12 |
|
| 13 |
@pytest.mark.parametrize(
|
|
|
|
| 29 |
[("ReLU", nn.ReLU), ("leakyrelu", nn.LeakyReLU), ("none", nn.Identity), (None, nn.Identity), (False, nn.Identity)],
|
| 30 |
)
|
| 31 |
def test_get_activation(activation_name, expected_type):
|
| 32 |
+
result = create_activation_function(activation_name)
|
| 33 |
assert isinstance(result, expected_type), f"get_activation does not return correct type for {activation_name}"
|
| 34 |
|
| 35 |
|
| 36 |
def test_get_activation_invalid():
|
| 37 |
with pytest.raises(ValueError):
|
| 38 |
+
create_activation_function("unsupported_activation")
|
tests/test_utils/test_dataaugment.py
CHANGED
|
@@ -9,7 +9,12 @@ from torchvision.transforms import functional as TF
|
|
| 9 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 10 |
sys.path.append(str(project_root))
|
| 11 |
|
| 12 |
-
from yolo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def test_horizontal_flip():
|
|
@@ -33,7 +38,7 @@ def test_compose():
|
|
| 33 |
def mock_transform(image, boxes):
|
| 34 |
return image, boxes
|
| 35 |
|
| 36 |
-
compose =
|
| 37 |
img = Image.new("RGB", (10, 10), color="blue")
|
| 38 |
boxes = torch.tensor([[0, 0.2, 0.2, 0.8, 0.8]])
|
| 39 |
|
|
|
|
| 9 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 10 |
sys.path.append(str(project_root))
|
| 11 |
|
| 12 |
+
from yolo.tools.data_augmentation import (
|
| 13 |
+
AugmentationComposer,
|
| 14 |
+
HorizontalFlip,
|
| 15 |
+
Mosaic,
|
| 16 |
+
VerticalFlip,
|
| 17 |
+
)
|
| 18 |
|
| 19 |
|
| 20 |
def test_horizontal_flip():
|
|
|
|
| 38 |
def mock_transform(image, boxes):
|
| 39 |
return image, boxes
|
| 40 |
|
| 41 |
+
compose = AugmentationComposer([mock_transform, mock_transform])
|
| 42 |
img = Image.new("RGB", (10, 10), color="blue")
|
| 43 |
boxes = torch.tensor([[0, 0.2, 0.2, 0.8, 0.8]])
|
| 44 |
|
tests/test_utils/test_loss.py
CHANGED
|
@@ -8,7 +8,7 @@ from hydra import compose, initialize
|
|
| 8 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 9 |
sys.path.append(str(project_root))
|
| 10 |
|
| 11 |
-
from yolo.
|
| 12 |
|
| 13 |
|
| 14 |
@pytest.fixture
|
|
|
|
| 8 |
project_root = Path(__file__).resolve().parent.parent.parent
|
| 9 |
sys.path.append(str(project_root))
|
| 10 |
|
| 11 |
+
from yolo.tools.loss_functions import YOLOLoss
|
| 12 |
|
| 13 |
|
| 14 |
@pytest.fixture
|