From 16c5aa33bb9fb582c1e313612370901e61ee8461 Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Thu, 10 Jul 2025 16:58:39 +0800 Subject: [PATCH 1/7] add copyright --- .DS_Store | Bin 0 -> 8196 bytes configs/.DS_Store | Bin 0 -> 6148 bytes deploy/.DS_Store | Bin 0 -> 6148 bytes .../postprocess/det_db_postprocess.py | 17 ++++++++ .../postprocess/det_east_postprocess.py | 17 ++++++++ .../postprocess/det_sast_postprocess.py | 17 ++++++++ docs/.DS_Store | Bin 0 -> 6148 bytes mindocr/.DS_Store | Bin 0 -> 8196 bytes mindocr/data/layout_dataset.py | 5 +++ .../data/transforms/rec_abinet_transforms.py | 3 ++ mindocr/data/transforms/rec_transforms.py | 16 +++++++ mindocr/data/transforms/svtr_transform.py | 16 +++++++ mindocr/data/transforms/table_transform.py | 17 ++++++++ mindocr/models/backbones/blocks/magca.py | 3 ++ .../models/backbones/layoutlmv3/layoutlmv3.py | 2 + .../backbones/layoutxlm/configuration.py | 17 ++++++++ mindocr/models/backbones/layoutxlm/resnet.py | 5 +++ .../models/backbones/layoutxlm/tokenizer.py | 18 ++++++++ .../backbones/layoutxlm/tokenizer_utils.py | 20 +++++++++ .../layoutxlm/tokenizer_utils_base.py | 20 +++++++++ mindocr/models/backbones/layoutxlm/utils.py | 17 ++++++++ .../backbones/layoutxlm/visual_backbone.py | 5 +++ mindocr/models/backbones/layoutxlm/vocab.py | 17 ++++++++ .../models/backbones/mindcv_models/coat.py | 7 +++ .../backbones/mindcv_models/crossvit.py | 26 +++++++++-- .../backbones/mindcv_models/densenet.py | 9 ++-- .../backbones/mindcv_models/efficientnet.py | 41 +++++++++++++++++- .../backbones/mindcv_models/ghostnet.py | 15 ++++++- .../models/backbones/mindcv_models/hrnet.py | 14 ++++-- .../mindcv_models/layers/selective_kernel.py | 5 +++ mindocr/models/backbones/mindcv_models/pit.py | 17 ++++++-- .../models/backbones/mindcv_models/pnasnet.py | 10 ++++- .../backbones/mindcv_models/poolformer.py | 26 +++++++++-- .../models/backbones/mindcv_models/pvtv2.py | 21 +++++++-- .../backbones/mindcv_models/registry.py | 6 +++ .../models/backbones/mindcv_models/resnest.py | 13 ++++-- .../models/backbones/mindcv_models/senet.py | 15 ++++++- .../backbones/mindcv_models/xception.py | 25 ++++++++++- .../models/backbones/mindcv_models/xcit.py | 17 ++++++-- mindocr/models/backbones/rec_resnet.py | 22 ++++++++++ mindocr/models/backbones/rec_svtr_enhance.py | 20 +++++++++ .../backbones/transformer_common/layer.py | 18 ++++++++ mindocr/nlp/generation/beam_search.py | 19 ++++++++ mindocr/nlp/llm/qwen_tokenizer.py | 18 ++++++++ mindocr/postprocess/det_db_postprocess.py | 3 ++ mindocr/postprocess/det_east_postprocess.py | 3 ++ mindocr/postprocess/det_pse_postprocess.py | 3 ++ mindocr/postprocess/kie_ser_postprocess.py | 17 ++++++++ mindocr/postprocess/pse/pse.pyx | 1 + mindocr/postprocess/rec_postprocess.py | 18 +++++++- mindocr/postprocess/table_postprocess.py | 17 ++++++++ mindocr/utils/visualize.py | 17 ++++++++ tests/.DS_Store | Bin 0 -> 6148 bytes tools/.DS_Store | Bin 0 -> 6148 bytes tools/infer/text/utils/matcher.py | 2 + tools/infer/text/utils/table_process.py | 19 ++++++++ 56 files changed, 662 insertions(+), 34 deletions(-) create mode 100644 .DS_Store create mode 100644 configs/.DS_Store create mode 100644 deploy/.DS_Store create mode 100644 docs/.DS_Store create mode 100644 mindocr/.DS_Store create mode 100644 tests/.DS_Store create mode 100644 tools/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c1445e092d2a7075338779158065cf66e70b0a39 GIT binary patch literal 8196 zcmeHMO=uHA6n>+dG-AYpC_VVIU=a^eQc)34Ye^4^w}O{~G-+ZINV;j8g5DPKA_(3T z!HeKQ(SzP99z?-{r}iLt6VZ#ecu_$I|ZBqTT%hJKlnJL4UCPnRa*x-RRX|z7*-AEqw)mSH#RUf(iR>xp+jMH zs4yjl(BT;O4K6S?(pHC)FvW*3nT4rPgvyTjeFY~GXzO~XfKwo@fUMm;nxGmrsKe`b z@j8Ei`&wbKSZ;=8jO8+ieyx7~uy)q=SBCoA_5Qm7@$D-@Y2;5{s?!RUd3Nj~kKzc< z;oYUvCuZx4!@xYPu+JnN#rf#%jWXcVpbAx~WOF(E5nPy;^O#tBu=?z#;$b2B9Fh@s z{s;-6$2^6!K$pRyM#~n5QnwyQa2{FjdVc?XqlYyQ*CQQe@u_S`K3Szjo0?#C)naq( z)xkkO=Q95N+<9|ttT{N7G>paL_*2Ql1CJ2e*or)yUgtiZ|Hs8{@Oag%PZP^?C;6?s zPXd`Yhm~-JO4K5$L3JSi-t|*S7|!GUr`sD}^cs!L#rX`wS-kemNnRsh)WAB?zii36 zGDmi0;|R`aCDZ8NH`Y9yQ98=vQ)o**d0K)xi@1jy>a2xt3)C6Vi^S|OEa!M~Pjtqt zpVYZI+rPnEys030d$bJ39jaOiN)PjKUiZeMm%Hznb!B2Xk0igHSIwP~Igxu%A@Aoc z_?egIetV;L-7G|ZpGiho`7`RimhmAz&4DX4a`djrZ@fJJh39X&*It-?t{2aLeKNwz zzr$AoxNcJ@uwAnlllA{}`uqP)!PSv)3OEJ+jRL|e&J?FGx2dgTS!Av4B?)mSY|7!Vd+3q*$i02&u literal 0 HcmV?d00001 diff --git a/configs/.DS_Store b/configs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ebfd324facb32876e49dfac98f5c61188504f11b GIT binary patch literal 6148 zcmeHLF-yZh6nJ>A|mg>-Iv~X@4mdRB-bkdh{mW>0Vo1M0UM#afZdcJo?0g6 z^vDvTpfxJZcHAFi=J5bKzz+OP2k6;#pbb4Z=^dEQZ~Z1^`f(71y*R{?LNKmX_qyW^ zlkI%N4!Y*5+n9!W9f)9P={Z*)DP!u@N^kY$Ypo~q`f;k4Wi37TUg;gdAw-s5`MfIi zBxCA5tQdNlP4%*@rB{9;y*#?P52p~rXrju}+WRDLY9H=yMRymnR%;Ej;#qU7`zR%J z9}XO&&uy#je0Y{JruOR2diuS}JX1BxT6*&>(#ydR>khGc+w0tGWV5F3W#RGmlXIT1qlIQrL1Gr~X6c!b7&knEy?7)`;^nUQL5&9Yvh4R&bojd{{x;QKYuZwhn z=xOvdCJK?k5GoZ>r3!t-5GozVJw4CYm?%`~Afz&`qm_j|p$Msta9+i~#GAhgT7U^=As+js(>n>3ak|1??VP>%pJCZ_S1pEUIBnTgsoxD zcL}b^9Oe#NL9D=xlmeyHxGRQ{a>O&2mpg0)rJRhrd>F@U+zrK8cI=Gu17Sfo#?fGY5>6fnJ_EQUCe>#d!`aj(tbBRCu9wSub>Ol&JgF1O-C bxHZHxo&a-)tso*W{Ucyy&_NaWQw6>O>04mX literal 0 HcmV?d00001 diff --git a/mindocr/.DS_Store b/mindocr/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a2fd00913489c05df648fdb41c9150d76347725f GIT binary patch literal 8196 zcmeHMJ#Q015S_Kp!6+$G286^Fsi+(&Kj4UrgrH0l0YXmhqMVVBvmCnv>4Zd2NlO7u zqzI@eKy(yT`~^B1BzhX&>~7Ax_YpdTVAk4wr=6LdcW+ld&zXqS&LY_&+90AnI^+5( zhK9y=?zPsjGn+t#c$yq-?Z$aFt$E6XC?E=m0-}H@APW2~3gDT|t>5z8H&z)%0a4(; zRDi!9LUhK+Vqs8!bzsmX05HI`Zn$3O3t(t5vRD{|1x=Yypb1sB#84(2^P%;NEEWb$ zI4N6vD4SW?3PtJcSU=S6q#}bdiUOiQT>-A$14?M0=CtqC@4@CZ*OukO;lU(7z+8X( z!;k3X-KXomJvrAtO`UfGy#YdLg(j5KF+PWM?B%Afx2twH|HnJ&=gV((es7H|Uvg;k z@pvfB;{s)1FsB)fDXub!pMXil!{ze$S+REIh2~Q8TC!>P^7zneqe})|5^$PS*j&2x zUhCr6T`q&~<-V-op2{^`UD|v+9#Cy$E(OrC^!R0y}j`Gherxr_Ek2&!6|wvwdq=&*gZ& zr^k;9=GOx&-p%SMR(or{)#dZ%RjHd3@A7E&@bY&C_UD5<|9K;%i2@A@bj{ob*Z()# z-~Ts6%9JP|3j8Yys9?A|+`--0+PZdMTx*BuBXn-;R~XbG7}$m9bvX_!|1iXLXl;?j T!XPYY@*+UXAcH9IM-})5D3&kI literal 0 HcmV?d00001 diff --git a/mindocr/data/layout_dataset.py b/mindocr/data/layout_dataset.py index 49fc72014..424f71d4f 100644 --- a/mindocr/data/layout_dataset.py +++ b/mindocr/data/layout_dataset.py @@ -1,3 +1,8 @@ +# This code is adapted from https://github.com/ultralytics/yolov5 +# with modifications to run on MindSpore. + +# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license + import glob import hashlib import json diff --git a/mindocr/data/transforms/rec_abinet_transforms.py b/mindocr/data/transforms/rec_abinet_transforms.py index 95a0ae386..f75769ce4 100644 --- a/mindocr/data/transforms/rec_abinet_transforms.py +++ b/mindocr/data/transforms/rec_abinet_transforms.py @@ -1,3 +1,6 @@ +# This code is adapted from https://github.com/FangShancheng/ABINet +# with modifications to run on MindSpore. + """ transform for text recognition tasks. """ diff --git a/mindocr/data/transforms/rec_transforms.py b/mindocr/data/transforms/rec_transforms.py index f0db1485f..fa1e95727 100644 --- a/mindocr/data/transforms/rec_transforms.py +++ b/mindocr/data/transforms/rec_transforms.py @@ -1,3 +1,19 @@ +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ transform for text recognition tasks. """ diff --git a/mindocr/data/transforms/svtr_transform.py b/mindocr/data/transforms/svtr_transform.py index 4281c5261..1e294eed8 100644 --- a/mindocr/data/transforms/svtr_transform.py +++ b/mindocr/data/transforms/svtr_transform.py @@ -1,3 +1,19 @@ +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import copy import logging import math diff --git a/mindocr/data/transforms/table_transform.py b/mindocr/data/transforms/table_transform.py index 78fea3461..1f9a7569f 100644 --- a/mindocr/data/transforms/table_transform.py +++ b/mindocr/data/transforms/table_transform.py @@ -1,3 +1,20 @@ +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import logging import cv2 diff --git a/mindocr/models/backbones/blocks/magca.py b/mindocr/models/backbones/blocks/magca.py index 7e51f5ca9..1650a5eab 100644 --- a/mindocr/models/backbones/blocks/magca.py +++ b/mindocr/models/backbones/blocks/magca.py @@ -1,3 +1,6 @@ +# This code is adapted from https://github.com/JiaquanYe/TableMASTER-mmocr +# with modifications to run on MindSpore. + import mindspore.nn as nn import mindspore.ops as ops from mindspore import Tensor diff --git a/mindocr/models/backbones/layoutlmv3/layoutlmv3.py b/mindocr/models/backbones/layoutlmv3/layoutlmv3.py index 1a1f52516..e86b23b0e 100644 --- a/mindocr/models/backbones/layoutlmv3/layoutlmv3.py +++ b/mindocr/models/backbones/layoutlmv3/layoutlmv3.py @@ -637,6 +637,8 @@ def construct( return (sequence_output,) + encoder_outputs[1:] +# This code is adapted from +# https://github.com/facebookresearch/detectron2/blob/main/detectron2/modeling/backbone/fpn.py class FPNForLayout(FPN): def __init__(self, bottom_up, diff --git a/mindocr/models/backbones/layoutxlm/configuration.py b/mindocr/models/backbones/layoutxlm/configuration.py index ece3b3b7b..e0741c331 100644 --- a/mindocr/models/backbones/layoutxlm/configuration.py +++ b/mindocr/models/backbones/layoutxlm/configuration.py @@ -1,3 +1,20 @@ +# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from dataclasses import dataclass diff --git a/mindocr/models/backbones/layoutxlm/resnet.py b/mindocr/models/backbones/layoutxlm/resnet.py index e4ca7cd56..19a5b8431 100644 --- a/mindocr/models/backbones/layoutxlm/resnet.py +++ b/mindocr/models/backbones/layoutxlm/resnet.py @@ -1,3 +1,8 @@ +# This code is adapted from https://github.com/facebookresearch/detectron2 +# with modifications to run on MindSpore. + +# Copyright (c) Facebook, Inc. and its affiliates. + from dataclasses import dataclass from typing import Optional diff --git a/mindocr/models/backbones/layoutxlm/tokenizer.py b/mindocr/models/backbones/layoutxlm/tokenizer.py index 739e05eee..db7868dbc 100644 --- a/mindocr/models/backbones/layoutxlm/tokenizer.py +++ b/mindocr/models/backbones/layoutxlm/tokenizer.py @@ -1,3 +1,21 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from typing import List, Optional import sentencepiece as spm diff --git a/mindocr/models/backbones/layoutxlm/tokenizer_utils.py b/mindocr/models/backbones/layoutxlm/tokenizer_utils.py index d1eb9cb02..dd72bc318 100644 --- a/mindocr/models/backbones/layoutxlm/tokenizer_utils.py +++ b/mindocr/models/backbones/layoutxlm/tokenizer_utils.py @@ -1,3 +1,23 @@ +# coding=utf-8 +# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. +# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import bisect import io import itertools diff --git a/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py b/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py index b4870bf70..1a670a01e 100644 --- a/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py +++ b/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py @@ -1,3 +1,23 @@ +# coding=utf-8 +# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. +# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import copy import io import json diff --git a/mindocr/models/backbones/layoutxlm/utils.py b/mindocr/models/backbones/layoutxlm/utils.py index 54bff0364..a141dbe99 100644 --- a/mindocr/models/backbones/layoutxlm/utils.py +++ b/mindocr/models/backbones/layoutxlm/utils.py @@ -1,3 +1,20 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import functools import inspect import os diff --git a/mindocr/models/backbones/layoutxlm/visual_backbone.py b/mindocr/models/backbones/layoutxlm/visual_backbone.py index 4155c6212..f3b1f7d10 100644 --- a/mindocr/models/backbones/layoutxlm/visual_backbone.py +++ b/mindocr/models/backbones/layoutxlm/visual_backbone.py @@ -1,3 +1,8 @@ +# This code is adapted from https://github.com/facebookresearch/detectron2 +# with modifications to run on MindSpore. + +# Copyright (c) Facebook, Inc. and its affiliates. + import math import os diff --git a/mindocr/models/backbones/layoutxlm/vocab.py b/mindocr/models/backbones/layoutxlm/vocab.py index 02c6b7958..5809d77a9 100644 --- a/mindocr/models/backbones/layoutxlm/vocab.py +++ b/mindocr/models/backbones/layoutxlm/vocab.py @@ -1,3 +1,20 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleNLP +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import collections import io import json diff --git a/mindocr/models/backbones/mindcv_models/coat.py b/mindocr/models/backbones/mindcv_models/coat.py index 0980c808e..b841f15db 100644 --- a/mindocr/models/backbones/mindcv_models/coat.py +++ b/mindocr/models/backbones/mindcv_models/coat.py @@ -1,5 +1,12 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. """ CoaT architecture. + +Paper: Co-Scale Conv-Attentional Image Transformers - https://arxiv.org/abs/2104.06399 + +Official CoaT code at: https://github.com/mlpc-ucsd/CoaT + Modified from timm/models/vision_transformer.py """ from typing import Union diff --git a/mindocr/models/backbones/mindcv_models/crossvit.py b/mindocr/models/backbones/mindcv_models/crossvit.py index 5b9b156a6..5f3f5d31f 100644 --- a/mindocr/models/backbones/mindcv_models/crossvit.py +++ b/mindocr/models/backbones/mindcv_models/crossvit.py @@ -1,7 +1,27 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" CrossViT Model + +@inproceedings{ + chen2021crossvit, + title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, + author={Chun-Fu (Richard) Chen and Quanfu Fan and Rameswar Panda}, + booktitle={International Conference on Computer Vision (ICCV)}, + year={2021} +} + +Paper link: https://arxiv.org/abs/2103.14899 +Original code: https://github.com/IBM/CrossViT/blob/main/models/crossvit.py + +NOTE: model names have been renamed from originals to represent actual input res all *_224 -> *_240 and *_384 -> *_408 + +Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman +Modified from Timm. https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py """ -MindSpore implementation of `crossvit`. -Refer to crossvit: Cross-Attention Multi-Scale Vision Transformer for Image Classification -""" + +# Copyright IBM All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 import numpy as np diff --git a/mindocr/models/backbones/mindcv_models/densenet.py b/mindocr/models/backbones/mindcv_models/densenet.py index 51e1d705d..e5c63a7a5 100644 --- a/mindocr/models/backbones/mindcv_models/densenet.py +++ b/mindocr/models/backbones/mindcv_models/densenet.py @@ -1,6 +1,9 @@ -""" -MindSpore implementation of `DenseNet`. -Refer to: Densely Connected Convolutional Networks +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +"""Pytorch Densenet implementation w/ tweaks +This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with +fixed kwargs passthrough and addition of dynamic global avg/max pool. """ import math diff --git a/mindocr/models/backbones/mindcv_models/efficientnet.py b/mindocr/models/backbones/mindcv_models/efficientnet.py index 3216d3d19..83c21d33e 100644 --- a/mindocr/models/backbones/mindcv_models/efficientnet.py +++ b/mindocr/models/backbones/mindcv_models/efficientnet.py @@ -1,4 +1,43 @@ -"""EfficientNet Architecture.""" +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" The EfficientNet Family in PyTorch + +An implementation of EfficienNet that covers variety of related models with efficient architectures: + +* EfficientNet-V2 + - `EfficientNetV2: Smaller Models and Faster Training` - https://arxiv.org/abs/2104.00298 + +* EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/AdvProp/NoisyStudent weight ports) + - EfficientNet: Rethinking Model Scaling for CNNs - https://arxiv.org/abs/1905.11946 + - CondConv: Conditionally Parameterized Convolutions for Efficient Inference - https://arxiv.org/abs/1904.04971 + - Adversarial Examples Improve Image Recognition - https://arxiv.org/abs/1911.09665 + - Self-training with Noisy Student improves ImageNet classification - https://arxiv.org/abs/1911.04252 + +* MixNet (Small, Medium, and Large) + - MixConv: Mixed Depthwise Convolutional Kernels - https://arxiv.org/abs/1907.09595 + +* MNasNet B1, A1 (SE), Small + - MnasNet: Platform-Aware Neural Architecture Search for Mobile - https://arxiv.org/abs/1807.11626 + +* FBNet-C + - FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable NAS - https://arxiv.org/abs/1812.03443 + +* Single-Path NAS Pixel1 + - Single-Path NAS: Designing Hardware-Efficient ConvNets - https://arxiv.org/abs/1904.02877 + +* TinyNet + - Model Rubik's Cube: Twisting Resolution, Depth and Width for TinyNets - https://arxiv.org/abs/2010.14819 + - Definitions & weights borrowed from https://github.com/huawei-noah/CV-Backbones/tree/master/tinynet_pytorch + +* And likely more... + +The majority of the above models (EfficientNet*, MixNet, MnasNet) and original weights were made available +by Mingxing Tan, Quoc Le, and other members of their Google Brain team. Thanks for consistently releasing +the models and weights open source! + +Hacked together by / Copyright 2019, Ross Wightman +""" import copy import math diff --git a/mindocr/models/backbones/mindcv_models/ghostnet.py b/mindocr/models/backbones/mindcv_models/ghostnet.py index e69f88b29..8809bc06b 100644 --- a/mindocr/models/backbones/mindcv_models/ghostnet.py +++ b/mindocr/models/backbones/mindcv_models/ghostnet.py @@ -1,4 +1,17 @@ -"""MindSpore implementation of `GhostNet`.""" +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" +An implementation of GhostNet & GhostNetV2 Models as defined in: +GhostNet: More Features from Cheap Operations. https://arxiv.org/abs/1911.11907 +GhostNetV2: Enhance Cheap Operation with Long-Range Attention. https://proceedings.neurips.cc/paper_files/paper/2022/file/40b60852a4abdaa696b5a1a78da34635-Paper-Conference.pdf +GhostNetV3: Exploring the Training Strategies for Compact Models. https://arxiv.org/abs/2404.11202 + +The train script & code of models at: +Original model: https://github.com/huawei-noah/CV-backbones/tree/master/ghostnet_pytorch +Original model: https://github.com/huawei-noah/Efficient-AI-Backbones/blob/master/ghostnetv2_pytorch/model/ghostnetv2_torch.py +Original model: https://github.com/huawei-noah/Efficient-AI-Backbones/blob/master/ghostnetv3_pytorch/ghostnetv3.py +""" import math diff --git a/mindocr/models/backbones/mindcv_models/hrnet.py b/mindocr/models/backbones/mindcv_models/hrnet.py index 97d882672..a71051860 100644 --- a/mindocr/models/backbones/mindcv_models/hrnet.py +++ b/mindocr/models/backbones/mindcv_models/hrnet.py @@ -1,6 +1,14 @@ -""" -MindSpore implementation of `HRNet`. -Refer to Deep High-Resolution Representation Learning for Visual Recognition +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. +""" HRNet + +Copied from https://github.com/HRNet/HRNet-Image-Classification + +Original header: + Copyright (c) Microsoft + Licensed under the MIT License. + Written by Bin Xiao (Bin.Xiao@microsoft.com) + Modified by Ke Sun (sunk@mail.ustc.edu.cn) """ from typing import Any, Dict, List, Optional, Tuple, Type, Union diff --git a/mindocr/models/backbones/mindcv_models/layers/selective_kernel.py b/mindocr/models/backbones/mindcv_models/layers/selective_kernel.py index 3dcc1409a..19e180564 100644 --- a/mindocr/models/backbones/mindcv_models/layers/selective_kernel.py +++ b/mindocr/models/backbones/mindcv_models/layers/selective_kernel.py @@ -1,5 +1,10 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. """ Selective Kernel Convolution/Attention + Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) + +Hacked together by / Copyright 2020 Ross Wightman """ from typing import List, Optional, Union diff --git a/mindocr/models/backbones/mindcv_models/pit.py b/mindocr/models/backbones/mindcv_models/pit.py index 91c255f82..a10df1f4a 100644 --- a/mindocr/models/backbones/mindcv_models/pit.py +++ b/mindocr/models/backbones/mindcv_models/pit.py @@ -1,7 +1,18 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" Pooling-based Vision Transformer (PiT) in MindSpore + +A MindSpore implement of Pooling-based Vision Transformers as described in +'Rethinking Spatial Dimensions of Vision Transformers' - https://arxiv.org/abs/2103.16302 + +This code was adapted from the original version at https://github.com/naver-ai/pit, original copyright below. + +Modifications for timm by / Copyright 2020 Ross Wightman """ -MindSpore implementation of `PiT`. -Refer to Rethinking Spatial Dimensions of Vision Transformers. -""" +# PiT +# Copyright 2021-present NAVER Corp. +# Apache License v2.0 import math from typing import List diff --git a/mindocr/models/backbones/mindcv_models/pnasnet.py b/mindocr/models/backbones/mindcv_models/pnasnet.py index 651b567b4..d3a5d653f 100644 --- a/mindocr/models/backbones/mindcv_models/pnasnet.py +++ b/mindocr/models/backbones/mindcv_models/pnasnet.py @@ -1,6 +1,12 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + """ -MindSpore implementation of pnasnet. -Refer to Progressive Neural Architecture Search. + pnasnet5large implementation grabbed from Cadene's pretrained models + Additional credit to https://github.com/creafz + + https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/pnasnet.py + """ import math diff --git a/mindocr/models/backbones/mindcv_models/poolformer.py b/mindocr/models/backbones/mindcv_models/poolformer.py index b61c623a4..b135dace8 100644 --- a/mindocr/models/backbones/mindcv_models/poolformer.py +++ b/mindocr/models/backbones/mindcv_models/poolformer.py @@ -1,7 +1,27 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" PoolFormer implementation + +Paper: `PoolFormer: MetaFormer is Actually What You Need for Vision` - https://arxiv.org/abs/2111.11418 + +Code adapted from official impl at https://github.com/sail-sg/poolformer, original copyright in comment below + +Modifications and additions for timm by / Copyright 2022, Ross Wightman """ -MindSpore implementation of `poolformer`. -Refer to PoolFormer: MetaFormer Is Actually What You Need for Vision. -""" +# Copyright 2021 Garena Online Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import collections.abc from itertools import repeat diff --git a/mindocr/models/backbones/mindcv_models/pvtv2.py b/mindocr/models/backbones/mindcv_models/pvtv2.py index c2f621cb6..96d56f817 100644 --- a/mindocr/models/backbones/mindcv_models/pvtv2.py +++ b/mindocr/models/backbones/mindcv_models/pvtv2.py @@ -1,6 +1,21 @@ -""" -MindSpore implementation of `PVTv2`. -Refer to PVTv2: PVTv2: Improved Baselines with Pyramid Vision Transformer +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" Pyramid Vision Transformer v2 + +@misc{wang2021pvtv2, + title={PVTv2: Improved Baselines with Pyramid Vision Transformer}, + author={Wenhai Wang and Enze Xie and Xiang Li and Deng-Ping Fan and Kaitao Song and Ding Liang and + Tong Lu and Ping Luo and Ling Shao}, + year={2021}, + eprint={2106.13797}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} + +Based on Apache 2.0 licensed code at https://github.com/whai362/PVT + +Modifications and timm support by / Copyright 2022, Ross Wightman """ import math from functools import partial diff --git a/mindocr/models/backbones/mindcv_models/registry.py b/mindocr/models/backbones/mindcv_models/registry.py index d4e3018ba..5e75927df 100644 --- a/mindocr/models/backbones/mindcv_models/registry.py +++ b/mindocr/models/backbones/mindcv_models/registry.py @@ -1,3 +1,9 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. +""" Model Registry +Hacked together by / Copyright 2020 Ross Wightman +""" + """model registry and list""" import fnmatch import sys diff --git a/mindocr/models/backbones/mindcv_models/resnest.py b/mindocr/models/backbones/mindcv_models/resnest.py index a07344598..2cc172885 100644 --- a/mindocr/models/backbones/mindcv_models/resnest.py +++ b/mindocr/models/backbones/mindcv_models/resnest.py @@ -1,6 +1,13 @@ -""" -MindSpore implementation of `ResNeSt`. -Refer to ResNeSt: Split-Attention Networks. +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" ResNeSt Models + +Paper: `ResNeSt: Split-Attention Networks` - https://arxiv.org/abs/2004.08955 + +Adapted from original PyTorch impl w/ weights at https://github.com/zhanghang1989/ResNeSt by Hang Zhang + +Modified for torchscript compat, and consistency with timm by Ross Wightman """ from typing import List, Optional, Type diff --git a/mindocr/models/backbones/mindcv_models/senet.py b/mindocr/models/backbones/mindcv_models/senet.py index 8ccc69ade..64be110ba 100644 --- a/mindocr/models/backbones/mindcv_models/senet.py +++ b/mindocr/models/backbones/mindcv_models/senet.py @@ -1,6 +1,17 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. """ -MindSpore implementation of `SENet`. -Refer to Squeeze-and-Excitation Networks. +SEResNet implementation from Cadene's pretrained models +https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/senet.py +Additional credit to https://github.com/creafz + +Original model: https://github.com/hujie-frank/SENet + +ResNet code gently borrowed from +https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py + +FIXME I'm deprecating this model and moving them to ResNet as I don't want to maintain duplicate +support for extras like dilation, switchable BN/activations, feature extraction, etc that don't exist here. """ import math diff --git a/mindocr/models/backbones/mindcv_models/xception.py b/mindocr/models/backbones/mindcv_models/xception.py index 6fd1b953d..054d7248f 100644 --- a/mindocr/models/backbones/mindcv_models/xception.py +++ b/mindocr/models/backbones/mindcv_models/xception.py @@ -1,6 +1,27 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. """ -MindSpore implementation of Xception. -Refer to Xception: Deep Learning with Depthwise Separable Convolutions. +Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) + +@author: tstandley +Adapted by cadene + +Creates an Xception Model as defined in: + +Francois Chollet +Xception: Deep Learning with Depthwise Separable Convolutions +https://arxiv.org/pdf/1610.02357.pdf + +This weights ported from the Keras implementation. Achieves the following performance on the validation set: + +Loss:0.9173 Prec@1:78.892 Prec@5:94.292 + +REMEMBER to set your image size to 3x299x299 for both test and validation + +normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5], + std=[0.5, 0.5, 0.5]) + +The resize parameter of the validation transform should be 333, and make sure to center crop at 299x299 """ import mindspore.common.initializer as init diff --git a/mindocr/models/backbones/mindcv_models/xcit.py b/mindocr/models/backbones/mindcv_models/xcit.py index 8d2d4b363..527be45ad 100644 --- a/mindocr/models/backbones/mindcv_models/xcit.py +++ b/mindocr/models/backbones/mindcv_models/xcit.py @@ -1,7 +1,18 @@ +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. + +""" Cross-Covariance Image Transformer (XCiT) in MindSpore + +Paper: + - https://arxiv.org/abs/2106.09681 + +Same as the official implementation, with some minor adaptations, original copyright below + - https://github.com/facebookresearch/xcit/blob/master/xcit.py + +Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman """ -MindSpore implementation of XCiT -Refer to: XCiT: Cross-Covariance Image Transformers -""" +# Copyright (c) 2015-present, Facebook, Inc. +# All rights reserved. from functools import partial import numpy as np diff --git a/mindocr/models/backbones/rec_resnet.py b/mindocr/models/backbones/rec_resnet.py index f2ed29418..cbf77966f 100644 --- a/mindocr/models/backbones/rec_resnet.py +++ b/mindocr/models/backbones/rec_resnet.py @@ -1,3 +1,25 @@ +# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +This code is refer from: +https://github.com/open-mmlab/mmocr/blob/main/mmocr/models/textrecog/layers/conv_layer.py +https://github.com/open-mmlab/mmocr/blob/main/mmocr/models/textrecog/backbones/resnet31_ocr.py +""" + from mindspore import nn from ._registry import register_backbone, register_backbone_class diff --git a/mindocr/models/backbones/rec_svtr_enhance.py b/mindocr/models/backbones/rec_svtr_enhance.py index 418275ea7..60bfe35ce 100644 --- a/mindocr/models/backbones/rec_svtr_enhance.py +++ b/mindocr/models/backbones/rec_svtr_enhance.py @@ -1,3 +1,23 @@ +# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This code is refer from: https://github.com/PaddlePaddle/PaddleClas/blob/develop/ppcls/arch/backbone/legendary_models/pp_lcnet.py + + from mindspore import nn from ..utils.attention_cells import SEModule diff --git a/mindocr/models/backbones/transformer_common/layer.py b/mindocr/models/backbones/transformer_common/layer.py index 1ebc25c97..f50ebffe3 100644 --- a/mindocr/models/backbones/transformer_common/layer.py +++ b/mindocr/models/backbones/transformer_common/layer.py @@ -1,3 +1,21 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +# Copyright 2021 Microsoft Research and The HuggingFace Inc. team. All rights reserved. +# +# This code is adapted from https://github.com/huggingface/pytorch-image-models +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import math import numpy as np diff --git a/mindocr/nlp/generation/beam_search.py b/mindocr/nlp/generation/beam_search.py index a5c931156..256e672a2 100644 --- a/mindocr/nlp/generation/beam_search.py +++ b/mindocr/nlp/generation/beam_search.py @@ -1,3 +1,22 @@ +# coding=utf-8 +# Copyright 2020 The HuggingFace Team Inc. +# +# This code is adapted from https://github.com/huggingface/transformers +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a clone of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + """Beam search for text generation.""" from abc import ABC, abstractmethod from collections import UserDict diff --git a/mindocr/nlp/llm/qwen_tokenizer.py b/mindocr/nlp/llm/qwen_tokenizer.py index 8ad4224d2..fe94a34c0 100644 --- a/mindocr/nlp/llm/qwen_tokenizer.py +++ b/mindocr/nlp/llm/qwen_tokenizer.py @@ -1,3 +1,21 @@ +# coding=utf-8 +# Copyright 2020 The HuggingFace Inc. team. +# +# This code is adapted from https://github.com/huggingface/transformers +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import base64 import unicodedata from typing import Collection, Dict, List, Set, Union diff --git a/mindocr/postprocess/det_db_postprocess.py b/mindocr/postprocess/det_db_postprocess.py index 6e10c787e..8d8763677 100644 --- a/mindocr/postprocess/det_db_postprocess.py +++ b/mindocr/postprocess/det_db_postprocess.py @@ -1,3 +1,6 @@ +# This code is adapted from https://github.com/WenmuZhou/DBNet.pytorch +# with modifications to run on MindSpore. + from typing import List, Tuple, Union import cv2 diff --git a/mindocr/postprocess/det_east_postprocess.py b/mindocr/postprocess/det_east_postprocess.py index 7b08bc5e3..53d112e03 100644 --- a/mindocr/postprocess/det_east_postprocess.py +++ b/mindocr/postprocess/det_east_postprocess.py @@ -1,3 +1,6 @@ +# This code is adapted from https://github.com/sakurariven/east +# with modifications to run on MindSpore. + import math import numpy as np diff --git a/mindocr/postprocess/det_pse_postprocess.py b/mindocr/postprocess/det_pse_postprocess.py index ec8397256..5ec120b88 100644 --- a/mindocr/postprocess/det_pse_postprocess.py +++ b/mindocr/postprocess/det_pse_postprocess.py @@ -1,3 +1,6 @@ +# This code is adapted from https://github.com/whai362/PSENet +# with modifications to run on MindSpore. + import cv2 import numpy as np diff --git a/mindocr/postprocess/kie_ser_postprocess.py b/mindocr/postprocess/kie_ser_postprocess.py index 04bf86c6f..9e51691c8 100644 --- a/mindocr/postprocess/kie_ser_postprocess.py +++ b/mindocr/postprocess/kie_ser_postprocess.py @@ -1,3 +1,20 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import numpy as np import mindspore as ms diff --git a/mindocr/postprocess/pse/pse.pyx b/mindocr/postprocess/pse/pse.pyx index 8b7c4fd58..87a39d8c8 100644 --- a/mindocr/postprocess/pse/pse.pyx +++ b/mindocr/postprocess/pse/pse.pyx @@ -1,3 +1,4 @@ +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR import cv2 import numpy as np diff --git a/mindocr/postprocess/rec_postprocess.py b/mindocr/postprocess/rec_postprocess.py index 1569074df..dcf05c679 100644 --- a/mindocr/postprocess/rec_postprocess.py +++ b/mindocr/postprocess/rec_postprocess.py @@ -1,5 +1,19 @@ -""" -""" +# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import logging import re from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/mindocr/postprocess/table_postprocess.py b/mindocr/postprocess/table_postprocess.py index 6131d3206..f9bc7ffe1 100644 --- a/mindocr/postprocess/table_postprocess.py +++ b/mindocr/postprocess/table_postprocess.py @@ -1,3 +1,20 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import re import numpy as np diff --git a/mindocr/utils/visualize.py b/mindocr/utils/visualize.py index 3db18bb1e..bcf4eabe1 100644 --- a/mindocr/utils/visualize.py +++ b/mindocr/utils/visualize.py @@ -1,3 +1,20 @@ +# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# with modifications to run on MindSpore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import logging import math import os diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3a407a26a2ccfcbc6139dab55b23b2c5bd850fd9 GIT binary patch literal 6148 zcmeHKJ5Iwu5S=wCETu_Fh4u=OIDiSJrbtPHLL>r;AI0r}I2)ws52HO}) zgwTw%`)22}V?W8e9uWzP{dz7k6OkN)7^sX0&7-c&g6Rz0+jRGPBM+JEhjq@6T6?$7>Gbxq z4syD6hQ5BCSJrWH2AlzBz!`7`eqsQ3HYJ}b`s@ri1J1w)13Vuh2C*<~6w}dxDYXE= z3Cu~LvzK5_G%O4oMR*`VQ-PWqti=eL4tun?!mv@)bP3jc1gqROFCkUO{xOA1C=`8m z2AqLD0|&aC@%}%m%8Vj@W4M==|lboHElolu)0>W_w(E6T9-@(FYV(X(A8^76I z@iriV#u%MRX1@KIxt;kgw|h%Os&*4siONJ&f-(l1Fbjm|S?8qSMmSiRXLKo{OBz$3 zdUM_~APfitzl{O@cDJcXZ5mRG^55@}I)hHN-b#~^P5R(|nQxLtQFD+s;Zw>EuaC~V z568>>ezccl$ zv}Tfi)wXV|S7#way0n4abVyfRk5^6c{nVe$=X|F7pYI?SpU-Tuhqr$4!t3u~S5Lup zn+9fgpMviOTFm~)^6ceBmEF~%^7+0!&+=Viy?h<(MSAs-=KB7t;LK(zZCMm63ERjA2gIPbeLH*TL+A}0ssRH8$p|YDL6(u3>{_`F#}OH6lg=0yJ9FCj&be$LWh|} z8&1kyK9pNoxf_ZytK<3FxRVMkiWLTg0iS`Q?UwocKl%Rt?*~aw7!U^j6ay-V>QN0P zxwCbyI6iAN^a9GlewjrR0^^Qj)8M0c4{8K+nj65-VP+8{5cv@>G>8!few2X^z%92a literal 0 HcmV?d00001 diff --git a/tools/infer/text/utils/matcher.py b/tools/infer/text/utils/matcher.py index 41a77470f..fe13df173 100644 --- a/tools/infer/text/utils/matcher.py +++ b/tools/infer/text/utils/matcher.py @@ -1,3 +1,5 @@ +# This code is adapted from https://github.com/JiaquanYe/TableMaster-mmocr + import copy import glob import math diff --git a/tools/infer/text/utils/table_process.py b/tools/infer/text/utils/table_process.py index 045a0bb10..23f57221b 100644 --- a/tools/infer/text/utils/table_process.py +++ b/tools/infer/text/utils/table_process.py @@ -1,3 +1,22 @@ +# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. +# +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +This code is refer from: https://github.com/weizwx/html2docx/blob/master/htmldocx/h2d.py +""" + import re from html.parser import HTMLParser From b71977f02eaacef5187377f4ffbbdbc0bea9864e Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Thu, 10 Jul 2025 17:04:23 +0800 Subject: [PATCH 2/7] fix --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 3 +++ deploy/.DS_Store | Bin 6148 -> 0 bytes docs/.DS_Store | Bin 6148 -> 0 bytes mindocr/.DS_Store | Bin 8196 -> 0 bytes tests/.DS_Store | Bin 6148 -> 0 bytes tools/.DS_Store | Bin 6148 -> 0 bytes 7 files changed, 3 insertions(+) delete mode 100644 .DS_Store delete mode 100644 deploy/.DS_Store delete mode 100644 docs/.DS_Store delete mode 100644 mindocr/.DS_Store delete mode 100644 tests/.DS_Store delete mode 100644 tools/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index c1445e092d2a7075338779158065cf66e70b0a39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMO=uHA6n>+dG-AYpC_VVIU=a^eQc)34Ye^4^w}O{~G-+ZINV;j8g5DPKA_(3T z!HeKQ(SzP99z?-{r}iLt6VZ#ecu_$I|ZBqTT%hJKlnJL4UCPnRa*x-RRX|z7*-AEqw)mSH#RUf(iR>xp+jMH zs4yjl(BT;O4K6S?(pHC)FvW*3nT4rPgvyTjeFY~GXzO~XfKwo@fUMm;nxGmrsKe`b z@j8Ei`&wbKSZ;=8jO8+ieyx7~uy)q=SBCoA_5Qm7@$D-@Y2;5{s?!RUd3Nj~kKzc< z;oYUvCuZx4!@xYPu+JnN#rf#%jWXcVpbAx~WOF(E5nPy;^O#tBu=?z#;$b2B9Fh@s z{s;-6$2^6!K$pRyM#~n5QnwyQa2{FjdVc?XqlYyQ*CQQe@u_S`K3Szjo0?#C)naq( z)xkkO=Q95N+<9|ttT{N7G>paL_*2Ql1CJ2e*or)yUgtiZ|Hs8{@Oag%PZP^?C;6?s zPXd`Yhm~-JO4K5$L3JSi-t|*S7|!GUr`sD}^cs!L#rX`wS-kemNnRsh)WAB?zii36 zGDmi0;|R`aCDZ8NH`Y9yQ98=vQ)o**d0K)xi@1jy>a2xt3)C6Vi^S|OEa!M~Pjtqt zpVYZI+rPnEys030d$bJ39jaOiN)PjKUiZeMm%Hznb!B2Xk0igHSIwP~Igxu%A@Aoc z_?egIetV;L-7G|ZpGiho`7`RimhmAz&4DX4a`djrZ@fJJh39X&*It-?t{2aLeKNwz zzr$AoxNcJ@uwAnlllA{}`uqP)!PSv)3OEJ+jRL|e&J?FGx2dgTS!Av4B?)mSY|7!Vd+3q*$i02&u diff --git a/.gitignore b/.gitignore index 6dfdee420..4d50ce984 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,6 @@ dmypy.json # mindspore compile related rank_*/ + +# DS_Store (MacOS) +.DS_Store diff --git a/deploy/.DS_Store b/deploy/.DS_Store deleted file mode 100644 index 3d0b8207ec1820fd306dc5690efb467abb724730..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKF;2rU6n!oo0(9sITZ9-{DzOu)AhCC307{{)l#mK2Qn$=-1SW34DYyw2-~_yH zyO1bN)d?Z`zhpnh{@;0iPVIgGraK*UfHr`DMX<5SYJthPl!`TcPm5^m9Oszg0b?Y% zuXt<6UsOQ$ZVT6V#3gsFuz$(0)4R&ji6g!DT<4c&aokU`KF5Q%kE6r0(fe_|?_g!$ z$*B1Lh*P446d49&E8kZw*V*eb-y+}LVKnDkJ9nD>a9+i~#GAhgT7U^=As+js(>n>3ak|1??VP>%pJCZ_S1pEUIBnTgsoxD zcL}b^9Oe#NL9D=xlmeyHxGRQ{a>O&2mpg0)rJRhrd>F@U+zrK8cI=Gu17Sfo#?fGY5>6fnJ_EQUCe>#d!`aj(tbBRCu9wSub>Ol&JgF1O-C bxHZHxo&a-)tso*W{Ucyy&_NaWQw6>O>04mX diff --git a/mindocr/.DS_Store b/mindocr/.DS_Store deleted file mode 100644 index a2fd00913489c05df648fdb41c9150d76347725f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMJ#Q015S_Kp!6+$G286^Fsi+(&Kj4UrgrH0l0YXmhqMVVBvmCnv>4Zd2NlO7u zqzI@eKy(yT`~^B1BzhX&>~7Ax_YpdTVAk4wr=6LdcW+ld&zXqS&LY_&+90AnI^+5( zhK9y=?zPsjGn+t#c$yq-?Z$aFt$E6XC?E=m0-}H@APW2~3gDT|t>5z8H&z)%0a4(; zRDi!9LUhK+Vqs8!bzsmX05HI`Zn$3O3t(t5vRD{|1x=Yypb1sB#84(2^P%;NEEWb$ zI4N6vD4SW?3PtJcSU=S6q#}bdiUOiQT>-A$14?M0=CtqC@4@CZ*OukO;lU(7z+8X( z!;k3X-KXomJvrAtO`UfGy#YdLg(j5KF+PWM?B%Afx2twH|HnJ&=gV((es7H|Uvg;k z@pvfB;{s)1FsB)fDXub!pMXil!{ze$S+REIh2~Q8TC!>P^7zneqe})|5^$PS*j&2x zUhCr6T`q&~<-V-op2{^`UD|v+9#Cy$E(OrC^!R0y}j`Gherxr_Ek2&!6|wvwdq=&*gZ& zr^k;9=GOx&-p%SMR(or{)#dZ%RjHd3@A7E&@bY&C_UD5<|9K;%i2@A@bj{ob*Z()# z-~Ts6%9JP|3j8Yys9?A|+`--0+PZdMTx*BuBXn-;R~XbG7}$m9bvX_!|1iXLXl;?j T!XPYY@*+UXAcH9IM-})5D3&kI diff --git a/tests/.DS_Store b/tests/.DS_Store deleted file mode 100644 index 3a407a26a2ccfcbc6139dab55b23b2c5bd850fd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5Iwu5S=wCETu_Fh4u=OIDiSJrbtPHLL>r;AI0r}I2)ws52HO}) zgwTw%`)22}V?W8e9uWzP{dz7k6OkN)7^sX0&7-c&g6Rz0+jRGPBM+JEhjq@6T6?$7>Gbxq z4syD6hQ5BCSJrWH2AlzBz!`7`eqsQ3HYJ}b`s@ri1J1w)13Vuh2C*<~6w}dxDYXE= z3Cu~LvzK5_G%O4oMR*`VQ-PWqti=eL4tun?!mv@)bP3jc1gqROFCkUO{xOA1C=`8m z2AqLD0|&aC@%}%m%8Vj@W4M==|lboHElolu)0>W_w(E6T9-@(FYV(X(A8^76I z@iriV#u%MRX1@KIxt;kgw|h%Os&*4siONJ&f-(l1Fbjm|S?8qSMmSiRXLKo{OBz$3 zdUM_~APfitzl{O@cDJcXZ5mRG^55@}I)hHN-b#~^P5R(|nQxLtQFD+s;Zw>EuaC~V z568>>ezccl$ zv}Tfi)wXV|S7#way0n4abVyfRk5^6c{nVe$=X|F7pYI?SpU-Tuhqr$4!t3u~S5Lup zn+9fgpMviOTFm~)^6ceBmEF~%^7+0!&+=Viy?h<(MSAs-=KB7t;LK(zZCMm63ERjA2gIPbeLH*TL+A}0ssRH8$p|YDL6(u3>{_`F#}OH6lg=0yJ9FCj&be$LWh|} z8&1kyK9pNoxf_ZytK<3FxRVMkiWLTg0iS`Q?UwocKl%Rt?*~aw7!U^j6ay-V>QN0P zxwCbyI6iAN^a9GlewjrR0^^Qj)8M0c4{8K+nj65-VP+8{5cv@>G>8!few2X^z%92a From 5c73947217613873b7324f43165e89ee380d787e Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Thu, 10 Jul 2025 17:49:41 +0800 Subject: [PATCH 3/7] fix ci --- configs/.DS_Store | Bin 6148 -> 0 bytes .../models/backbones/layoutlmv3/layoutlmv3.py | 2 +- .../models/backbones/mindcv_models/ghostnet.py | 12 ++++++++---- .../models/backbones/mindcv_models/registry.py | 1 - mindocr/models/backbones/rec_svtr_enhance.py | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 configs/.DS_Store diff --git a/configs/.DS_Store b/configs/.DS_Store deleted file mode 100644 index ebfd324facb32876e49dfac98f5c61188504f11b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHLF-yZh6nJ>A|mg>-Iv~X@4mdRB-bkdh{mW>0Vo1M0UM#afZdcJo?0g6 z^vDvTpfxJZcHAFi=J5bKzz+OP2k6;#pbb4Z=^dEQZ~Z1^`f(71y*R{?LNKmX_qyW^ zlkI%N4!Y*5+n9!W9f)9P={Z*)DP!u@N^kY$Ypo~q`f;k4Wi37TUg;gdAw-s5`MfIi zBxCA5tQdNlP4%*@rB{9;y*#?P52p~rXrju}+WRDLY9H=yMRymnR%;Ej;#qU7`zR%J z9}XO&&uy#je0Y{JruOR2diuS}JX1BxT6*&>(#ydR>khGc+w0tGWV5F3W#RGmlXIT1qlIQrL1Gr~X6c!b7&knEy?7)`;^nUQL5&9Yvh4R&bojd{{x;QKYuZwhn z=xOvdCJK?k5GoZ>r3!t-5GozVJw4CYm?%`~Afz&`qm_j|p$Mst Date: Thu, 10 Jul 2025 18:05:55 +0800 Subject: [PATCH 4/7] fix ci --- mindocr/models/backbones/mindcv_models/ghostnet.py | 6 +++--- mindocr/models/backbones/rec_svtr_enhance.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mindocr/models/backbones/mindcv_models/ghostnet.py b/mindocr/models/backbones/mindcv_models/ghostnet.py index 48a8f39d4..de43f6e47 100644 --- a/mindocr/models/backbones/mindcv_models/ghostnet.py +++ b/mindocr/models/backbones/mindcv_models/ghostnet.py @@ -4,14 +4,14 @@ """ An implementation of GhostNet & GhostNetV2 Models as defined in: GhostNet: More Features from Cheap Operations. https://arxiv.org/abs/1911.11907 -GhostNetV2: Enhance Cheap Operation with Long-Range Attention. +GhostNetV2: Enhance Cheap Operation with Long-Range Attention. https://proceedings.neurips.cc/paper_files/paper/2022/file/40b60852a4abdaa696b5a1a78da34635-Paper-Conference.pdf GhostNetV3: Exploring the Training Strategies for Compact Models. https://arxiv.org/abs/2404.11202 The train script & code of models at: -Original model: +Original model: https://github.com/huawei-noah/CV-backbones/tree/master/ghostnet_pytorch -Original model: +Original model: https://github.com/huawei-noah/Efficient-AI-Backbones/blob/master/ghostnetv2_pytorch/model/ghostnetv2_torch.py Original model: https://github.com/huawei-noah/Efficient-AI-Backbones/blob/master/ghostnetv3_pytorch/ghostnetv3.py diff --git a/mindocr/models/backbones/rec_svtr_enhance.py b/mindocr/models/backbones/rec_svtr_enhance.py index ed40a89ce..c61ed8816 100644 --- a/mindocr/models/backbones/rec_svtr_enhance.py +++ b/mindocr/models/backbones/rec_svtr_enhance.py @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This code is refer from: +# This code is refer from: # https://github.com/PaddlePaddle/PaddleClas/blob/develop/ppcls/arch/backbone/legendary_models/pp_lcnet.py From c76db0b489db1319b03cf130b7011757bfd8959a Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Thu, 10 Jul 2025 18:07:34 +0800 Subject: [PATCH 5/7] fix ci --- mindocr/models/backbones/rec_svtr_enhance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindocr/models/backbones/rec_svtr_enhance.py b/mindocr/models/backbones/rec_svtr_enhance.py index c61ed8816..c24fb6a12 100644 --- a/mindocr/models/backbones/rec_svtr_enhance.py +++ b/mindocr/models/backbones/rec_svtr_enhance.py @@ -1,6 +1,6 @@ # copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # -# This code is adapted from https://github.com/huggingface/pytorch-image-models +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR # with modifications to run on MindSpore. # # Licensed under the Apache License, Version 2.0 (the "License"); From 3fa8d2860203e9c9d5acff5363ffec1ef0567e59 Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Thu, 10 Jul 2025 18:09:47 +0800 Subject: [PATCH 6/7] fix ci --- mindocr/models/backbones/rec_resnet.py | 2 +- mindocr/models/backbones/transformer_common/layer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mindocr/models/backbones/rec_resnet.py b/mindocr/models/backbones/rec_resnet.py index cbf77966f..074522a66 100644 --- a/mindocr/models/backbones/rec_resnet.py +++ b/mindocr/models/backbones/rec_resnet.py @@ -1,6 +1,6 @@ # copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # -# This code is adapted from https://github.com/huggingface/pytorch-image-models +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR # with modifications to run on MindSpore. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mindocr/models/backbones/transformer_common/layer.py b/mindocr/models/backbones/transformer_common/layer.py index f50ebffe3..f2e441e73 100644 --- a/mindocr/models/backbones/transformer_common/layer.py +++ b/mindocr/models/backbones/transformer_common/layer.py @@ -1,7 +1,7 @@ # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # Copyright 2021 Microsoft Research and The HuggingFace Inc. team. All rights reserved. # -# This code is adapted from https://github.com/huggingface/pytorch-image-models +# This code is adapted from https://github.com/PaddlePaddle/PaddleOCR # with modifications to run on MindSpore. # # Licensed under the Apache License, Version 2.0 (the "License"); From d9813dccc3ff86dd0f3e38e7af78149be2a70bf5 Mon Sep 17 00:00:00 2001 From: alien_0119 Date: Mon, 14 Jul 2025 11:34:20 +0800 Subject: [PATCH 7/7] ifx --- mindocr/models/backbones/layoutxlm/tokenizer_utils.py | 1 - mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py | 5 ++--- mindocr/models/backbones/mindcv_models/xception.py | 2 +- mindocr/nlp/generation/beam_search.py | 1 - mindocr/nlp/llm/qwen_tokenizer.py | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/mindocr/models/backbones/layoutxlm/tokenizer_utils.py b/mindocr/models/backbones/layoutxlm/tokenizer_utils.py index dd72bc318..d41496add 100644 --- a/mindocr/models/backbones/layoutxlm/tokenizer_utils.py +++ b/mindocr/models/backbones/layoutxlm/tokenizer_utils.py @@ -1,4 +1,3 @@ -# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. diff --git a/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py b/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py index 1a670a01e..4945ce10f 100644 --- a/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py +++ b/mindocr/models/backbones/layoutxlm/tokenizer_utils_base.py @@ -1,7 +1,6 @@ -# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. -# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. -# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2018, NVIDIA CORPORATION. All Rights Reserved. +# Copyright (c) 2020, PaddlePaddle Authors. All Rights Reserved. # # This code is adapted from https://github.com/PaddlePaddle/PaddleNLP # with modifications to run on MindSpore. diff --git a/mindocr/models/backbones/mindcv_models/xception.py b/mindocr/models/backbones/mindcv_models/xception.py index 054d7248f..b6099cedb 100644 --- a/mindocr/models/backbones/mindcv_models/xception.py +++ b/mindocr/models/backbones/mindcv_models/xception.py @@ -1,7 +1,7 @@ # This code is adapted from https://github.com/huggingface/pytorch-image-models # with modifications to run on MindSpore. """ -Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) +Ported to MindSpore thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene diff --git a/mindocr/nlp/generation/beam_search.py b/mindocr/nlp/generation/beam_search.py index 256e672a2..851377c34 100644 --- a/mindocr/nlp/generation/beam_search.py +++ b/mindocr/nlp/generation/beam_search.py @@ -1,4 +1,3 @@ -# coding=utf-8 # Copyright 2020 The HuggingFace Team Inc. # # This code is adapted from https://github.com/huggingface/transformers diff --git a/mindocr/nlp/llm/qwen_tokenizer.py b/mindocr/nlp/llm/qwen_tokenizer.py index fe94a34c0..9434b3b7f 100644 --- a/mindocr/nlp/llm/qwen_tokenizer.py +++ b/mindocr/nlp/llm/qwen_tokenizer.py @@ -1,4 +1,3 @@ -# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # This code is adapted from https://github.com/huggingface/transformers