Skip to content

Commit

Permalink
fix numpy speed (#10773)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghuancoder authored Aug 29, 2023
1 parent b3912fc commit 1046c23
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ppocr/losses/distillation_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ def forward(self, predicts, batch):
# dilation to teacher prediction
dilation_w = np.array([[1, 1], [1, 1]])
th_shrink_maps = tch_preds[:, 0, :, :]
if hasattr(paddle.Tensor, "contiguous"):
th_shrink_maps = th_shrink_maps.contiguous()
th_shrink_maps = th_shrink_maps.numpy() > 0.3 # thresh = 0.3
dilate_maps = np.zeros_like(th_shrink_maps).astype(np.float32)
for i in range(th_shrink_maps.shape[0]):
Expand Down

0 comments on commit 1046c23

Please sign in to comment.