diff --git a/doctr/datasets/ic03.py b/doctr/datasets/ic03.py index 82e05815f0..9dd7192790 100644 --- a/doctr/datasets/ic03.py +++ b/doctr/datasets/ic03.py @@ -98,10 +98,10 @@ def __init__( # x_min, y_min, x_max, y_max _boxes = [ [ - float(rect.attrib["x"]), - float(rect.attrib["y"]), - float(rect.attrib["x"]) + float(rect.attrib["width"]), - float(rect.attrib["y"]) + float(rect.attrib["height"]), + float(rect.attrib["x"]), # type: ignore[list-item] + float(rect.attrib["y"]), # type: ignore[list-item] + float(rect.attrib["x"]) + float(rect.attrib["width"]), # type: ignore[list-item] + float(rect.attrib["y"]) + float(rect.attrib["height"]), # type: ignore[list-item] ] for rect in rectangles ] diff --git a/doctr/datasets/svt.py b/doctr/datasets/svt.py index 32ddbcccad..fed3c6a36e 100644 --- a/doctr/datasets/svt.py +++ b/doctr/datasets/svt.py @@ -91,10 +91,10 @@ def __init__( # x_min, y_min, x_max, y_max _boxes = [ [ - float(rect.attrib["x"]), - float(rect.attrib["y"]), - float(rect.attrib["x"]) + float(rect.attrib["width"]), - float(rect.attrib["y"]) + float(rect.attrib["height"]), + float(rect.attrib["x"]), # type: ignore[list-item] + float(rect.attrib["y"]), # type: ignore[list-item] + float(rect.attrib["x"]) + float(rect.attrib["width"]), # type: ignore[list-item] + float(rect.attrib["y"]) + float(rect.attrib["height"]), # type: ignore[list-item] ] for rect in rectangles ] diff --git a/doctr/models/builder.py b/doctr/models/builder.py index 219ca5c5c2..742f9e2f60 100644 --- a/doctr/models/builder.py +++ b/doctr/models/builder.py @@ -301,8 +301,10 @@ def __call__( if len(boxes) != len(text_preds) or len(boxes) != len(page_shapes): raise ValueError("All arguments are expected to be lists of the same size") - _orientations = orientations if isinstance(orientations, list) else [None] * len(boxes) - _languages = languages if isinstance(languages, list) else [None] * len(boxes) + _orientations = ( + orientations if isinstance(orientations, list) else [None] * len(boxes) # type: ignore[list-item] + ) + _languages = languages if isinstance(languages, list) else [None] * len(boxes) # type: ignore[list-item] if self.export_as_straight_boxes and len(boxes) > 0: # If boxes are already straight OK, else fit a bounding rect if boxes[0].ndim == 3: