How drebain/deep_medial_fields works
Project Type and Purpose
• This is a research-oriented Python project implementing the “Deep Medial Fields” method described in the linked arXiv paper.
• It is neither a web app nor a compiler, but a computational pipeline for training and evaluating a neural network model on 3D mesh datasets (the .obj files in datasets/).
Analysis of File Structure
• Top-level modules:
• data.py, datasets/ – data loading and preprocessing of 3D meshes
• model.py, bilinear.py, loss.py, config.py – network architecture, custom layers, loss definitions, and hyperparameters
• training.py, run_train.py, summary.py – training loop, experiment launcher, logging/summaries
• rendering.py, run_ao.py – inference/rendering of ambient occlusion or other outputs using the trained model
• Support files: .pylintrc, requirements.txt
• No frontend/backend split – it’s a single Python pipeline.
Key Components
a. Data Ingestion Component
• Source: datasets/*.obj
• Loader & Preprocessor: data.py
• Outputs: point clouds / sampled medial fields
b. Model Component
• Custom layers: bilinear.py
• Architecture: model.py
• Configuration: config.py
c. Training Component
• Loss computation: loss.py
• Optimizer & Loop: training.py
• Entry point: run_train.py
• Summaries/logs: summary.py
d. Inference/Rendering Component
• Inference script: run_ao.py
• Rendering pipeline: rendering.py
e. External Services & Frameworks
• JAX (autodiff, XLA, GPU/TPU backend)
• Standard Python libs (NumPy, etc.)
Relationships and Data Flow
• Data Ingestion → Model Input
• Model ↔ Loss Module (forward & backward passes)
• Training Loop writes to Summaries/Checkpoints
• Trained Model → Rendering/Inference
• All compute tasks executed by JAX on CPU/GPU
Architectural Patterns & Principles
• Modular separation of concerns: data, model, loss, training, rendering
• Pipeline model: clear unidirectional flow from raw data to final output
• Configuration-driven experiments via config.py
• Reusability of components (e.g., bilinear.py layer can be shared between training and inference)
Technologies & Frameworks to Annotate
• Python 3.x
• JAX (autodiff, jit, XLA)
• OBJ file format for 3D meshes
• Logging/summary (TensorBoard or custom)
Detail Level
• How run_train.py orchestrates imports from data.py, model.py, loss.py, and launches training.py.
• How run_ao.py loads the saved model and calls rendering.py.