Commit c97959e4 authored by myhloli's avatar myhloli
Browse files

fix(ocr): handle NaN values in recognition scores

- Update predict_rec.py to check for NaN values in recognition results
- Replace NaN scores with 0.0 to ensure stability and consistency
parent 8aa61b0e
......@@ -437,4 +437,10 @@ class TextRecognizer(BaseOCRV20):
index += 1
pbar.update(current_batch_size)
# Fix NaN values in recognition results
for i in range(len(rec_res)):
text, score = rec_res[i]
if isinstance(score, float) and math.isnan(score):
rec_res[i] = (text, 0.0)
return rec_res, elapse
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment