Przeglądaj źródła

Merge pull request #3805 from myhloli/dev

fix: handle empty input in prediction logic of predict_formula.py
Xiaomeng Zhao 3 tygodni temu
rodzic
commit
47f34f4ce8

+ 5 - 2
mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py

@@ -129,8 +129,11 @@ class FormulaRecognizer(BaseOCRV20):
             new_idx: old_idx for new_idx, old_idx in enumerate(sorted_indices)
         }
 
-        # 进行预测
-        rec_formula = self.predict(sorted_images, batch_size)
+        if len(sorted_images) > 0:
+            # 进行预测
+            rec_formula = self.predict(sorted_images, batch_size)
+        else:
+            rec_formula = []
 
         # Restore original order
         unsorted_results = [""] * len(rec_formula)