Skip to content

Commit

Permalink
✅ Add unit test for oneformer instance post processing panoptic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nickthegroot committed Mar 1, 2024
1 parent 79b16e7 commit a3f370b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/models/oneformer/test_image_processing_oneformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ def test_post_process_instance_segmentation(self):
el["segmentation"].shape, (self.image_processor_tester.height, self.image_processor_tester.width)
)

segmentation_with_opts = image_processor.post_process_instance_segmentation(
outputs,
threshold=0,
target_sizes=[(1, 4) for _ in range(self.image_processor_tester.batch_size)],
task_type="panoptic",
)
self.assertTrue(len(segmentation_with_opts) == self.image_processor_tester.batch_size)
for el in segmentation_with_opts:
self.assertTrue("segmentation" in el)
self.assertTrue("segments_info" in el)
self.assertEqual(type(el["segments_info"]), list)
self.assertEqual(el["segmentation"].shape, (1, 4))

def test_post_process_panoptic_segmentation(self):
image_processor = self.image_processing_class(
num_labels=self.image_processor_tester.num_classes,
Expand Down

0 comments on commit a3f370b

Please sign in to comment.