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.5k stars 430 forks source link

How to crop out the detected tables ? #156

Open Yugabharathi opened 2 years ago

Yugabharathi commented 2 years ago

We were able to detect the tables properly but we also want the coordinates of the table for further process .can you give us a any solution to get the coordinates of detected tables ?

mohit-217 commented 2 years ago

@Yugabharathi you are getting the coordinates of the tabular region. I am writing one blog post in which end to end implementation. I will provide from model loading on CPU as well as GPU for Linux as well as windows.

PoornaSaiNagendra commented 2 years ago

Hi @themohitkumar,

Could you share the link to the blog post once u finished writing? Thanks in advance :)

nidhiipatelll commented 2 years ago

We were able to detect the tables properly but we also want the coordinates of the table for further process .can you give us a any solution to get the coordinates of detected tables ?

same here

shivam07a commented 2 years ago

@Yugabharathi Using the below code snippet after having done inference one can extract table co-ordinates

from numpy import array, float32

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
for table in table_coordinates:
    x1 = table[0]
    x2 = table[2]
    y1 = table[1]
    y2 = table[3]

    print(f"Table with start co-ordinate ({x1}, {y1}) and end co-ordinate ({x2}, {y2})" %x1 %y1 %x2 %y2)
parthplc commented 2 years ago

Hey @shivam07a , How to get threshold for each table with this? Any idea? Also how you know how to interpret result variable

AGRocky commented 1 year ago

with the given coordinate how to extract the table image?

phamkhactu commented 5 months ago

Hi @shivam07a,

How can I get confidence score for each table in result? I am very happy if you give me example code.

Thanks