Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKoornstra committed Mar 11, 2024
1 parent 60f2190 commit fc64ff0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/data/loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Imports

# > Standard Library
import logging
from typing import Tuple

# > Local dependencies
Expand Down Expand Up @@ -106,9 +105,9 @@ def _load_and_preprocess_image(self, image_path: str) -> tf.Tensor:
try:
image = tf.image.decode_image(image, channels=self.channels,
expand_animations=False)
except ValueError:
logging.error("Invalid number of channels. "
"Supported values are 1, 3, or 4.")
except ValueError as e:
raise ValueError("Invalid number of channels. "
"Expected 1, 3, or 4.") from e

# 2. Resize the Image and Normalize Pixel Values to [0, 1]
image = tf.image.resize(image, (self.height, 99999),
Expand Down
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def main():
optimizer = get_optimizer(config["optimizer"], lr_schedule)

# Compile the model
model.compile(optimizer=optimizer, loss=CTCLoss,
model.compile(optimizer=optimizer,
loss=CTCLoss,
metrics=[CERMetric(greedy=config["greedy"],
beam_width=config["beam_width"]),
WERMetric()],
Expand Down

0 comments on commit fc64ff0

Please sign in to comment.