Overview
Thevisualize_results module generates a comprehensive suite of publication-ready plots from evaluation results, including error analysis, confidence validation, runtime comparison, resource usage, and before/after signal overlays.
Functions
generate_plots
Path to the results CSV generated by
run_batch.Output directory for generated plots.
error_vs_offset.png- Grouped bar chart of MAE per true offsetconfidence_vs_error.png- Scatter plot with regression linesaudio_video_diff_histogram.png- Distribution of cross-method differencesruntime_comparison.png- Mean runtime per methoderror_distribution_boxplot.png- Boxplots with individual pointsresource_usage.png- CPU and memory usage comparisonbefore_after/*.png- Motion signal overlays per test casetimelines/*.png- Sync timeline diagrams per test case
Plot Functions
plot_error_vs_offset
Results dataframe.
Directory where the plot will be saved.
error_vs_offset.png
plot_confidence_vs_error
Results dataframe.
Directory where the plot will be saved.
confidence_vs_error.png
Features:
- Scatter points colored by method
- Linear regression line per method
- Pearson correlation coefficient annotations
plot_audio_video_diff_histogram
Results dataframe.
Directory where the plot will be saved.
audio_video_diff_histogram.png
Features:
- Vertical lines for mean and median differences
- Legend showing numerical values
plot_runtime_comparison
Results dataframe.
Directory where the plot will be saved.
runtime_comparison.png
Features:
- Error bars showing standard deviation
- Value labels on bars
plot_error_distribution
Results dataframe.
Directory where the plot will be saved.
error_distribution_boxplot.png
Features:
- Boxplots with median lines
- Individual data points overlaid with jitter
- No outlier markers (all points shown)
plot_resource_usage
Results dataframe.
Directory where the plot will be saved.
resource_usage.png
Features:
- Two subplots: CPU and memory
- Error bars showing standard deviation
- Value labels formatted appropriately
plot_motion_before_after
Results dataframe.
Directory where plots will be saved.
Directory containing NPZ diagnostic files from
run_batch.before_after/*.png (one per test case)
Features:
- Two subplots per case: before and after alignment
- Time-aligned x-axes
- Color-coded signals
plot_sync_timelines
Results dataframe.
Directory where timelines will be saved.
timelines/*.png (one per test case)
Features:
- Horizontal bars for original and synthetic videos
- Arrows showing true offset (solid) and estimated offsets (dashed)
- Annotations for padding/trimming actions
- Zero reference line
Helper Functions
_apply_style
- Sans-serif font family
- Light gray background (#FAFAFA)
- Grid with dashed lines
- No top/right spines
- Consistent sizing
Usage Example
CLI Usage
Configuration
Default Paths
Styling Constants
Matplotlib Backend
Plot Gallery
1. Error vs Offset
Grouped bar chart comparing audio and visual MAE across different offset magnitudes. Useful for identifying which offsets are more challenging for each method.2. Confidence vs Error
Scatter plot with regression lines showing the relationship between confidence scores and synchronization errors. Negative correlation indicates confidence is a useful quality indicator.3. Audio-Video Difference Histogram
Distribution of differences between audio and visual estimates. Narrow distribution indicates good cross-method agreement.4. Runtime Comparison
Direct comparison of mean execution time between audio and visual methods, with error bars showing variability.5. Error Distribution Boxplot
Comprehensive view of error distributions across all offsets, showing median, quartiles, and individual data points.6. Resource Usage
Side-by-side comparison of CPU and memory consumption, helping identify computational bottlenecks.7. Motion Before/After
Per-case visualization of motion signals before and after alignment, demonstrating the visual sync algorithm’s effectiveness.8. Sync Timelines
Timeline diagrams showing video bars, true offset, and estimated offsets as arrows. Provides intuitive visualization of synchronization results.Notes
- High Resolution: All plots saved at 300 DPI for publication quality.
- Color Consistency: Audio = blue (#2196F3), Visual = orange (#FF9800) across all plots.
- Batch Output: Generates dozens of plots in a single run for comprehensive analysis.
- Non-Interactive: Uses Agg backend, safe for headless/script execution.
- Graceful Degradation: Skips plots gracefully if required data is missing (e.g., resource metrics, diagnostics).