Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable #25

Closed
xiaoyao9184 opened this issue Nov 30, 2024 · 0 comments · Fixed by #26
Closed

TypeError: 'NoneType' object is not subscriptable #25

xiaoyao9184 opened this issue Nov 30, 2024 · 0 comments · Fixed by #26

Comments

@xiaoyao9184
Copy link

when enabled detect_cell_boxes

tabled_pdf_app  | 2024-11-30 10:55:34.457 Uncaught app exception
tabled_pdf_app  | Traceback (most recent call last):                                                                                                       
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling  
tabled_pdf_app  |     result = func()                                                                                                                      
tabled_pdf_app  |              ^^^^^^                                                                                                                      
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec              
tabled_pdf_app  |     exec(code, module.__dict__)                                                                                                          
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/table_app.py", line 121, in <module>                                                     
tabled_pdf_app  |     out_data = run_table_rec(images[0], highres_images[0], text_lines[0], models, skip_detection=skip_detection, detect_boxes=detect_boxes)                                                                                                                                                         
tabled_pdf_app  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/table_app.py", line 35, in run_table_rec
tabled_pdf_app  |     cells, needs_ocr = get_cells(table_imgs, table_bboxes, highres_image_sizes, table_text_lines, models[0][:2], detect_boxes=detect_boxes)                                                                                                                                                         
tabled_pdf_app  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                         
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/tabled/inference/recognition.py", line 32, in get_cells
tabled_pdf_app  |     det_results = batch_text_detection([table_imgs[i] for i in to_inference_idxs], det_model, det_processor, batch_size=detector_batch_size)                                                                                                                                                        
tabled_pdf_app  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                        
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/surya/detection.py", line 151, in batch_text_detection
tabled_pdf_app  |     for preds, orig_sizes in detection_generator:                                                                                        
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/surya/detection.py", line 92, in batch_detection                                         
tabled_pdf_app  |     pred = model(pixel_values=batch)                                                                                                     
tabled_pdf_app  |            ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                     
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl                            
tabled_pdf_app  |     return self._call_impl(*args, **kwargs)                                                                                              
tabled_pdf_app  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                              
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl                                    
tabled_pdf_app  |     return forward_call(*args, **kwargs)                                                                                                 
tabled_pdf_app  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                 
tabled_pdf_app  |   File "/opt/conda/lib/python3.11/site-packages/surya/model/layout/encoderdecoder.py", line 100, in forward                              
tabled_pdf_app  |     assert decoder_input_boxes[0][0][0] == self.config.decoder_start_token_id                                                            
tabled_pdf_app  |            ~~~~~~~~~~~~~~~~~~~^^^                                                                                                        
tabled_pdf_app  | TypeError: 'NoneType' object is not subscriptable

table_example.png regardless of whether the parameter detect_cell_boxes is used.

'F:\code\@docker\docker-tabled/tabled/extract.py' 'F:\code\@docker\docker-tabled/tabled/static/images/table_example.png' 'F:\code\@docker\docker-tabled/results' '--format' 'markdown' '--save_debug_images' 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant