TextField icon indicating copy to clipboard operation
TextField copied to clipboard

Question about the post processing.

Open zeng-hello-world opened this issue 5 years ago • 1 comments

Hi, TextField is a great work, but I'm confused about the post processing:

We apply a simple dilation δ (with 3 × 3 structuring element) to group the representatives of the same text instance. This is followed by a connected component labeling that forms candidate text instances. The text superpixel grouping is depicted in line 17- 21 of Algorithm 1.

and I found these in your post processing code:

for (int row = 0; row < rows_; row++)
        {
            float* ending_p = ending.ptr<float>(row);
            float* parent_p = parent.ptr<float>(row);
            float* dict_p = dict.ptr<float>(row);
            for (int col = 0; col < cols_; col++)
            {
                if (ending_p[col] == 1)
                {
                    for (int dilDepth = 1; dilDepth <= min((int)(1*dict_p[2*col+1]-16), 12); dilDepth++)  //
                    {
                        p.x = row+(int)parent_p[2*col]*dilDepth;
                        p.y = col+(int)parent_p[2*col+1]*dilDepth;
                        if (p.x >= 0 && p.x <= rows_-1 && pt.y >= 0 && pt.y <= cols_-1)
                        {
                            float* merged_ending_p = merged_ending.ptr<float>(p.x);
                            merged_ending_p[p.y] = 1;
                        }
                    }
                }
            }
        }

I understand that the dilate element kernel_size = 3x3 is for grouping the representatives of text instance, and the above code is for grouping the rest children pixels belonging to this instance, but I don't understand this: for (int dilDepth = 1; dilDepth <= min((int)(1*dict_p[2*col+1]-16), 12); dilDepth++) , and dilDepth stands for the deepest depth, but the magic numbers 16 and 12 represent for what meaning?

Thanks in advance for your reply!

zeng-hello-world avatar May 24 '19 07:05 zeng-hello-world

Sorry for replying late.

These lines are added for robustness since the representatives may not quite close to each other for some large text instances. Here, dict_p also stores the depth (the number of child nodes) of each representative. I use another dilation-like operation only in its direction and dilDepth limits the dilation depth. For the two hyper-parameters 16 and 12, they are coarsely chosen actually. I am sorry for these missing details in our paper.

YukangWang avatar Jun 03 '19 03:06 YukangWang