Skip to content

Commit

Permalink
Fix lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
faustomorales committed Jun 14, 2020
1 parent 287fda7 commit 6b11251
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /usr/src
# change.
RUN mkdir -p /root/.keras-ocr && ( \
cd /root/.keras-ocr && \
curl -L -o craft_mlt_25k.pth https://www.mediafire.com/file/qh2ullnnywi320s/craft_mlt_25k.pth/file && \
curl -L -o craft_mlt_25k.h5 https://www.mediafire.com/file/mepzf3sq7u7nve9/craft_mlt_25k.h5/file && \
curl -L -o crnn_kurapan.h5 https://www.mediafire.com/file/pkj2p29b1f6fpil/crnn_kurapan.h5/file \
)
Expand Down
4 changes: 1 addition & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ ipython = "*"
jupyterlab = "*"
numpy = "*"
matplotlib = "*"
tensorflow = "*"
keras = "*"
mypy = "*"
pylint = "*"
pytest = "*"
pytest-cov = "*"
yapf = "*"
torch = "*"
torchvision = "*"
scikit-learn = "*"
sphinx = "==1.8.3"
m2r = "==0.2.1"
tensorflow = "==2.1.0" # See https://github.com/PyCQA/pylint/issues/3613
Pillow = "==6.2.2" # We need to do this because of https://github.com/pytorch/vision/issues/1714
sphinx_rtd_theme = "==0.4.2"

Expand Down
4 changes: 2 additions & 2 deletions keras_ocr/data_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ def convert_image_generator_to_recognizer_input(image_generator,
if not line:
continue
box, sentence = tools.combine_line(line)

# remove multiple sequential spaces
while (" " in sentence):
while " " in sentence:
sentence = sentence.replace(" ", " ")

crop = tools.warpBox(image=image,
Expand Down
2 changes: 2 additions & 0 deletions keras_ocr/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def build_keras_model(weights_path: str = None, backbone_name='vgg'):
return model


# pylint: disable=import-error
def load_torch_weights(model, weights_path):
import torch

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


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

Expand Down
4 changes: 2 additions & 2 deletions tests/test_pytorch_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import numpy as np
import pytest
import torch

import keras_ocr

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


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

0 comments on commit 6b11251

Please sign in to comment.