update_ocr_postprocess (#19)
Browse files- update ocr post-process (f760c1169c8d20836a36d138b22050017066e6b2)
Co-authored-by: Haiping Wu <haipingwu@users.noreply.huggingface.co>
- 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. | 
| 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. | 
| 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
         | 
