def _check_predict(self): if self.return_values == 'detection': assert_is_detection_link(self.link, self.n_fg_class) elif self.return_values == 'instance_segmentation': assert_is_instance_segmentation_link(self.link, self.n_fg_class) elif self.return_values == 'rpn': imgs = [ np.random.randint( 0, 256, size=(3, 480, 320)).astype(np.float32), np.random.randint( 0, 256, size=(3, 480, 320)).astype(np.float32)] result = self.link.predict(imgs) assert len(result) == 1 assert len(result[0]) == len(imgs) for i in range(len(result[0])): roi = result[0][i] assert_is_bbox(roi)
def test_predict_cpu(self): assert_is_detection_link(self.link, self.n_fg_class)
def test_predict_gpu(self): self.link.to_gpu() assert_is_detection_link(self.link, self.n_fg_class)
def test_predict_gpu(self): self.link.to_gpu() assert_is_detection_link(self.link, self.n_fg_class)
def test_predict_cpu(self): assert_is_detection_link(self.link, self.n_fg_class)
def test_assert_is_detection_link(self): if self.valid: assert_is_detection_link(self.link, 20) else: with self.assertRaises(AssertionError): assert_is_detection_link(self.link, 20)
def test_assert_is_detection_link(self): if self.valid: assert_is_detection_link(self.link, 20) else: with self.assertRaises(AssertionError): assert_is_detection_link(self.link, 20)