Nodes/ComfyUI Neural Network Toolkit NNT /NNT Analyze Inference Metrics
ComfyUI Node

NNT Analyze Inference Metrics

NntAnalyzeInferenceMetrics — turns the pack's inference stats into a plot you can see

By inventorado·Created 2 years ago·Updated 2 years ago· 69
NNT Analyze Inference Metrics
  • metrics
  • IMAGE
  • STRING
image_width1024
image_height768
plot_typecombined

This is the "did my model run fast, and is it confident?" node. NntAnalyzeInferenceMetrics sits at the end of an NNT inference workflow, takes the metrics dictionary that the pack's inference nodes produce, and renders it two ways: as a matplotlib plot converted into a ComfyUI IMAGE, and as a plain-text STRING report. Training gives you loss curves; this gives you the inference-side equivalent.

Inputs

  • metrics - a DICT. This is the one that matters, and it's the one that's easy to get wrong: it isn't a free-form dictionary you type. It's the output of the pack's inference/evaluation nodes, and it's expected to contain specific keys. The code reads batch_metrics (a list of per-batch dicts with a processing_time field), confidence_stats (with min/mean/max), plus total_samples and processing_time. If you hand it something without those shapes, you'll get an empty-looking plot and a 0.000 in the report.
  • image_width / image_height - the resolution of the rendered plot, defaulting to 1024×768. Only matters for how big the output image is; ComfyUI preview can handle it either way.
  • plot_type - performance, confidence, or combined (default). Performance draws a line plot of processing time per batch; confidence draws a min/mean/max bar chart of prediction confidence; combined stacks both in one figure.

Outputs: IMAGE (the rendered plot, ready for a Preview Image node) and STRING (a text summary: total samples, total time, samples per second, and the confidence stats). One node, two ways to look at the same numbers.

How it works

Straightforward and honest: it imports matplotlib and seaborn, builds the requested figure, saves it to a PNG in memory, and converts that to a torch tensor in [N, H, W, C] IMAGE format. The report string is assembled from the same dictionary. If anything throws - say, a missing key - it swallows the error and returns a blank black image plus an error string instead of crashing your workflow. That's a friendly failure mode for a teaching tool.

When you'd actually use it

If you're doing the pack's MNIST inference workflow (load model → run inference → score predictions), this is the natural end cap: it answers "is it fast?" and "is it sure?" in one place. Honestly, for pure image-generation users it's irrelevant - there's no SDXL anything here. It's part of the toolkit's story about teaching what inference metrics look like.

Common issues

  • Blank plot or zeros in the report - the metrics DICT doesn't have the expected structure. Check what node you're feeding in from; it should be the metrics output of an NNT inference/evaluation node, not an arbitrary dictionary.
  • It's an output node - is_output_node is true, meaning ComfyUI treats it as a terminal. Don't try to chain something meaningful off its IMAGE unless you know what you're doing.

Install

Ships with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/inventorado/ComfyUI_NNT.git
cd ComfyUI_NNT
pip install -r requirements.txt

or via ComfyUI Manager under "ComfyUI Neural Network Toolkit NNT", then restart. The matplotlib/seaborn dependencies come along with the pack's requirements, so nothing extra to install.

CategoryNNT Neural Network Toolkit/Inference

Inputs (4)

NameTypeDefaultDescription
metricsDICT
image_widthINT1024256–4096
image_heightINT768256–4096
plot_typeCOMBOcombined3 options: performance, confidence, combined

Outputs (2)

NameTypeDescription
IMAGEIMAGE
STRINGSTRING