marieai / marie-ai

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

Overload resolution failed #104

Closed gregbugaj closed 9 months ago

gregbugaj commented 9 months ago

Describe the bug Certain images cause OpenCV to throw exception, don't have a good example to reproduce currently.

ERROR  extract_t/rep-3@32 error("OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function 'cvtColor'\n> Overload resolution failed:\n>  - src data type = 0 is    [01/23/24 23:04:26]
       not supported\n>  - Expected Ptr<cv::UMat> for argument 'src'\n")                                                                                                            
        add "--quiet-error" to suppress the exception details                                                                                                                       
       Traceback (most recent call last):                                                                                                                                           
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py", line 1090, in process_data                                                  
           result = await self.handle(                                                                                                                                              
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/runtimes/worker/request_handling.py", line 711, in handle                                                         
           return_data = await self._executor.__acall__(                                                                                                                            
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/executors/__init__.py", line 721, in __acall__                                                                    
           return await self.__acall_endpoint__(req_endpoint, **kwargs)                                                                                                             
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/executors/__init__.py", line 853, in __acall_endpoint__                                                           
           return await exec_func(                                                                                                                                                  
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/executors/__init__.py", line 811, in exec_func                                                                    
           return await get_or_reuse_loop().run_in_executor(                                                                                                                        
         File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run                                                                                                   
           result = self.fn(*self.args, **self.kwargs)                                                                                                                              
         File "/opt/venv/lib/python3.10/site-packages/marie/serve/executors/decorators.py", line 324, in arg_wrapper                                                                
           return fn(executor_instance, *args, **kwargs)                                                                                                                            
         File "/opt/venv/lib/python3.10/site-packages/marie/executor/text/text_extraction_executor.py", line 137, in extract                                                        
           docs = docs_from_asset(doc.asset_key, doc.pages)                                                                                                                         
         File "/opt/venv/lib/python3.10/site-packages/marie/utils/docs.py", line 311, in docs_from_asset                                                                            
           loaded, frames = load_image(path)                                                                                                                                        
         File "/opt/venv/lib/python3.10/site-packages/marie/utils/docs.py", line 201, in load_image                                                                                 
           img = cv2.cvtColor(img, cv2.COLOR_GRAY2RGB)                                                                                                                              
       cv2.error: OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function 'cvtColor'                                                                                                
       > Overload resolution failed:                                                                                                                                                
       >  - src data type = 0 is not supported                                                                                                                                      
       >  - Expected Ptr<cv::UMat> for argument 'src'                                                                                                                               

Describe how you solve it N/A