Skip to content

RLE segmentation mask format #223

RLE segmentation mask format

RLE segmentation mask format #223

GitHub Actions / Test Results failed Feb 12, 2025 in 0s

3 fail, 20 skipped, 58 pass in 3h 34m 29s

  6 files  ±0    6 suites  ±0   3h 34m 29s ⏱️ - 2m 10s
 81 tests ±0   58 ✅ + 2   20 💤 ±0   3 ❌  -  2 
486 runs  ±0  344 ✅ +12  124 💤 ±0  18 ❌  - 12 

Results for commit 2011598. ± Comparison against earlier commit 4da7ae2.

Annotations

Check warning on line 0 in tests.core_tests.unittests.test_annotators

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 6 runs failed: test_cpu_sam2_base_annotator (tests.core_tests.unittests.test_annotators)

artifacts/Test Results [macOS-latest] (Python 3.10)/pytest.xml [took 24s]
artifacts/Test Results [macOS-latest] (Python 3.11)/pytest.xml [took 29s]
artifacts/Test Results [ubuntu-latest] (Python 3.10)/pytest.xml [took 4m 55s]
artifacts/Test Results [ubuntu-latest] (Python 3.11)/pytest.xml [took 4m 51s]
artifacts/Test Results [windows-latest] (Python 3.10)/pytest.xml [took 4m 42s]
artifacts/Test Results [windows-latest] (Python 3.11)/pytest.xml [took 4m 43s]
Raw output
AssertionError: assert (False)
 +  where False = isinstance({'counts': 'h:6d0;R1D_Na0OZ1_k0VNQUO;R1D_Na0OZ1`k0UNPUO;^15RN[1`k0UNQUO5b1;nMZ1ak0TNQUO2e1=lMZ1nn0aNUQOLH40`0ZP1ZO`POL...00000000CQoN0PQ1O>O001O000000O0hnNOkP11ToN1kP1OUoN2jP1NVoN2jP1NVoN2kP1LWoN2kP1M`0OjQ10WnN000c_e1', 'size': [1080, 810]}, list)
@pytest.mark.skipif(
        total_disk_space < 16,
        reason="Test requires at least 16GB of HDD",
    )
    def test_cpu_sam2_base_annotator():
>       _check_sam2_annotator("cpu")

tests/core_tests/unittests/test_annotators.py:298: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

device = 'cpu', size = 'base'

    def _check_sam2_annotator(device: str, size: str = "base"):
        url = "https://ultralytics.com/images/bus.jpg"
        im = Image.open(requests.get(url, stream=True).raw)
        annotator = SAM2Annotator(device=device, size=size)
        masks = annotator.annotate_batch([im], [np.array([[3, 229, 559, 650]])])
        w, h = im.width, im.height
        # Check that the masks are lists
        assert isinstance(masks, list) and len(masks) == 1
        # Check that the masks are [B, O, N, 2], where
        # - B = batch size
        # - O = number of objects
        # - N = number of points of the mask segment polygon (at least 3 to be polygon)
        assert isinstance(masks[0], list) and len(masks[0]) == 1
>       assert isinstance(masks[0][0], list) and len(masks[0][0]) >= 3
E       AssertionError: assert (False)
E        +  where False = isinstance({'counts': 'h:6d0;R1D_Na0OZ1_k0VNQUO;R1D_Na0OZ1`k0UNPUO;^15RN[1`k0UNQUO5b1;nMZ1ak0TNQUO2e1=lMZ1nn0aNUQOLH40`0ZP1ZO`POL...00000000CQoN0PQ1O>O001O000000O0hnNOkP11ToN1kP1OUoN2jP1NVoN2jP1NVoN2kP1LWoN2kP1M`0OjQ10WnN000c_e1', 'size': [1080, 810]}, list)

tests/core_tests/unittests/test_annotators.py:276: AssertionError

Check warning on line 0 in tests.core_tests.unittests.test_annotators

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 6 runs failed: test_cpu_sam2_large_annotator (tests.core_tests.unittests.test_annotators)

artifacts/Test Results [macOS-latest] (Python 3.10)/pytest.xml [took 1m 29s]
artifacts/Test Results [macOS-latest] (Python 3.11)/pytest.xml [took 1m 20s]
artifacts/Test Results [ubuntu-latest] (Python 3.10)/pytest.xml [took 11m 28s]
artifacts/Test Results [ubuntu-latest] (Python 3.11)/pytest.xml [took 11m 33s]
artifacts/Test Results [windows-latest] (Python 3.10)/pytest.xml [took 14m 32s]
artifacts/Test Results [windows-latest] (Python 3.11)/pytest.xml [took 14m 20s]
Raw output
AssertionError: assert (False)
 +  where False = isinstance({'counts': 'bc43bQ1f0ZOi0jNcNdPO`1Xo0dNePO_1Xo0cNfPO`1Xo0`NhPOa1Wo0_NiPOc10VNmn05SQOX2NaMon0f2M1O1O10000[OYMYROg2gm0YM...LHO4:LG108ei0P1fZOAnKUOG207gi0P1fZOPOjKJb03Qi0Q1eZOiNUM0[h0T1a6M2N3L4M2O2N1O1N3FmnNJVQ11nnNMcQQ8', 'size': [1080, 810]}, list)
