How chauminhnguyen/ocr works
Main Components
• Input & Preprocessing:
– Include modules/scripts such as pipeline.py, demo.py, crop_images.py and any image processing utilities (e.g., imgproc.py, file_utils.py).
• Text Detection Module:
– Represent the “CRAFT” component which includes its own code (e.g., craft.py, craft_utils.py) for text detection.
– Note that the CRAFT directory also contains a “basenet” submodule (with vgg16_bn.py) and model-related files.
• Text Recognition Modules:
– Illustrate “MORAN_v2” as one of the recognition engines (with its models and tools directories, and scripts like demo.py, inference.py, and main.py).
– Include “deep-text-recognition-benchmark” (which implements StarNet) with its own set of modules (e.g., modules for feature_extraction, prediction, sequence_modeling, transformation) and accompanying scripts.
– Optionally note external/alternative modules (VietOCR and EasyOCR) that are mentioned in the README, even if they are not fully included in the file structure, showing that the project supports multiple recognizers.
• Models & Pre-trained Assets:
• Utilities & Supporting Scripts:
– Capture utility functions (file_utils.py, demo files, and others) and any testing scripts (test.py in several directories).
Interactions & Data Flow
• The Input passes through preprocessing routines.
• Point out that the outputs from these recognizers are then combined or used to form the final OCR results.
Architectural Patterns and Design Principles
• Modularity: Separate directories for detection and recognition illustrate a modular design.
• Extensibility: The architecture supports multiple recognition components using a plug-and-play method.
• Data Flow: Emphasize a clear sequential pipeline—from input and detection to recognition.
• External Dependencies: Clearly mark where external pre-trained models are integrated.
• Utility & orchestration scripts (e.g., pipeline.py, demo.py) indicate the overall control flow.