III111II1I1 commited on
Commit
46c9baa
·
verified ·
1 Parent(s): 0c5f402

Update inference.py

Browse files
Files changed (1) hide show
  1. 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
- blk['text'] = ocr_text
56
- blk_dict_list.append(blk.to_dict())
 
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)