Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +3 -2
inference.py
CHANGED
|
@@ -52,8 +52,9 @@ def model2annotations(img_dir_list, save_dir, save_json=False, model=None):
|
|
| 52 |
temp_img = Image.open(img_path)
|
| 53 |
cropped_img = temp_img.crop(blk.xyxy)
|
| 54 |
ocr_text = mocr(cropped_img)
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
blk_xyxy = xyxy2yolo(blk_xyxy, im_w, im_h)
|
| 58 |
if blk_xyxy is not None:
|
| 59 |
cls_list = [1] * len(blk_xyxy)
|
|
|
|
| 52 |
temp_img = Image.open(img_path)
|
| 53 |
cropped_img = temp_img.crop(blk.xyxy)
|
| 54 |
ocr_text = mocr(cropped_img)
|
| 55 |
+
blk_idct = blk.to_dict()
|
| 56 |
+
blk_idct['text'] = ocr_text
|
| 57 |
+
blk_dict_list.append(blk_idct)
|
| 58 |
blk_xyxy = xyxy2yolo(blk_xyxy, im_w, im_h)
|
| 59 |
if blk_xyxy is not None:
|
| 60 |
cls_list = [1] * len(blk_xyxy)
|