File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -873,20 +873,20 @@ def from_easyocr(cls, easyocr_results: list) -> Detections:
873
873
874
874
bbox = np .array ([result [0 ] for result in easyocr_results ])
875
875
xyxy = np .hstack ((np .min (bbox , axis = 1 ), np .max (bbox , axis = 1 )))
876
+ confidence = np .array (
877
+ [
878
+ result [2 ] if len (result ) > 2 and result [2 ] else 0
879
+ for result in easyocr_results
880
+ ]
881
+ )
882
+ ocr_text = np .array ([result [1 ] for result in easyocr_results ])
876
883
877
884
return cls (
878
- xyxy = xyxy ,
879
- confidence = np .array (
880
- [
881
- result [2 ] if len (result ) > 2 and result [2 ] else 0
882
- for result in easyocr_results
883
- ]
884
- ),
885
- class_id = np .arange (len (xyxy )),
885
+ xyxy = xyxy .astype (np .float32 ),
886
+ confidence = confidence .astype (np .float32 ),
887
+ class_id = None ,
886
888
data = {
887
- CLASS_NAME_DATA_FIELD : np .array (
888
- [result [1 ] for result in easyocr_results ]
889
- )
889
+ CLASS_NAME_DATA_FIELD : ocr_text ,
890
890
},
891
891
)
892
892
You can’t perform that action at this time.
0 commit comments