Skip to content

Prediction is not correctly saved when there is a . in the image name

When trying to predict my Madcat images, which contain one or more . in their names (eg AAW_ARB_20070601.0045-S1_1_LDC0016.jpg), the predictions are not saved under the correct name because the .with_suffix('.json') replaces everything after the first .: AAW_ARB_20070601.json

Ref https://gitlab.teklia.com/atr/dan/-/blob/main/dan/ocr/predict/inference.py?ref_type=heads#L416

A possible fix would be to do:

json_filename = Path(output, str(image_path.stem)+'.json')