How bu-cisl/sbrnet works
Project Type and Purpose
• This is an open‐source Python package (sbrnet_core) for simulator‐trained deep learning in fluorescence imaging.
• It provides two main capabilities: synthetic data generation (to simulate scattering microscopy measurements) and training a neural network model (SBR‐Net) to reconstruct 3D volumes from 2D measurements.
Key Architectural Components
a. CLI/Script Layer
• Entry‐point scripts in scripts/ (e.g., run_gen_syn_data.sh, run_train.sh) that wrap calls to:
– sbrnet_core/synthetic_data/main.py (generates synthetic datasets)
– sbrnet_core/sbrnet/main.py (trains the SBR‐Net model)
• HPC job submission wrappers (*.qsub) that schedule these scripts.
b. Core Library (sbrnet_core/)
• config_loader.py: loads YAML configuration for both data and training.
• Utils: common constants and utility functions (utils/).
• Synthetic Data Module (synthetic_data/):
– Data generators (generate_synthetic_data_v1.py, deprecated version)
– Composite GT creation (make_composite_gt.py)
– CLI entrypoint (main.py).
• SBR‐Net Module (sbrnet/):
– Dataset abstraction (dataset.py) that reads synthetic measurements and ground truth.
– Noise model (noisemodel.py) to simulate sensor noise.
– Model definition (model.py) for the neural network architecture.
– Loss functions (losses/pinball.py).
– Trainer (trainer.py) orchestrating epochs, optimization, checkpointing.
– CLI entrypoint (main.py).
c. External Dependencies & Resources
• Python runtime, PyTorch (implied by model/trainer), NumPy, YAML, etc., as listed in requirements.txt.
• Data storage (e.g., Google Drive for raw datasets).
• Cluster scheduler (via qsub scripts) for large‐scale jobs.
Data Flows and Interactions
• User edits a YAML config → config_loader loads settings →
a) Synthetic data pipeline uses noise model → generates and writes synthetic 2D/3D datasets.
b) Training pipeline ingests these datasets via the Dataset class → applies model architecture → trainer uses losses to optimize weights → saves model checkpoints and logs.
• Scripts wrap these pipelines and optionally submit them to a cluster scheduler.
Architectural Patterns & Design Principles
• Modular package structure separating concerns:
• Configuration (config_loader)
• Data generation
• Model training
• Utilities
• Clear CLI boundary for batch jobs vs. library functions.
• Extensibility points: new noise models, loss functions, or network architectures can be added by dropping files into the respective subdirectories.