> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/data-logic/flow-control/batch-processing.md).

# Batch Processing

This function block collects multiple input values into a single batch container to reduce memory usage during processing. Use it when you want to group items (images, data, or generic values) into a single stream that other blocks can consume as a batch.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Input 1`\
First value to be included in the batch. Can be image data, numbers, text, lists, or other generic values.

`Input 2`\
Second value to be included in the batch. Additional inputs can be connected depending on your workflow.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Batch`\
A single batched list that contains the connected input values grouped for batch processing.

## 🕹️ Controls <a href="#controls" id="controls"></a>

This function block has no interactive controls. It works by grouping whatever is connected to its input sockets.

## 🎯 Features <a href="#features" id="features"></a>

* Groups multiple inputs into a single, memory-friendly batch object for downstream processing.
* Accepts generic data types so it can batch images, numbers, text or lists.
* Useful for lowering memory footprint when handling many items in a pipeline.

## 📝 How to use <a href="#usage" id="usage"></a>

1. Connect the items you want to group into `Input 1` and `Input 2` (or more inputs if available).
2. The block will output a single `Batch` that contains those inputs as a list.
3. Feed the `Batch` output into blocks that accept batch-style input or into blocks that can iterate over the batch.

## ⚙️ Running behavior <a href="#evaluation" id="evaluation"></a>

When the scenario runs, the function block collects values present at its input sockets and emits them bundled as a single `Batch`. If an input is missing or invalid, the batch will include a placeholder for that entry so downstream blocks can handle it consistently.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Create grouped image sets from multiple sources by combining image inputs like `Load Image`, `Camera USB`, `Camera IP (ONVIF)`, or `Video` into a single `Batch` for processing.
* Use `Batch Processing` before heavy AI blocks such as `Object Detection`, `Mask Detection`, `Super Resolution`, or `OCR` to reduce peak memory usage when running many images.
* After processing a batch, use `Debatch` to split the results back into individual items for drawing or saving.
* Merge multiple batches with `Batch Concatenation` when you need to combine batches created in different parts of a workflow.
* Use `Get Batch Size` and `Get Element` to inspect or access items inside the `Batch` for conditional logic or selective processing.
* When saving results, connect the per-item outputs (after `Debatch`) to `Image Logger`, `Image Write`, or `Record Video` to store processed images efficiently.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No data in `Batch`: Verify the upstream blocks are producing values on the inputs. If an input is intentionally empty, that empty slot will appear in the batch.
* Unexpected item order: The batch preserves the order of inputs as connected. Reorder connections if a different sequence is required.
* Downstream blocks not accepting the batch: Some blocks expect single items rather than batches. Use `Debatch` to convert a batch back to individual items before feeding those blocks.
