How idealo/image-quality-assessment works
Main Components
• Data / Datasets: Represent the datasets (AVA and TID2013) and label files (stored in the data directory) that are used for training and evaluation.
• Model Configuration & Weight Storage: Show the “models/MobileNet” folder where you store configuration JSON files and HDF5 weights.
• Training Module: Capture the training pipelines split into local training (via the “train-local” script) and remote training on AWS EC2 (via the “train-ec2” script). Also include the “src/trainer” module which contains the training code and “src/handlers” for data generation, configuration loading, and model construction.
• Prediction Module: Represent the prediction interface provided either by running the “predict” script (with Docker image “nima-cpu”) or by using the evaluation code under “src/evaluater”. Also note the dedicated testing images and the sample client for TF Serving.
• TensorFlow Serving Component: Highlight the “contrib/tf_serving” directory which contains the Dockerfile, configuration, and client scripts to deploy the model via TensorFlow Serving.
• Docker & Container Infrastructure: Include the Dockerfiles (for CPU, GPU, and TFS), entrypoint scripts, and the integration with AWS (via Docker Machine and nvidia-docker on EC2) as separate components responsible for encapsulating and orchestrating the runtime environment.
• Documentation & Developer Tools: Include mkdocs (documentation) and configuration/build scripts (e.g., .travis.yml, CONTRIBUTING.md) for CI/CD and community involvement.
Relationships and Data Flows
• Data flows from datasets (data directory) into the training module. During training, the system uses model configurations (from the “models” directory) and generates output (trained model weights, logs, and evaluation metrics from “src/evaluater”) that are stored locally or pushed to S3 (as mentioned for EC2 training).
• The training process is started either via local or remote entrypoint scripts, which run inside Docker containers (indicated by the Dockerfiles and entrypoint scripts).
• For inference, the trained models are either invoked by the “predict” script which triggers a Docker container with “nima-cpu”, or they are deployed via the TensorFlow Serving container (built from “contrib/tf_serving/Dockerfile”), with predictions being served to external clients through the sample API calls.
• External clients (or testing pipelines) interact with the prediction endpoints and obtain image quality ratings.
• Developer documentation (via mkdocs) and community contribution guidelines (in CONTRIBUTING.md) are maintained separately.
Architectural Patterns & Design Principles
• Separation of Concerns: The design clearly separates the training (model building, evaluation) from prediction (inference serving), and further distinguishes local versus remote training workflows.
• Containerization: Use of Docker (with separate images for CPU, GPU, and TF Serving) encapsulates environment dependencies and ensures reproducibility across platforms.
• Modularity: The project architecture is modular – with distinct directories for data handling, model configuration, training routines, and serving scripts.
• Extensibility: The presence of configuration files and contribution guidelines suggests that new model architectures (e.g., switching the base model from MobileNet to InceptionV3) can be integrated with minimal impact on the overall system.
• Cloud Integration: Specific design for training remotely on AWS EC2 emphasizes the system’s ability to scale and integrate with cloud resources, including considerations for GPU instance orchestration and S3 storage.
Elements
• Each functional component (Data Provider, Trainer, Predictor, TF Serving, Documentation)
• Distinct layouts or sections for local environment versus cloud-based (EC2) workflows.