Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ci for paddleocr test #12062

Merged
merged 15 commits into from
May 22, 2024
Merged
Prev Previous commit
Next Next commit
move flake8 to pre-commit
GreatV committed May 7, 2024
commit eb402daa0f9a6f2c09e2a112a108a8193bb0a24c
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ on:
branches: ['main', 'release/*']

jobs:
pre-commit:
check-code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
10 changes: 2 additions & 8 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ permissions:
contents: read

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
@@ -21,16 +21,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install paddlepaddle requests
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ppocr/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ppocr/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests/
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -35,3 +35,16 @@ repos:
hooks:
- id: black
files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$

# Flake8
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args:
- --count
- --select=E9,F63,F7,F82
- --show-source
- --statistics
exclude: ^benchmark/|^test_tipc/

2 changes: 1 addition & 1 deletion PPOCRLabel/libs/ustr.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def ustr(x):
if type(x) == QString:
# https://blog.csdn.net/friendan/article/details/51088476
# https://blog.csdn.net/xxm524/article/details/74937308
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore")
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore") # noqa
return x
else:
return x
3 changes: 3 additions & 0 deletions StyleText/utils/config.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@
import yaml
import os
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import logging

logger = logging.getLogger(__name__)


def override(dl, ks, v):
2 changes: 1 addition & 1 deletion benchmark/PaddleOCR_DBNet/data_loader/modules/augment.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def __call__(self, data: dict):
return data
data["img"] = (
random_noise(data["img"], mode="gaussian", clip=True) * 255
).astype(im.dtype)
).astype(data["img"].dtype)
return data


2 changes: 1 addition & 1 deletion deploy/hubserving/kie_ser/module.py
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ def serving_method(self, images, **kwargs):


if __name__ == "__main__":
ocr = OCRSystem()
ocr = KIESer()
ocr._initialize()
image_path = [
"./doc/imgs/11.jpg",
2 changes: 1 addition & 1 deletion deploy/hubserving/kie_ser_re/module.py
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ def serving_method(self, images, **kwargs):


if __name__ == "__main__":
ocr = OCRSystem()
ocr = KIESerRE()
ocr._initialize()
image_path = [
"./doc/imgs/11.jpg",