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

minors fixies over requiriments and CTC model example on OCR notebook #161

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ncurses=6.1
notebook=5.7.1
numpy=1.15.4
numpy-base=1.15.4
opencv=3.4.2
opencv=4.6.0
openssl=1.0.2p
pandas
pandoc=2.2.3.2
Expand Down Expand Up @@ -109,7 +109,7 @@ sip=4.19.8
six=1.11.0
sqlite=3.25.3
tensorboard=1.12.0
tensorflow=1.12.0
tensorflow=2.9.1
tensorflow-base=1.12.0
termcolor=1.1.0
terminado=0.8.1
Expand Down
141 changes: 65 additions & 76 deletions notebooks/OCR.ipynb

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/ocr/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ def image_standardization(image):
def _crop_add_border(img, height, threshold=50, border=True, border_size=15):
"""Crop and add border to word image of letter segmentation."""
# Clear small values
try:
ret, img = cv2.threshold(img, threshold, 255, cv2.THRESH_TOZERO)
except:
import pdb;pdb.set_trace()

ret, img = cv2.threshold(img, threshold, 255, cv2.THRESH_TOZERO)

x0 = 0
y0 = 0
x1 = img.shape[1]
Expand Down
3 changes: 2 additions & 1 deletion src/ocr/tfhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Model = Class for loading and using trained models from tensorflow
create_cell = function for creatting RNN cells with wrappers
"""
import tensorflow as tf
#import tensorflow as tf
import tensorflow.compat.v1 as tf
from tensorflow.python.ops.rnn_cell_impl import LSTMCell, ResidualWrapper, DropoutWrapper, MultiRNNCell

class Model():
Expand Down