From 59a54df43a000f08b8310c4af7065d18ed3bdb62 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Tue, 22 Oct 2024 10:27:45 +0800 Subject: [PATCH] [cherry-pick] fix isnan is not supported and update pyproject (#14061) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix isnan_v2 is not supported in paddle2onnx (#14060) * Update pyproject.toml for add dependency (#14058) * Update pyproject.toml * Update pyproject.toml --------- Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com> --- ppocr/modeling/heads/det_db_head.py | 4 ++++ pyproject.toml | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ppocr/modeling/heads/det_db_head.py b/ppocr/modeling/heads/det_db_head.py index 8f41a25b01..0f56f25fb4 100644 --- a/ppocr/modeling/heads/det_db_head.py +++ b/ppocr/modeling/heads/det_db_head.py @@ -76,8 +76,12 @@ def __init__(self, in_channels, kernel_list=[3, 2, 2], **kwargs): def forward(self, x, return_f=False): x = self.conv1(x) x = self.conv_bn1(x) + if self.training: + x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x) x = self.conv2(x) x = self.conv_bn2(x) + if self.training: + x = paddle.where(paddle.isnan(x), paddle.zeros_like(x), x) if return_f is True: f = x x = self.conv3(x) diff --git a/pyproject.toml b/pyproject.toml index 5dc7232217..cce91bfb0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,9 @@ dependencies = [ "beautifulsoup4", "fonttools>=4.24.0", "fire>=0.3.0", - "requests" + "requests", + "albumentations==1.4.10", + "albucore==0.0.13" ] [project.urls]