How riccardodmts/rclpod_yolo works
Project Type and Purpose
• This is a Python-based Machine Learning research toolkit implementing several Continual Learning (CL) strategies (Naive FT, Replay, OCDM, LwF, Pseudo-label, and the proposed RCLPOD) on top of the YOLOv8 object detector.
• It provides a command-line interface (CLI) to launch experiments, a configurable pipeline for dataset preparation, training, replay memory management, label propagation, evaluation, and plotting.
File Structure Analysis
• Top-level:
• clod/ ← core source folder
• docs/ ← Sphinx documentation
• README.md, LICENSE.
• clod/ substructure:
• cfg/ ← experiment configurations (VOC/COCO scenarios)
• data/ ← dataset abstractions and replay memory logic
• loss/ ← custom loss functions (YOLO loss, LwF, our loss, LwF loss)
• trainer/ ← base and method-specific training loops
• validation/ ← evaluation & validation hooks
• plot/ ← plotting utilities and notebooks
• *.py scripts ← entry-points for each CL method
• utils.py, prepare_data.py
• Dependencies:
• ultralytics (YOLOv8 backbone)
• micromind (data/model utilities)
• PyTorch, YAML, standard ML libs
High-Level System Components
a. CLI / Entry-Point Layer
• Scripts (naive_train, replay_train, ..., RCLPOD_train_yolov8.py)
• Parse command-line args → load config file (cfg/yolov8*.py)
b. Configuration Loader
• Reads dataset paths, experiment settings (exp name, replay size, CL schedule)
c. Dataset Manager
• clod/data/mydataset.py: handles initial dataset (VOC/COCO)
• clod/data/replay_data.py & OCDM.py: implements replay memory selection
d. Model & Loss Layer
• ultralytics YOLOv8 model instantiation
• Custom loss modules (in clod/loss/) plugged into trainer
e. Trainer Layer
• BaseTrainer (common training loop)
• Specialized trainers (lwf_trainer, yolo_trainer, ours_trainer, etc.)
• Manages forward/backward, replay sampling, label propagation, optimizer, scheduler
f. Validation & Logging
• clod/validation/validator.py: computes metrics
• plot utils: generate result curves and tables
g. External Services / Libraries
• ultralytics module for model/API
• micromind toolkit for additional data/model utilities
Relationships and Data Flow
1. User invokes a training script with a config file.
2. Config Loader parses scenario and hyperparameters.
3. Dataset Manager loads initial images and ground-truth.
4. Trainer instantiates YOLO model and selects a CL strategy:
• If RCLPOD: initializes replay memory + label propagation module.
5. Training loop:
a. Sample a batch from current task + replay memory
b. Forward pass through YOLO model
c. Compute loss via appropriate Loss module
d. Backprop, update model parameters
e. Update replay memory (e.g. OCDM selection)
6. Periodic validation via Validation component.
7. Plotting and result storage (weights, logs, figures).
Architectural Patterns & Principles
• Modular layering: CLI → Config → Data → Model → Trainer → Validation → Plot.
• Strategy pattern for trainers: interchangeable CL methods extend BaseTrainer.
• Separation of concerns: data loading, replay management, loss computation, model definition, training loop, and evaluation are decoupled.