예제 #1
0
 def __call__(self, data):
     d = dict(data)
     for key in self.keys:
         try:
             points = get_extreme_points(d[key])
             if d.get(self.result) is None:
                 d[self.result] = dict()
             d[self.result][self.points] = np.array(points).astype(
                 int).tolist()
         except ValueError:
             pass
     return d
 def test_type_shape(self, input_data, expected):
     result = get_extreme_points(**input_data)
     self.assertEqual(result, expected)
예제 #3
0
 def randomize(self, label: np.ndarray) -> None:
     self.points = get_extreme_points(label,
                                      rand_state=self.R,
                                      background=self.background,
                                      pert=self.pert)