How ductq1801/road-damage-detection-tflite works
Main Components
a. Data & Weights:
• Input Data (raw images, COCO, VOC datasets).
• Pre-trained weights (Darknet weights such as yolov4.weights or yolov4-tiny.weights).
b. Model Conversion & Training Pipeline:
• Conversion modules (save_model.py, convert_tflite.py, convert_trt.py) that transform Darknet models to TensorFlow, TFLite, or TensorRT.
• Training engine (train.py) that supports model training or transfer learning using the provided configuration (core/config.py) and dataset modules (core/dataset.py).
c. Core Detection and Utility Engine:
• Core modules (in the core folder – backbone.py, common.py, config.py, dataset.py, utils.py, and yolov4.py) that define model architectures, data processing, and inference utilities.
• Evaluation scripts (evaluate.py and mAP folder scripts) for performance assessment.
d. Scripts and Data Pipeline:
• Data preparation and conversion tools (scripts folder, including coco_annotation.py, coco_convert.py, and VOC-related scripts) that preprocess datasets.
• Utility scripts for annotations and dataset formatting.
e. Mobile Deployment:
• Android project folder that includes app source code, resource files, and Gradle build scripts.
• Mobile integration using TFLite models (the assets folder holds TFLite models and label/config files).
• Test cases (androidTest folder) to ensure detection functionality.
Relationships & Interactions
• Flow from model data input (e.g., Darknet weights and image/video inputs) to the conversion module (save_model.py) then branching out:
– One path for TensorFlow-based detection (using detect.py and detect_video.py scripts) for standard usage.
– Another path for conversion to TFLite (via convert_tflite.py), which feeds into mobile (Android) applications.
– There is an additional branch for TensorRT conversion (via convert_trt.py) for performance optimization.
• The training pipeline (train.py) connects with core modules and datasets to modify/finetune models.
• Evaluation and benchmarking routines (evaluate.py, mAP scripts) loop back to validate the performance of the conversion or training output.
Architectural Patterns & Design Principles
• Modular design: The project is separated into distinct modules – conversion, training, evaluation, dataset handling, and mobile deployment.
• Pipeline flow: Indicate a step-by-step data/model processing pipeline (input weights → conversion → training/evaluation → deployment).
• Reusability and extensibility: Core modules (in the core folder) are intended to be reusable across different conversion flows and use cases.
Relevant Technologies & Frameworks
• Python for scripting (model training, conversion, evaluation).
• TensorFlow and TFLite for model inference and mobile compatibility.
• TensorRT as an additional optimization layer for GPU-based inference.
• Android (Java-based components and Gradle build system) for on-device inference.
• External datasets (COCO 2017 and VOC) for training and evaluation.