jainammm / TableNet

Unofficial implementation of "TableNet: Deep Learning model for end-to-end Table detection and Tabular data extraction from Scanned Document Images"
320 stars 72 forks source link

How to get row after recognize the table and columns #8

Open ai1361720220000 opened 3 years ago

ai1361720220000 commented 3 years ago

Hello, thanks for your sharing of this project. I follow the notebook and it could output the table and its column masks .But how can i get row of each table or each cell in this table.

shivakumar-np commented 3 years ago

Hi @ai1361720220000, I am facing problem while mapping the process_path function, could you please help me with this issue? It's showing 'list' object has no attribute 'map'. Also what should be assigned to list_ds? Thank you in advance!!! :)

ai1361720220000 commented 3 years ago

Hi @ai1361720220000, I am facing problem while mapping the process_path function, could you please help me with this issue? It's showing 'list' object has no attribute 'map'. Also what should be assigned to list_ds? Thank you in advance!!! :)

I think you have to process your data. The format of image in Marmot is 'bmp' while you have to transfer to 'jpg' first, otherwise the process_path function will wrong.

JimHaung commented 3 years ago

I got the problem in process_path ,too . I have change data from "bmp" to "jpg" , but I got the error "Expected image (JPEG, PNG, or GIF), got unknown format starting with 'BM6\2304\000\000\000\000\0006\000\000\000(\000' [[{{node DecodeJpeg}}]]"

thanks

shivakumar-np commented 3 years ago

Hi @ai1361720220000, I am facing problem while mapping the process_path function, could you please help me with this issue? It's showing 'list' object has no attribute 'map'. Also what should be assigned to list_ds? Thank you in advance!!! :)

I think you have to process your data. The format of image in Marmot is 'bmp' while you have to transfer to 'jpg' first, otherwise the process_path function will wrong.

Thank you for replying. Then should I convert .xml files also to .jpeg format? Also what is list_ds?

shivakumar-np commented 3 years ago

I got the problem in process_path ,too . I have change data from "bmp" to "jpg" , but I got the error "Expected image (JPEG, PNG, or GIF), got unknown format starting with 'BM6\2304\000\000\000\000\0006\000\000\000(\000' [[{{node DecodeJpeg}}]]"

thanks

I also got the same error. If you resolve it please inform me.

ai1361720220000 commented 3 years ago

I got the problem in process_path ,too . I have change data from "bmp" to "jpg" , but I got the error "Expected image (JPEG, PNG, or GIF), got unknown format starting with 'BM6\2304\000\000\000\000\0006\000\000\000(\000' [[{{node DecodeJpeg}}]]" thanks

I also got the same error. If you resolve it please inform me.

i just transform the format of image to "jpeg" and they are saved in the "Marmot_data_modified" file and you also have to modifed the path name as below in table_mask_file_path and column_mask_file_path. In addition, make sure your tf version is 2.2.0. list_ds is a tf tensor which saved training .xml files.

list_ds = tf.data.Dataset.list_files('../dataset/Marmot/Marmot_data_modified/*.xml')

def process_path(file_path):
  file_path = tf.strings.regex_replace(file_path, '.xml', '.jpg')
  mask_file_path = tf.strings.regex_replace(file_path, '.jpg', '.jpeg')

  table_mask_file_path = tf.strings.regex_replace(mask_file_path, 'Marmot_data_modified', 'table_mask')
  column_mask_file_path = tf.strings.regex_replace(mask_file_path, 'Marmot_data_modified', 'column_mask')

  img = normalize(decode_img(tf.io.read_file(file_path)))

  table_mask = normalize(decode_mask_img(tf.io.read_file(table_mask_file_path)))
  column_mask = normalize(decode_mask_img(tf.io.read_file(column_mask_file_path)))

  return img, {"table_output" : table_mask, "column_output" : column_mask }
ai1361720220000 commented 3 years ago

I got the problem in process_path ,too . I have change data from "bmp" to "jpg" , but I got the error "Expected image (JPEG, PNG, or GIF), got unknown format starting with 'BM6\2304\000\000\000\000\0006\000\000\000(\000' [[{{node DecodeJpeg}}]]"

thanks

you can try as i said above

shivakumar-np commented 3 years ago

Hi @ai1361720220000, thank you for your solution. I got it working. So now I am trying to extract the coordinates of the table and column from the image predictions i.e., I want table and column coordinates as output from tablenet for data extraction, if you have any idea about how to get it, can you share? Again Thanks for your help in advance!! :)