How aaditya01sehgal/holospark works
Purpose and topology
HoloSpark converts a 2D image into a depth-informed, phase-only hologram. It is a three-tier system: React/Vite user interface, Spring Boot orchestration/API, and a Python/PyTorch image-processing and computational-holography engine.
Entry points
• React application bootstrap: HoloSpark_Frontend/src/main.jsx; root UI and routing/state composition: HoloSpark_Frontend/src/App.jsx.
• Spring Boot server bootstrap: HoloSpark_Backend/src/main/java/com/holo/HoloApplication.java.
• Python operational entry point: HoloSpark_AI_Engine/inference.py; model training/evaluation entry points are HoloSpark_AI_Engine/train_ccnn.py and HoloSpark_AI_Engine/evaluate_div2k.py.
User interaction and presentation
The frontend owns image submission, processing feedback, errors, and rendering of generated artifacts. The generation workflow is centered in HoloSpark_Frontend/src/pages/GeneratePage.jsx, with upload and output boundaries in HoloSpark_Frontend/src/components/UploadSection.jsx and HoloSpark_Frontend/src/components/ResultsSection.jsx. It runs on Node/Vite and communicates with the backend rather than directly invoking AI models.
API orchestration and file boundary
Spring Boot exposes the hologram workflow through HoloSpark_Backend/src/main/java/com/holo/controller/HologramController.java. HoloSpark_Backend/src/main/java/com/holo/service/FileStorageService.java manages upload/result filesystem handling, while HoloSpark_Backend/src/main/java/com/holo/service/PythonBridgeService.java is the cross-runtime boundary that launches or coordinates Python inference. Application/CORS/static-server behavior is configured through HoloSpark_Backend/src/main/resources/application.properties and HoloSpark_Backend/src/main/java/com/holo/config/WebConfig.java.
AI pipeline: scene geometry and views
Python inference transforms the submitted source into depth and synthesized viewpoints. HoloSpark_AI_Engine/src/depth_estimator.py encapsulates monocular MiDaS-based depth prediction. HoloSpark_AI_Engine/src/view_synth.py performs depth-image-based rendering/parallax and occlusion handling. HoloSpark_AI_Engine/src/holo_effect.py and HoloSpark_AI_Engine/src/holography.py connect image/depth representations to hologram-oriented processing.
AI pipeline: optical encoding and refinement
The wave-optics stage performs phase encoding and angular-spectrum propagation, with FFT-oriented implementation in HoloSpark_AI_Engine/src/asm_layer.py. The learned enhancement path is defined by HoloSpark_AI_Engine/src/ccnn_model.py, supported by complex-valued operations in HoloSpark_AI_Engine/src/complex_layers.py and EDSR-based refinement in HoloSpark_AI_Engine/src/edsr_module.py. Checkpoint artifacts reside under HoloSpark_AI_Engine/shared_data/checkpoints/.
End-to-end control and outputs
Control flows from browser upload → Spring controller/storage → Python bridge/inference → depth, view, phase, and refined hologram artifacts → backend response/storage → frontend results display. The core runtime boundary is Java process/filesystem orchestration to Python; model execution depends on Python 3.10+, PyTorch, MiDaS, OpenCV, NumPy, and likely GPU acceleration. Backend metrics/results are materialized under HoloSpark_Backend/shared_data/results/metrics.json.
Main entry points: HologramController.java Hologram API · GeneratePage.jsx Generation workflow · FileStorageService.java File storage · ccnn_model.py Learned refinement
Components 18
React/Vite frontend
- Frontend bootstrap
HoloSpark_Frontend/src/main.jsx - App shell and state
HoloSpark_Frontend/src/App.jsx - Generation workflow · Coordinates submission, progress, and errors.
HoloSpark_Frontend/src/pages/GeneratePage.jsx - Image upload
HoloSpark_Frontend/src/components/UploadSection.jsx - Hologram results
HoloSpark_Frontend/src/components/ResultsSection.jsx
Spring Boot backend
- Backend bootstrap
HoloSpark_Backend/src/main/java/com/holo/HoloApplication.java - Hologram API · Receives workflow requests and returns generated artifacts.
HoloSpark_Backend/src/main/java/com/holo/controller/HologramController.java - File storage · Manages uploaded inputs and generated result files.
HoloSpark_Backend/src/main/java/com/holo/service/FileStorageService.java - Python bridge · Launches or coordinates Python inference.
HoloSpark_Backend/src/main/java/com/holo/service/PythonBridgeService.java - Result metrics
HoloSpark_Backend/shared_data/results/metrics.json
Python AI engine
- Inference pipeline · Orchestrates depth, view synthesis, phase encoding, and refinement.
HoloSpark_AI_Engine/inference.py - Monocular depth
HoloSpark_AI_Engine/src/depth_estimator.py - View synthesis · Creates parallax views with occlusion handling.
HoloSpark_AI_Engine/src/view_synth.py - Hologram processing
HoloSpark_AI_Engine/src/holography.py - Phase encoding and propagation · FFT-based phase-only hologram computation.
HoloSpark_AI_Engine/src/asm_layer.py - Learned refinement · Enhances computed holograms with complex-valued learned layers.
HoloSpark_AI_Engine/src/ccnn_model.py - Model checkpoints
- Training and evaluation · Trains CCNN and evaluates on DIV2K.
HoloSpark_AI_Engine/train_ccnn.py
Connections 17
- Frontend bootstrap → App shell and state: mounts
- App shell and state → Generation workflow: composes
- Generation workflow → Image upload: collects image
- Generation workflow → Hologram API: submits workflow
- Hologram API → File storage: stores input/results
- Hologram API → Python bridge: starts inference
- Python bridge → Inference pipeline: process/filesystem boundary
- Inference pipeline → Monocular depth: predicts depth
- Monocular depth → View synthesis: depth map
- View synthesis → Hologram processing: synthesized views
- Hologram processing → Phase encoding and propagation: optical representation
- Phase encoding and propagation → Learned refinement: phase hologram
- Model checkpoints → Learned refinement: loads weights
- Learned refinement → File storage: generated artifacts
- File storage → Result metrics: materializes
- Hologram API → Hologram results: returns artifacts
- Training and evaluation → Model checkpoints: writes checkpoints