Quellcode durchsuchen

Merge pull request #3499 from jinghuan-Chen/fix/fill_blank_rec_crop_empty_image

Avoid cropping empty images.
Xiaomeng Zhao vor 1 Monat
Ursprung
Commit
3c8b6e6b6b
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      mineru/model/table/rec/unet_table/main.py

+ 1 - 1
mineru/model/table/rec/unet_table/main.py

@@ -184,7 +184,7 @@ class WiredTableRecognition:
                 continue
             # 从img中截取对应的区域
             x1, y1, x2, y2 = int(box[0][0])+1, int(box[0][1])+1, int(box[2][0])-1, int(box[2][1])-1
-            if x1 >= x2 or y1 >= y2:
+            if x1 >= x2 or y1 >= y2 or x1 < 0 or y1 < 0:
                 # logger.warning(f"Invalid box coordinates: {x1, y1, x2, y2}")
                 continue
             # 判断长宽比