leoxiaobin haipingwu commited on
Commit
13c0e86
1 Parent(s): 3112cd2

update_ocr_postprocess (#19)

Browse files

- update ocr post-process (e6c93f7995e555ff06e69e653847d40f8dfa9cc8)


Co-authored-by: Haiping Wu <haipingwu@users.noreply.huggingface.co>

Files changed (1) hide show
  1. processing_florence2.py +3 -3
processing_florence2.py CHANGED
@@ -596,7 +596,7 @@ class Florence2PostProcesser(object):
596
  {
597
  'TASK_NAME': 'ocr',
598
  'PATTERN': r'(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>',
599
- 'AREA_THRESHOLD': 0.01
600
  },
601
  {
602
  'TASK_NAME': 'phrase_grounding',
@@ -1025,7 +1025,7 @@ class Florence2PostProcesser(object):
1025
  text,
1026
  pattern=pattern,
1027
  image_size=image_size,
1028
- area_threshold=self.parse_tasks_configs[task].get('AREA_THRESHOLD', 0.01),
1029
  )
1030
  parsed_dict['ocr'] = instances
1031
  elif task == 'phrase_grounding':
@@ -1085,4 +1085,4 @@ class Florence2PostProcesser(object):
1085
  else:
1086
  raise ValueError("task {} is not supported".format(task))
1087
 
1088
- return parsed_dict
 
596
  {
597
  'TASK_NAME': 'ocr',
598
  'PATTERN': r'(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>',
599
+ 'AREA_THRESHOLD': 0.00
600
  },
601
  {
602
  'TASK_NAME': 'phrase_grounding',
 
1025
  text,
1026
  pattern=pattern,
1027
  image_size=image_size,
1028
+ area_threshold=self.parse_tasks_configs[task].get('AREA_THRESHOLD', 0.0),
1029
  )
1030
  parsed_dict['ocr'] = instances
1031
  elif task == 'phrase_grounding':
 
1085
  else:
1086
  raise ValueError("task {} is not supported".format(task))
1087
 
1088
+ return parsed_dict