Skip to content

Commit 6b11251

Browse files
committed
Fix lint issues.
1 parent 287fda7 commit 6b11251

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ WORKDIR /usr/src
44
# change.
55
RUN mkdir -p /root/.keras-ocr && ( \
66
cd /root/.keras-ocr && \
7-
curl -L -o craft_mlt_25k.pth https://www.mediafire.com/file/qh2ullnnywi320s/craft_mlt_25k.pth/file && \
87
curl -L -o craft_mlt_25k.h5 https://www.mediafire.com/file/mepzf3sq7u7nve9/craft_mlt_25k.h5/file && \
98
curl -L -o crnn_kurapan.h5 https://www.mediafire.com/file/pkj2p29b1f6fpil/crnn_kurapan.h5/file \
109
)

Pipfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ ipython = "*"
88
jupyterlab = "*"
99
numpy = "*"
1010
matplotlib = "*"
11-
tensorflow = "*"
1211
keras = "*"
1312
mypy = "*"
1413
pylint = "*"
1514
pytest = "*"
1615
pytest-cov = "*"
1716
yapf = "*"
18-
torch = "*"
19-
torchvision = "*"
2017
scikit-learn = "*"
2118
sphinx = "==1.8.3"
2219
m2r = "==0.2.1"
20+
tensorflow = "==2.1.0" # See https://github.com/PyCQA/pylint/issues/3613
2321
Pillow = "==6.2.2" # We need to do this because of https://github.com/pytorch/vision/issues/1714
2422
sphinx_rtd_theme = "==0.4.2"
2523

keras_ocr/data_generation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ def convert_image_generator_to_recognizer_input(image_generator,
259259
if not line:
260260
continue
261261
box, sentence = tools.combine_line(line)
262-
262+
263263
# remove multiple sequential spaces
264-
while (" " in sentence):
264+
while " " in sentence:
265265
sentence = sentence.replace(" ", " ")
266266

267267
crop = tools.warpBox(image=image,

keras_ocr/detection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ def build_keras_model(weights_path: str = None, backbone_name='vgg'):
362362
return model
363363

364364

365+
# pylint: disable=import-error
365366
def load_torch_weights(model, weights_path):
366367
import torch
367368

@@ -400,6 +401,7 @@ def load_torch_weights(model, weights_path):
400401
assert layer.name in layer_names
401402

402403

404+
# pylint: disable=import-error,too-few-public-methods
403405
def build_torch_model(weights_path=None):
404406
from collections import namedtuple, OrderedDict
405407

tests/test_pytorch_keras.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import numpy as np
55
import pytest
6-
import torch
76

87
import keras_ocr
98

@@ -13,9 +12,10 @@
1312
os.path.expanduser(os.path.join('~', '.keras-ocr', 'craft_mlt_25k.h5')))
1413

1514

16-
@pytest.mark.skipif(not keras_weights_available and torch_weights_available,
15+
@pytest.mark.skipif(not (keras_weights_available and torch_weights_available),
1716
reason="CRAFT weights required.")
1817
def test_pytorch_identical_output():
18+
import torch # pylint: disable=import-outside-toplevel
1919
weights_path_torch = keras_ocr.tools.download_and_verify(
2020
url='https://www.mediafire.com/file/qh2ullnnywi320s/craft_mlt_25k.pth/file',
2121
filename='craft_mlt_25k.pth',

0 commit comments

Comments
 (0)