@pytest.mark.skipif(
        total_disk_space < 16,
        reason="Test requires at least 16GB of HDD",
    )
    def test_cpu_sam2_large_annotator():
>       _check_sam2_annotator("cpu", size="large")

tests/core_tests/unittests/test_annotators.py:314: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

device = 'cpu', size = 'large'

    def _check_sam2_annotator(device: str, size: str = "base"):
        url = "https://ultralytics.com/images/bus.jpg"
        im = Image.open(requests.get(url, stream=True).raw)
        annotator = SAM2Annotator(device=device, size=size)
        masks = annotator.annotate_batch([im], [np.array([[3, 229, 559, 650]])])
        w, h = im.width, im.height
        # Check that the masks are lists
        assert isinstance(masks, list) and len(masks) == 1
        # Check that the masks are [B, O, N, 2], where
        # - B = batch size
        # - O = number of objects
        # - N = number of points of the mask segment polygon (at least 3 to be polygon)
        assert isinstance(masks[0], list) and len(masks[0]) == 1
>       assert isinstance(masks[0][0], list) and len(masks[0][0]) >= 3
E       AssertionError: assert (False)
E        +  where False = isinstance({'counts': 'bc43bQ1f0ZOi0jNcNdPO`1Xo0dNePO_1Xo0cNfPO`1Xo0`NhPOa1Wo0_NiPOc10VNmn05SQOX2NaMon0f2M1O1O10000[OYMYROg2gm0YM...LHO4:LG108ei0P1fZOAnKUOG207gi0P1fZOPOjKJb03Qi0Q1eZOiNUM0[h0T1a6M2N3L4M2O2N1O1N3FmnNJVQ11nnNMcQQ8', 'size': [1080, 810]}, list)

tests/core_tests/unittests/test_annotators.py:276: AssertionError

Check warning on line 0 in tests.core_tests.unittests.test_converters.TestLuxonisDatasetConverter

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 6 runs failed: test_convert (tests.core_tests.unittests.test_converters.TestLuxonisDatasetConverter)

artifacts/Test Results [macOS-latest] (Python 3.10)/pytest.xml [took 0s]
artifacts/Test Results [macOS-latest] (Python 3.11)/pytest.xml [took 0s]
artifacts/Test Results [ubuntu-latest] (Python 3.10)/pytest.xml [took 0s]
artifacts/Test Results [ubuntu-latest] (Python 3.11)/pytest.xml [took 0s]
artifacts/Test Results [windows-latest] (Python 3.10)/pytest.xml [took 0s]
artifacts/Test Results [windows-latest] (Python 3.11)/pytest.xml [took 0s]
Raw output
KeyError: 'type'
self = <test_converters.TestLuxonisDatasetConverter testMethod=test_convert>

    def test_convert(self):
        self.dataset_name = "test_dataset"
        converter = LuxonisDatasetConverter(dataset_name=self.dataset_name)
        split_ratios = [1, 0, 0]
>       converter.convert(self.test_dir, self.dataset_name, split_ratios)

tests/core_tests/unittests/test_converters.py:288: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
datadreamer/utils/luxonis_dataset_converter.py:55: in convert
    self.process_data(
datadreamer/utils/luxonis_dataset_converter.py:178: in process_data
    dataset.add(dataset_generator())
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/luxonis_ml/data/datasets/luxonis_dataset.py:551: in add
    for i, data in enumerate(generator, start=1):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

generator = <generator object LuxonisDatasetConverter.process_data.<locals>.dataset_generator at 0x7f82ac987ae0>

    def add_generator_wrapper(generator: DatasetIterator) -> DatasetIterator:
        """Generator wrapper to rescale and reformat annotations for each
        record in the input generator."""
    
        def create_new_record(
            record: Dict[str, Union[str, Dict]],
            annotation: Dict[str, Union[str, int, float, List, Dict]],
        ) -> Dict[str, Union[str, Dict]]:
            """Create a new record with the updated annotation."""
            return {
                "file": record["file"],
                "annotation": annotation,
            }
    
        for record in generator:
            if isinstance(record, DatasetRecord) or "annotation" not in record:
                yield record
                continue
    
            ann = record["annotation"]
>           if ann["type"] != "detection":
E           KeyError: 'type'

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/luxonis_ml/data/datasets/utils.py:247: KeyError