From 8f010ecf1eaa1ba509c0a15f92023b32160ab491 Mon Sep 17 00:00:00 2001 From: Dec20B <1192152456@qq.com> Date: Thu, 17 Aug 2023 15:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E5=AF=BC=E8=87=B4=E7=9A=84DSR=E6=8A=A5=E9=94=99=20(#1?= =?UTF-8?q?0662)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修改数据增强导致的DSR报错 * 错误修改回滚 --- .pre-commit-config.yaml | 2 +- ppocr/data/simple_dataset.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1584bc76..5f7fec8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,4 +32,4 @@ description: Format files with ClangFormat entry: bash .clang_format.hook -i language: system - files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$ + files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$ \ No newline at end of file diff --git a/ppocr/data/simple_dataset.py b/ppocr/data/simple_dataset.py index 044eafe1..f7c4c8f1 100644 --- a/ppocr/data/simple_dataset.py +++ b/ppocr/data/simple_dataset.py @@ -61,9 +61,15 @@ class SimpleDataSet(Dataset): def set_epoch_as_seed(self, seed, dataset_config): if self.mode == 'train': try: - dataset_config['transforms'][5]['MakeBorderMap'][ + border_map_id = [index + for index, dictionary in enumerate(dataset_config['transforms']) + if 'MakeBorderMap' in dictionary][0] + shrink_map_id = [index + for index, dictionary in enumerate(dataset_config['transforms']) + if 'MakeShrinkMap' in dictionary][0] + dataset_config['transforms'][border_map_id]['MakeBorderMap'][ 'epoch'] = seed if seed is not None else 0 - dataset_config['transforms'][6]['MakeShrinkMap'][ + dataset_config['transforms'][shrink_map_id]['MakeShrinkMap'][ 'epoch'] = seed if seed is not None else 0 except Exception as E: print(E) -- GitLab