Example #1
0
 def _decode_detection_ann(self, buffer: io.IOBase) -> torch.Tensor:
     result = VOCDetection.parse_voc_xml(
         ElementTree.parse(buffer).getroot())  # type: ignore[arg-type]
     objects = result["annotation"]["object"]
     bboxes = [obj["bndbox"] for obj in objects]
     bboxes = [[
         int(bbox[part]) for part in ("xmin", "ymin", "xmax", "ymax")
     ] for bbox in bboxes]
     return BoundingBox(bboxes)
Example #2
0
File: voc.py Project: nairbv/vision
 def _parse_detection_ann(self, buffer: BinaryIO) -> Dict[str, Any]:
     return cast(
         Dict[str, Any],
         VOCDetection.parse_voc_xml(
             ElementTree.parse(buffer).getroot())["annotation"])