From 5a9c8e49ac166262b5e2ea1196c90ab54b7720da Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Wed, 20 Jan 2021 18:23:29 +0800 Subject: [PATCH] tps export down --- ppocr/modeling/transforms/tps.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ppocr/modeling/transforms/tps.py b/ppocr/modeling/transforms/tps.py index 3de25193..78338edf 100644 --- a/ppocr/modeling/transforms/tps.py +++ b/ppocr/modeling/transforms/tps.py @@ -213,16 +213,14 @@ class GridGenerator(nn.Layer): def build_P_paddle(self, I_r_size): I_r_height, I_r_width = I_r_size - I_r_grid_x = paddle.divide( - paddle.arange( - -I_r_width, I_r_width, 2, dtype='float64') + 1.0, - paddle.to_tensor( - I_r_width, dtype='float64')) - I_r_grid_y = paddle.divide( - paddle.arange( - -I_r_height, I_r_height, 2, dtype='float64') + 1.0, - paddle.to_tensor( - I_r_height, dtype='float64')) # self.I_r_height + I_r_grid_x = (paddle.arange( + -I_r_width, I_r_width, 2, dtype='float64') + 1.0 + ) / paddle.to_tensor(np.array([I_r_width])) + + I_r_grid_y = (paddle.arange( + -I_r_height, I_r_height, 2, dtype='float64') + 1.0 + ) / paddle.to_tensor(np.array([I_r_height])) + # P: self.I_r_width x self.I_r_height x 2 P = paddle.stack(paddle.meshgrid(I_r_grid_x, I_r_grid_y), axis=2) P = paddle.transpose(P, perm=[1, 0, 2]) -- GitLab