MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / clip_all_boader

Method clip_all_boader

PATH/core/solvers/utils/peddet_tester_dev.py:364–384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

362 return ious
363
364 def clip_all_boader(self):
365
366 def _clip_boundary(boxes, height, width):
367 assert boxes.shape[-1] >= 4
368 boxes[:, 0] = np.minimum(np.maximum(boxes[:, 0], 0), width - 1)
369 boxes[:, 1] = np.minimum(np.maximum(boxes[:, 1], 0), height - 1)
370 boxes[:, 2] = np.maximum(np.minimum(boxes[:, 2], width), 0)
371 boxes[:, 3] = np.maximum(np.minimum(boxes[:, 3], height), 0)
372 return boxes
373
374 assert self.dtboxes.shape[-1] >= 4
375 assert self.gtboxes.shape[-1] >= 4
376 assert self._width is not None and self._height is not None
377 if self.eval_mode == 2:
378 self.dtboxes[:, :4] = _clip_boundary(self.dtboxes[:, :4], self._height, self._width)
379 self.gtboxes[:, :4] = _clip_boundary(self.gtboxes[:, :4], self._height, self._width)
380 self.dtboxes[:, 4:8] = _clip_boundary(self.dtboxes[:, 4:8], self._height, self._width)
381 self.gtboxes[:, 4:8] = _clip_boundary(self.gtboxes[:, 4:8], self._height, self._width)
382 else:
383 self.dtboxes = _clip_boundary(self.dtboxes, self._height, self._width)
384 self.gtboxes = _clip_boundary(self.gtboxes, self._height, self._width)
385
386 def load_gt_boxes(self, dict_input, key_name, class_names):
387 assert key_name in dict_input

Callers 1

loadDataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected