DevashishPrasad / CascadeTabNet

This repository contains the code and implementation details of the CascadeTabNet paper "CascadeTabNet: An approach for end to end table detection and structure recognition from image-based documents"
MIT License
1.46k stars 422 forks source link

Demo not working properly #172

Open LidorPrototype opened 1 year ago

LidorPrototype commented 1 year ago

I'm trying to run your demo, and I have a few problems.

first of all the command !gdown "https://drive.google.com/u/0/uc?id=1-QieHkR1Q7CXuBu4fp3rYrvDG9j26eFT" does not work, I get an access denied error so I download it manually and after it I get the following error: RuntimeError: unexpected EOF, expected 1939927 more bytes. The file might be corrupted. this is from cell number 4., from the line: model = init_detector(config_file, checkpoint_file, device='cuda:0').

did anyone had this problem before? how one can fix this?

parthplc commented 1 year ago

Any update on this @DevashishPrasad @LidorPrototype ?

lmmlzn commented 1 year ago

Have you sloved it? I have met the same problem. Help. @parthplc @LidorPrototype @DevashishPrasad

LidorPrototype commented 1 year ago

Still no solution sadly :(

parthplc commented 1 year ago

Hey @lmmlzn , I tried with different checkpoints and it worked well for me in colab.

conf_url = 'https://raw.githubusercontent.com/iiLaurens/CascadeTabNet/mmdet2x/Config/cascade_mask_rcnn_hrnetv2p_w32_20e.py'

with open('cascade_mask_rcnn_hrnetv2p_w32_20e.py', 'wb') as f:
  f.write(requests.get(conf_url).content)

checkpoint_url = 'https://github.com/iiLaurens/CascadeTabNet/releases/download/v1.0.0/ICDAR.19.Track.B2.Modern.table.structure.recognition.v2.pth'

with open('ICDAR.19.Track.B2.Modern.table.structure.recognition.v2.pth', 'wb') as f:
  f.write(requests.get(checkpoint_url).content)

demo_img = 'https://github.com/iiLaurens/CascadeTabNet/raw/mmdet2x/Demo/demo.png'

with open('demo.png', 'wb') as f:
  f.write(requests.get(demo_img).content)

use_torchvision=True

config_file = 'cascade_mask_rcnn_hrnetv2p_w32_20e.py'
checkpoint_file = 'ICDAR.19.Track.B2.Modern.table.structure.recognition.v2.pth'
model = init_detector(config_file, checkpoint_file, device='cpu')
img = "demo.png"
result = inference_detector(model, img)
table_coordinates = []
## extracting bordered tables
for bordered_tables in result[0][0]:
  table_coordinates.append(bordered_tables[:4].astype(int))
## extracting borderless tables
for borderless_tables in result[0][2]:
  table_coordinates.append(borderless_tables[:4].astype(int))   
## print tables
print(table_coordinates)
onejlee commented 1 year ago

@parthplc

I tried that solution, below error occurs to me. this error caused by difference version between config file and checkpoint file. I can't find checkpoint file of 1.x version.

TypeError: __init__() got an unexpected keyword argument 'roi_head'

moran-trullion commented 1 year ago

someone solved the issue? probably we need to modify the config file again

parthplc commented 1 year ago

Hey, I have created this sample colab for reference @onejlee @moran-trullion . Link : https://colab.research.google.com/drive/1BnBI4-tBVN8OOUedD652Md4Bd5b9jdzb?usp=sharing

NotAbdelrahmanelsayed commented 1 year ago

@parthplc I cant understand the output where is the table data? [array([217, 63, 499, 360]), array([ 19, 395, 290, 467])]

linkstatic12 commented 12 months ago

Looking in links: https://download.pytorch.org/whl/torch_stable.html ERROR: Could not find a version that satisfies the requirement torch==1.5.1+cpu (from versions: 1.11.0, 1.11.0+cpu, 1.11.0+cu102, 1.11.0+cu113, 1.11.0+cu115, 1.11.0+rocm4.3.1, 1.11.0+rocm4.5.2, 1.12.0, 1.12.0+cpu, 1.12.0+cu102, 1.12.0+cu113, 1.12.0+cu116, 1.12.0+rocm5.0, 1.12.0+rocm5.1.1, 1.12.1, 1.12.1+cpu, 1.12.1+cu102, 1.12.1+cu113, 1.12.1+cu116, 1.12.1+rocm5.0, 1.12.1+rocm5.1.1, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.0+cu117.with.pypi.cudnn, 1.13.0+rocm5.1.1, 1.13.0+rocm5.2, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117, 1.13.1+cu117.with.pypi.cudnn, 1.13.1+rocm5.1.1, 1.13.1+rocm5.2, 2.0.0, 2.0.0+cpu, 2.0.0+cpu.cxx11.abi, 2.0.0+cu117, 2.0.0+cu117.with.pypi.cudnn, 2.0.0+cu118, 2.0.0+rocm5.3, 2.0.0+rocm5.4.2, 2.0.1, 2.0.1+cpu, 2.0.1+cpu.cxx11.abi, 2.0.1+cu117, 2.0.1+cu117.with.pypi.cudnn, 2.0.1+cu118, 2.0.1+rocm5.3, 2.0.1+rocm5.4.2) ERROR: No matching distribution found for torch==1.5.1+cpu

Why does it say "No matching distribution found for torch" on my colab ?

tzktz commented 5 months ago

Hey, I have created this sample colab for reference @onejlee @moran-trullion . Link : https://colab.research.google.com/drive/1BnBI4-tBVN8OOUedD652Md4Bd5b9jdzb?usp=sharing

In config url config file were missing..pls check tat..!!