Skip to main content
Version: 0.10.x [Latest Beta]

Evaluating a sequence of images

A batched image tensor is evaluated in a single run, producing one ImageInferenceResult per image in input order. This extends the classification example to a sequence. See Running inference for the batching model.

import denkflow

image_paths = ["path/to/image_1.jpg", "path/to/image_2.jpg", "path/to/image_3.jpg"]

pipeline = denkflow.Pipeline.from_denkflow("path/to/model.denkflow", pat="YOUR-PAT")
simplified = denkflow.SimplifiedPipeline(pipeline)

batch = denkflow.ImageTensor.from_files(image_paths)
results = simplified.run(batch)

for path, image_result in zip(image_paths, results):
print(f"Results for {path}:")
for r in image_result.results:
if r.scalar:
print(f" {r.scalar.class_label.name}: {r.scalar.value:.2f}")