You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Renders a FlowResult with its configured style. strategy overrides the channel ranking for this
drawing. FlowFigure has .fig, .ax, .stage_artists (stage key → artists), .edge_artists
and .layout.
Renders one frame per input with stages, channels, per-channel scales and the PCA colour basis held
fixed. inputs is a tensor [T, …] (one frame per leading index) or any iterable of per-frame
inputs (tensors or dicts). Writes MP4 (needs imageio-ffmpeg) or GIF, and returns the path
written. See movies.md.
Gaussian-weighted sliding-window fusion of every dense output of x[1, C, X, Y, Z]; state.fused(name) returns labels [1, 1, *S] (multi-class) or values (single channel)
download TotalSegmentator's models / example CT once
zoo.load_model("nnunet:DIR[:FOLD]"), zoo.load_model("totalseg") and zoo.load_input(path, lm, whole=True)
wrap these. The adapter context manager neural_flow.adapters.inference_view(model) is what switches
deep supervision off. See nnU-Net and TotalSegmentator.
The tensor → summary → RGBA-raster dispatcher, usable on its own.
role ∈ {"input", "activation", "output"}. Visual.image is an [H, W, 4] float array.
FlowConfig options
Every option can be passed as a keyword to visualize_model, trace_model, animate_inputs and
animate_model, or collected in a FlowConfig(...). Adapters (CNN, U-Net, transformer, 3-D)
may adjust defaults you have not set yourself; for example, 3-D models rank channels by
variance.
Stage selection
option
default
meaning
layer_selection
"auto"
"auto", "all" (every non-trivial leaf module) or a predicate f(ModuleCall) -> bool
layers
None
explicit selectors: "name", "name#k" (k-th call of a reused module), "re:<regex>", "type:<ClassRegex>"
physical field of view (x, y, z), computed from voxel_spacing
animate_inputs also accepts frame_hook(t, result) (edit a frame's result before it is drawn) and
thumb_fn(t, result) (film-strip image), which sliding_window_movie uses.
FlowResult
attribute
content
config
the resolved FlowConfig (after adapter defaults)
stages
stages in execution order (Stage: key, label, kind, concept, summary, call, is_head)
Explanation: units (receptive fields, dependency maps), gradcam, contributions
rollout
attention-rollout matrix (transformers), if captured
trace
raw metadata pass: every module call, shapes, dataflow ops
notes
warnings and summarization notes
context
extras such as the sliding-window geometry (context["sliding_window"])
summary_table()
text table of stages and outputs
Extending
Adapters: subclass neural_flow.adapters.Adapter (match, defaults, concepts, and
optionally select(trace, cfg) to propose the stages) and register it with
neural_flow.adapters.register_adapter(...) to add defaults, stage choice and conceptual stage
names for an architecture family. HybridTransformerUNetAdapter (UNETR / Swin UNETR / UNesT) is an
example of a select.