コード例 #1
0
    def test_coco_bbox_dataset(self):
        assert_is_bbox_dataset(self.dataset,
                               len(coco_bbox_label_names),
                               n_example=30)

        if self.return_area:
            for _ in range(10):
                i = np.random.randint(0, len(self.dataset))
                _, bbox, _, area = self.dataset[i][:4]
                self.assertIsInstance(area, np.ndarray)
                self.assertEqual(area.dtype, np.float32)
                self.assertEqual(area.shape, (bbox.shape[0], ))

        if self.return_crowded:
            for _ in range(10):
                i = np.random.randint(0, len(self.dataset))
                example = self.dataset[i]
                crowded = example[-1]
                bbox = example[1]
                self.assertIsInstance(crowded, np.ndarray)
                self.assertEqual(crowded.dtype, np.bool)
                self.assertEqual(crowded.shape, (bbox.shape[0], ))

                if not self.use_crowded:
                    np.testing.assert_equal(crowded, 0)
コード例 #2
0
 def test_assert_is_bbox_dataset(self):
     if self.valid:
         assert_is_bbox_dataset(self.dataset, 20)
     else:
         with self.assertRaises(AssertionError):
             assert_is_bbox_dataset(self.dataset, 20)
コード例 #3
0
 def test_as_bbox_dataset(self):
     assert_is_bbox_dataset(self.dataset,
                            len(voc_bbox_label_names),
                            n_example=10)
コード例 #4
0
 def test_as_bbox_dataset(self):
     assert_is_bbox_dataset(
         self.dataset, len(voc_bbox_label_names), n_example=10)