marieai / marie-ai

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

src data type = 17 is not supported #107

Closed gregbugaj closed 9 months ago

gregbugaj commented 9 months ago

Describe the bug Getting an exception while generating an OCR

aceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/marie/document/trocr_ocr_processor.py", line 305, in __recognize_from_fragments
    images = [img for img, img_name in eval_data]
  File "/opt/venv/lib/python3.10/site-packages/marie/document/trocr_ocr_processor.py", line 305, in <listcomp>
    images = [img for img, img_name in eval_data]
  File "/opt/venv/lib/python3.10/site-packages/marie/models/icr/memory_dataset.py", line 48, in __getitem__
    raise e
  File "/opt/venv/lib/python3.10/site-packages/marie/models/icr/memory_dataset.py", line 45, in __getitem__
    image = cv2.cvtColor(image, code=cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
>  - src data type = 17 is not supported
>  - Expected Ptr<cv::UMat> for argument 'src'

ERROR  marie@30 OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function 'cvtColor'                                                                               [01/30/24 00:47:18]
       > Overload resolution failed:                                                                                                                                                
       >  - src data type = 17 is not supported                                                                                                                                     
       >  - Expected Ptr<cv::UMat> for argument 'src'                                                                                                                               

ERROR  marie@30 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 195, in __process_extract_fullpage                                                             
           result, overlay_image = icr_processor.recognize(                                                                                                                         
         File "/opt/venv/lib/python3.10/site-packages/marie/document/ocr_processor.py", line 153, in recognize                                                                      
           results = self.recognize_from_fragments(fragments)                                                                                                                       
         File "/opt/venv/lib/python3.10/site-packages/marie/document/trocr_ocr_processor.py", line 250, in recognize_from_fragments                                                 
           result = self.__recognize_from_fragments(src_images, batch_size, **kwargs)                                                                                               
         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/document/trocr_ocr_processor.py", line 347, in __recognize_from_fragments                                               
           raise ex                                                                                                                                                                 
         File "/opt/venv/lib/python3.10/site-packages/marie/document/trocr_ocr_processor.py", line 305, in __recognize_from_fragments                                               
           images = [img for img, img_name in eval_data]                                                                                                                            
         File "/opt/venv/lib/python3.10/site-packages/marie/document/trocr_ocr_processor.py", line 305, in <listcomp>                                                               
           images = [img for img, img_name in eval_data]                                                                                                                            
         File "/opt/venv/lib/python3.10/site-packages/marie/models/icr/memory_dataset.py", line 48, in __getitem__                                                                  
           raise e                                                                                                                                                                  
         File "/opt/venv/lib/python3.10/site-packages/marie/models/icr/memory_dataset.py", line 45, in __getitem__                                                                  
           image = cv2.cvtColor(image, code=cv2.COLOR_BGR2RGB)                                                                                                                      
       cv2.error: OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function 'cvtColor'                                                                                                
       > Overload resolution failed:                                                                                                                                                
       >  - src data type = 17 is not supported                                                                                                                                     
       >  - Expected Ptr<cv::UMat> for argument 'src'                             

ref id :195668453

Document causing this 195668453-0004