Ejemplo n.º 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)
Ejemplo n.º 2
0
Archivo: voc.py Proyecto: 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"])