From 4713f24dc1061edb0bc7bb2656017d44ea107e55 Mon Sep 17 00:00:00 2001 From: dyning Date: Wed, 28 Oct 2020 15:56:13 +0800 Subject: [PATCH] add anno for tps --- ppocr/modeling/stns/tps.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) mode change 100755 => 100644 ppocr/modeling/stns/tps.py diff --git a/ppocr/modeling/stns/tps.py b/ppocr/modeling/stns/tps.py old mode 100755 new mode 100644 index 24c6448d..18d0225d --- a/ppocr/modeling/stns/tps.py +++ b/ppocr/modeling/stns/tps.py @@ -70,6 +70,13 @@ class LocalizationNetwork(object): return initial_bias def __call__(self, image): + """ + Estimating parameters of geometric transformation + Args: + image: input + Return: + batch_C_prime: the matrix of the geometric transformation + """ F = self.F loc_lr = self.loc_lr if self.model_name == "large": @@ -215,6 +222,14 @@ class GridGenerator(object): return batch_C_ex_part_tensor def __call__(self, batch_C_prime, I_r_size): + """ + Generate the grid for the grid_sampler. + Args: + batch_C_prime: the matrix of the geometric transformation + I_r_size: the shape of the input image + Return: + batch_P_prime: the grid for the grid_sampler + """ C = self.build_C() P = self.build_P(I_r_size) inv_delta_C = self.build_inv_delta_C(C).astype('float32')