cs-chan / Total-Text-Dataset

Total Text Dataset. It consists of 1555 images with more than 3 different text orientations: Horizontal, Multi-Oriented, and Curved, one of a kind.
BSD 3-Clause "New" or "Revised" License
747 stars 140 forks source link

bug fix in function one_to_one #21

Closed techkang closed 5 years ago

techkang commented 5 years ago

I think I found a bug in function one_to_one. Suppose there are one predict and two ground truth, the sigma table is [1,1]^T and tau table is [1,0]^T. This is an many to one case but origin code treat it as one to one case.

ckchng commented 5 years ago

Hi there,

Thanks for reporting this. At a quick glance, I don't quite get why is the following line fails to make sure it's a one-to-one case. Do you have some examples on your hand to further illustrate this? Thanks.

(num_qualified_sigma_candidates == 1) and (num_qualified_tau_candidates == 1)

techkang commented 5 years ago

According to det eval paper:

one-to-one matches: one ground truth rectangle Gi matches with a result rectangle Dj if row i of both matrices contains only one element satisfying (10) and column j of both matrices contains only one element satisfying (10). This situation is shown in figure 2a.

I think your code only checked row i of both matrices rather that checked row i and column j of both matrices.

ckchng commented 5 years ago

Hi there,

The first and the third lines are supposed to check all rows and columns of both matrices.

qualified_sigma_candidates = np.where(local_sigma_table[gt_id, :] > tr) num_qualified_sigma_candidates = qualified_sigma_candidates[0].shape[0] qualified_tau_candidates = np.where(local_tau_table[gt_id, :] > tp) num_qualified_tau_candidates = qualified_tau_candidates[0].shape[0]

techkang commented 5 years ago

Hi there,

I think your code go over every row and check elements of each row. But the correct code should be go over each row and check elements of each row. If there is one candidate, check its corresponding column.

ckchng commented 5 years ago

Yea I came to this conclusion as well this morning. I will do a testing and merge / rewrite this part soon. Thank you so much for your effort!