marieai / marie-ai

Integrate AI-powered Document Analysis Pipelines
MIT License
60 stars 5 forks source link

could not broadcast input array from shape (24,356,3) into shape (24,) #106

Closed gregbugaj closed 9 months ago

gregbugaj commented 9 months ago

Describe the bug Exception is being thrown while processing via the OCR Engine

ERROR  marie@32 could not broadcast input array from shape (24,356,3) into shape (24,)                                                                           [01/30/24 14:01:11]
ERROR  marie@32 Extract error                                                                                                                                                       
       Traceback (most recent call last):                                                                                                                                           
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 127, in process_single                                                                         
           results = self.__process_extract_fullpage(                                                                                                                               
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 219, in __process_extract_fullpage                                                             
           raise ex                                                                                                                                                                 
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 191, in __process_extract_fullpage                                                             
           ) = box_processor.extract_bounding_boxes(                                                                                                                                
         File "/opt/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context                                                                    
           return func(*args, **kwargs)                                                                                                                                             
         File "/opt/venv/lib/python3.10/site-packages/marie/boxes/dit/ulim_dit_box_processor.py", line 837, in extract_bounding_boxes                                               
           raise ex                                                                                                                                                                 
         File "/opt/venv/lib/python3.10/site-packages/marie/boxes/dit/ulim_dit_box_processor.py", line 815, in extract_bounding_boxes                                               
           fragments = np.array(fragments, dtype="object")[ind]                                                                                                                     
       ValueError: could not broadcast input array from shape (24,356,3) into shape (24,)                                                                                           
ERROR  marie@32 Extract error                                                                                                                                                       
       Traceback (most recent call last):                                                                                                                                           
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/default_ocr_engine.py", line 86, in extract                                                                         
           return self.process_single(                                                                                                                                              
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 151, in process_single                                                                         
           raise error                                                                                                                                                              
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 127, in process_single                                                                         
           results = self.__process_extract_fullpage(                                                                                                                               
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 219, in __process_extract_fullpage                                                             
           raise ex                                                                                                                                                                 
         File "/opt/venv/lib/python3.10/site-packages/marie/ocr/ocr_engine.py", line 191, in __process_extract_fullpage                                                             
           ) = box_processor.extract_bounding_boxes(                                                                                                                                
         File "/opt/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context                                                                    
           return func(*args, **kwargs)                                                                                                                                             
         File "/opt/venv/lib/python3.10/site-packages/marie/boxes/dit/ulim_dit_box_processor.py", line 837, in extract_bounding_boxes                                               
           raise ex                                                                                                                                                                 
         File "/opt/venv/lib/python3.10/site-packages/marie/boxes/dit/ulim_dit_box_processor.py", line 815, in extract_bounding_boxes                                               
           fragments = np.array(fragments, dtype="object")[ind]                                                                                                                     
       ValueError: could not broadcast input array from shape (24,356,3) into shape (24,)             
ERROR  marie@34 Processing error: request_id: "4e4216e9e3014458ad581a36715fec8f"                                                                                 [01/30/24 14:01:11]
       status {                                                                                                                                                                     
         code: ERROR                                                                                                                                                                
         description: "ValueError(\'Unexpected type\')"                                                                                                                             
         exception {                                                                                                                                                                
           name: "ValueError"                                                                                                                                                       
           args: "Unexpected type"                                                                                                                                                  
           stacks: "Traceback (most recent call last):\n"                                                                                                                           
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\", line 1090, in process_data\n    result =                     
       await self.handle(\n"                                                                                                                                                        
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\", line 719, in handle\n    _ =                                 
       self._set_result(requests, return_data, docs)\n"                                                                                                                             
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\", line 558, in _set_result\n                                   
       requests[0].parameters = params\n"                                                                                                                                           
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/marie/types/request/data.py\", line 316, in parameters\n                                                        
       self.proto_wo_data.parameters.update(parameters)\n"                                                                                                                          
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 522, in update\n                                           
       _SetStructValue(self.fields[key], value)\n"                                                                                                                                  
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 448, in _SetStructValue\n                                  
       struct_value.struct_value.update(value)\n"                                                                                                                                   
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 522, in update\n                                           
       _SetStructValue(self.fields[key], value)\n"                                                                                                                                  
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 448, in _SetStructValue\n                                  
       struct_value.struct_value.update(value)\n"                                                                                                                                   
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 522, in update\n                                           
       _SetStructValue(self.fields[key], value)\n"                                                                                                                                  
           stacks: "  File \"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\", line 453, in _SetStructValue\n    raise                         
       ValueError(\'Unexpected type\')\n"                                                                                                                                           
           stacks: "ValueError: Unexpected type\n"                                                                                                                                  
           executor: "DocumentClassificationExecutor"                                                                                                                               
         }                                                                                                                                                                          
       }                                                                                                                                                                            
       exec_endpoint: "/document/classify"                                                                                                                                          
       target_executor: ""                   

Driver details

Updating job : 195664193, 065b9011-b2a9-717b-8000-75ba92ecb742, classify.failed Incoming message :

Incoming Message : MarieEventNotification{event='classify.failed', status='FAILED', jobid='065b9011-b2a9-717b-8000-75ba92ecb742', jobtag='lbxid', payload={
  "type": "BadServer",
  "message": "request_id: \"4e4216e9e3014458ad581a36715fec8f\"\nstatus {\n  code: ERROR\n  description: \"ValueError(\\'Unexpected type\\')\"\n  exception {\n    name: \"ValueError\"\n    args: \"Unexpected type\"\n    stacks: \"Traceback (most recent call last):\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\\\", line 1090, in process_data\\n    result = await self.handle(\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\\\", line 719, in handle\\n    _ = self._set_result(requests, return_data, docs)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py\\\", line 558, in _set_result\\n    requests[0].parameters = params\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/marie/types/request/data.py\\\", line 316, in parameters\\n    self.proto_wo_data.parameters.update(parameters)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 522, in update\\n    _SetStructValue(self.fields[key], value)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 448, in _SetStructValue\\n    struct_value.struct_value.update(value)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 522, in update\\n    _SetStructValue(self.fields[key], value)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 448, in _SetStructValue\\n    struct_value.struct_value.update(value)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 522, in update\\n    _SetStructValue(self.fields[key], value)\\n\"\n    stacks: \"  File \\\"/opt/venv/lib/python3.10/site-packages/google/protobuf/internal/well_known_types.py\\\", line 453, in _SetStructValue\\n    raise ValueError(\\'Unexpected type\\')\\n\"\n    stacks: \"ValueError: Unexpected type\\n\"\n    executor: \"DocumentClassificationExecutor\"\n  }\n}\nexec_endpoint: \"/document/classify\"\ntarget_executor: \"\"\n",
  "filename": "rest_extension.py",
  "name": "process_request",
  "line_no": 373
}}

Document causing the issue 195664193-0006