|
@@ -21,7 +21,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
output = np.array([[50, 10, 20, 30, 40]], dtype=np.float32)
|
|
output = np.array([[50, 10, 20, 30, 40]], dtype=np.float32)
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
- transform = DetectionTargetsFormatTransform(image_shape=self.image.shape[1:], max_targets=1, input_format=XYXY_LABEL, output_format=LABEL_XYXY)
|
|
|
|
|
|
+ transform = DetectionTargetsFormatTransform(input_dim=self.image.shape[1:], max_targets=1, input_format=XYXY_LABEL, output_format=LABEL_XYXY)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
|
|
|
|
@@ -31,9 +31,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
output = np.array([[10, 20 / w, 30 / h, 40 / w, 50 / h]], dtype=np.float32)
|
|
output = np.array([[10, 20 / w, 30 / h, 40 / w, 50 / h]], dtype=np.float32)
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
- transform = DetectionTargetsFormatTransform(
|
|
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_NORMALIZED_XYXY
|
|
|
|
- )
|
|
|
|
|
|
+ transform = DetectionTargetsFormatTransform(input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_NORMALIZED_XYXY)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
|
|
|
|
@@ -43,7 +41,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
output = np.array([[10, 30, 40, 20, 20]], dtype=np.float32)
|
|
output = np.array([[10, 30, 40, 20, 20]], dtype=np.float32)
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
- transform = DetectionTargetsFormatTransform(image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_CXCYWH)
|
|
|
|
|
|
+ transform = DetectionTargetsFormatTransform(input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_CXCYWH)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
|
|
|
|
@@ -54,7 +52,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_NORMALIZED_CXCYWH
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_XYXY, output_format=LABEL_NORMALIZED_CXCYWH
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
@@ -66,7 +64,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_XYXY, output_format=LABEL_CXCYWH
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_XYXY, output_format=LABEL_CXCYWH
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
@@ -78,7 +76,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_XYXY, output_format=LABEL_NORMALIZED_CXCYWH
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_XYXY, output_format=LABEL_NORMALIZED_CXCYWH
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
@@ -88,7 +86,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
input = np.array([[10, 30, 40, 20, 20]], dtype=np.float32)
|
|
input = np.array([[10, 30, 40, 20, 20]], dtype=np.float32)
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
- transform = DetectionTargetsFormatTransform(image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_CXCYWH, output_format=LABEL_XYXY)
|
|
|
|
|
|
+ transform = DetectionTargetsFormatTransform(input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_CXCYWH, output_format=LABEL_XYXY)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
|
|
|
|
@@ -99,7 +97,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_CXCYWH, output_format=LABEL_NORMALIZED_XYXY
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_CXCYWH, output_format=LABEL_NORMALIZED_XYXY
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
@@ -111,7 +109,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_CXCYWH, output_format=LABEL_XYXY
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_CXCYWH, output_format=LABEL_XYXY
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
@@ -123,7 +121,7 @@ class DetectionTargetsTransformTest(unittest.TestCase):
|
|
sample = {"image": self.image, "target": input}
|
|
sample = {"image": self.image, "target": input}
|
|
|
|
|
|
transform = DetectionTargetsFormatTransform(
|
|
transform = DetectionTargetsFormatTransform(
|
|
- image_shape=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_CXCYWH, output_format=LABEL_NORMALIZED_XYXY
|
|
|
|
|
|
+ input_dim=self.image.shape[1:], max_targets=1, input_format=LABEL_NORMALIZED_CXCYWH, output_format=LABEL_NORMALIZED_XYXY
|
|
)
|
|
)
|
|
t_output = transform(sample)["target"]
|
|
t_output = transform(sample)["target"]
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|
|
self.assertTrue(np.allclose(output, t_output, atol=1e-6))
|