Academic-Hammer / SciTSR

Table structure recognition dataset of the paper: Complicated Table Structure Recognition
https://arxiv.org/pdf/1908.04729.pdf
MIT License
350 stars 57 forks source link

details about vertext and edge features #2

Closed zjuPeco closed 5 years ago

zjuPeco commented 5 years ago

In your paper, you briefly described your input features, but that's a bit confusing to me.

Suppose we have two cells:

[{'pos': [x_min_1, x_max_1, y_min_1, y_max_1], 'text': 'cell_1'},
 {'pos': [x_min_2, x_max_2, y_min_2, y_max_2], 'text': 'cell_2'}]

the coordinate of the table_image is [x_table_min, x_table_max, y_table_min, y_table_max] The corresponding height and width of the pdf_image are h_pdf and w_pdf respectively.

So the vertex and edge features should be?

The following is my guess:

vertex features: 1) the size of cells:

# widths and heights of the cells
[[x_max_1 - xmin_1, y_max_1 - y_min_1], [x_max_2 - xmin_2, y_max_2 - y_min_2]]

2) absolute locations:

[[x_min_1, x_max_1, y_min_1, y_max_1], [x_min_2, x_max_2, y_min_2, y_max_2]]

3) relative locations:

# relative to the size of the pdf_image?
[[x_min_1 / w_pdf, x_max_1 / w_pdf, y_min_1 / h_pdf, y_max_1 / h_pdf], [x_min_2 / w_pdf, x_max_2 / w_pdf, y_min_2 / h_pdf, y_max_2 / h_pdf]]

# or relative to the size of the cropped table_image?
[[(x_min_1 - x_table_min) / (w_table), ...], ...]

edge features: 1) Euclidean distance:

# computed according to the center of the cells?
(((x_max_1 + x_min_1) / 2 - (x_max_2+ x_min_2) / 2)^2 + \
 ((y_max_1 + y_min_1) / 2 - (y_max_2+ y_min_2) / 2)^2)^(0.5)

2) x-axis distance (absolute and relative)

# absolute
abs((x_max_1 + x_min_1) / 2 - (x_max_2+ x_min_2) / 2)

# relative
abs((x_max_1 + x_min_1) / 2 - (x_max_2+ x_min_2) / 2) / w_pdf

3) y-axis distance (absolute and relative)

# absolute
abs((y_max_1 + y_min_1) / 2 - (y_max_2+ y_min_2) / 2)

# relative
abs((y_max_1 + y_min_1) / 2 - (y_max_2+ y_min_2) / 2) / h_pdf

4) overlap of the cell pairs along x-axis and y-axis all absolute values? no relative values this time? for example, the x_o bellow:

--------------------
|      cell_1      |
--------------------
           |<-x_o->|
            --------------------
            |     cell_2       |
           ---------------------

Can you tell me if my "absolute" and "relative" are the same with you? Which one do you use?

And one more question, are the absolute features really needed since we have the relative features?

CZWin32768 commented 5 years ago

We released the feature extraction codes at graph.py.

The "relative" means the distance relative to the size of the table/chunk. I also think the "relative" features are more important, but the model can also benefit from "absolute" features.

CZWin32768 commented 5 years ago

We also perform a feature normalization over training examples by:

def _norm(features, mean, std, eps=1e-6):
  return (features - mean) / (std + 1e-6)
zjuPeco commented 5 years ago

We released the feature extraction codes at graph.py.

The "relative" means the distance relative to the size of the table/chunk. I also think the "relative" features are more important, but the model can also benefit from "absolute" features.

Thank you for your prompt reply!