Skip to content

Commit

Permalink
Move train-related scripts to code package
Browse files Browse the repository at this point in the history
  • Loading branch information
ankandrew committed Apr 6, 2024
1 parent a1a31dd commit 9a8ddee
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 8 deletions.
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Directories
SRC_PATHS := fast_plate_ocr/ \
test/ \
train.py \
valid.py \
visualize_augmentation.py \
visualize_predictions.py \
onnx_converter.py
SRC_PATHS := fast_plate_ocr/ test/

# Tasks
.PHONY: help
Expand Down
26 changes: 26 additions & 0 deletions fast_plate_ocr/cli/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Main CLI used when training a FastPlateOCR model.
"""

try:
import click

from fast_plate_ocr.cli.onnx_converter import export_onnx
from fast_plate_ocr.cli.train import train
from fast_plate_ocr.cli.valid import valid
from fast_plate_ocr.cli.visualize_augmentation import visualize_augmentation
from fast_plate_ocr.cli.visualize_predictions import visualize_predictions
except ImportError as e:
raise ImportError("Make sure to 'pip install fast-plate-ocr[train]' to run this!") from e


@click.group(context_settings={"max_content_width": 120})
def main_cli():
"""FastPlateOCR CLI."""


main_cli.add_command(visualize_predictions)
main_cli.add_command(visualize_augmentation)
main_cli.add_command(valid)
main_cli.add_command(train)
main_cli.add_command(export_onnx)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ pandas-stubs = "^2.2.0.240218"
pylint = "^3.1.0"
types-pyyaml = "^6.0.12.20240311"

[tool.poetry.scripts]
plate_ocr = "fast_plate_ocr.cli.cli:main_cli"

[tool.ruff]
line-length = 100
target-version = "py310"
Expand Down

0 comments on commit 9a8ddee

Please sign in to comment.