Skip to content

Error when computing the coordinates of a polygon during inference

Refs https://redmine.teklia.com/issues/5614

In some cases the variable roi here is an empty array which raises the error ValueError('zero-size array to reduction operation minimum which has no identity') when trying to do roi[:, 0].min() and roi[:, 0].max(). In this case we should simply ignore the polygon and return empty values {}, None like here ()

Process: https://arkindex.teklia.com/process/c88df85f-5d03-4edb-b48a-afe93e6f1d28/0

Example of logs

2023-12-15 23:13:49,549 INFO/arkindex_worker: Processing single_page 10-1 (a3e92ac7-87d2-4a1e-96c2-7ad366d5fe68) (1720/2658)
2023-12-15 23:13:49,684 INFO/worker_dan.worker: Downloading image...
2023-12-15 23:13:50,819 INFO/dan.ocr.predict.inference: Loading images...
2023-12-15 23:13:50,860 INFO/dan.ocr.predict.inference: Images preprocessed!
2023-12-15 23:13:50,861 INFO/dan.ocr.predict.inference: Predicting...
2023-12-15 23:14:30,092 INFO/dan.ocr.predict.inference: Images processed
2023-12-15 23:14:32,346 WARNING/arkindex_worker: Failed running worker on element a3e92ac7-87d2-4a1e-96c2-7ad366d5fe68: ValueError('zero-size array to reduction operation minimum which has no identity')
Edited by Manon Blanco