Repository navigation
Fix figure issues - #320
Merged
Merged
Conversation
jolaem
self-requested a review
September 16, 2026 08:58
# Conflicts: # avae/vis.py
Refine plot sizing, typography, colorbars, image output, and pipeline test behavior.
jolaem
approved these changes
Sep 16, 2026
jolaem
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me.
I've added a few more changes that were breaking some other figures and moved your change to a general function. Do have a test and let me know if it works for you. if so I'll merge. Thanks!
The default axis tensor was created on the CPU, while the splat renderer runs on `device`, which breaks GPU runs.
Compute class-averaged cosine similarity (mean and std) from per-class sums of unit vectors, without building the N x N pairwise matrix. Memory no longer grows quadratically with the number of samples. A test checks the results against the full pairwise computation, including classes absent from the data.
- Drop the tensorboard option, SummaryWriter and every writer argument to plot functions, and remove the tensorboard dependency. - Add a vis_print option to render figures at 300 dpi for print, and document svg as a vis_format. - Rename accuracy_plot to confusion_plot and log "Overall accuracy". - Extract the shared _loss_curve_figure, _matrix_figure and _save_grid_figure helpers. Vector formats are embedded at native resolution.
Saving and layout - Add save_figure as the single save path. Non-print rasters are capped at 720 px tall (top half of a 1440p screen); vis_print saves at 300 dpi and full size; image grids keep native resolution. - Replace tight_layout with margins estimated from the tick labels the axes will draw, with equal outer padding on all sides. This avoids an extra text-layout pass. Style - Apply one rc style (_STYLE) to every plot through @_styled, and drop the scattered bold rc_context blocks. - Use one title format for every epoch-based figure: "X at epoch N". Titles scale with the figure and shrink only when they would not fit. Matrix plots - Build matrix figures around a fixed-size image, so the matrix keeps its size and the padding is even. - Draw the affinity and similarity matrices through one _similarity_figure helper, so they look identical. Remove the "Class Labels" axis labels and the ignored font_size and dpi parameters. - Draw only the normalised confusion matrices; both CSVs are still written. Train and validation share a _confusion_figure helper. - Write per-cell values only for MAX_ANNOTATED_CLASSES (25) classes or fewer. At 53 classes, N^2 text objects took about 14 s per call. Embeddings - Give t-SNE plots an 8:5 data area, matching the interactive embedding, with the legend outside the axes. Stop truncating legend labels to four characters and stop scaling markers with the class count.
Decode each latent/pose grid in a single decoder call instead of one call per cell (21-36 GPU round trips per plot). Outputs match the previous loops to within 1e-7. interpolations_plot now interpolates poses from the four drawn class representatives rather than the first four classes.
The affinity matrix is fixed input, so skip plotting it again when the existing plot is newer than the CSV and was made with the same CSV path, vis_print setting and selected classes, which are recorded in plots/affinity_matrix_classes.txt.
The class-distribution histograms collected labels by iterating every train, validation and test batch. That read, transformed and PNG-encoded every image just to get its label, and sum(..., ()) made the collection quadratic in the number of batches. Labels come from the file name, so read them from the dataset paths instead. Histograms now count every sample in each split, including the last partial training batch.
- Build t-SNE class masks once instead of rebuilding the label array for every class. - Read the affinity CSV header once per path with a cached _affinity_classes helper, placed with the other private helpers. - Warn and return instead of crashing in pose_class_disentanglement_plot (no poses) and latent_4enc_interpolate_plot (fewer than 4 classes), and accept suffix=None in confidence_plot. - Remove unused locals.
Move the plotting, grid, mrc, colour, pose-interpolation and similarity-matrix helpers out of utils into a new utils_vis module, leaving as_list and latest_file in utils. A pure move with no behaviour changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed the logic for figure and font sizing