CSV Formatter¶
Class: CSVFormatterBlockV1
Source: inference.core.workflows.core_steps.formatters.csv.v1.CSVFormatterBlockV1
The CSV Formatter block prepares structured CSV content based on specified data configurations within a workflow. It allows users to:
-
choose which data appears as columns
-
apply operations to transform the data within the block
-
aggregate whole batch of data into single CSV document (see Data Aggregation section)
The generated CSV content can be used as input for other blocks, such as File Sink or Email Notifications.
Defining columns¶
Use columns_data
property to specify name of the columns and data sources. Defining UQL operations in
columns_operations
you can perform specific operation on each column.
Timestamp column
The block automatically adds timestamp
column and this column name is reserved and cannot be used.
The value of timestamp would be in the following format: 2024-10-18T14:09:57.622297+00:00
, values
are scaled to UTC time zone.
For example, the following definition
columns_data = {
"predictions": "$steps.model.predictions",
"reference": "$inputs.reference_class_names",
}
columns_operations = {
"predictions": [
{"type": "DetectionsPropertyExtract", "property_name": "class_name"}
],
}
Will generate CSV content:
timestamp,predictions,reference
"2024-10-16T11:15:15.336322+00:00","['a', 'b', 'c']","['a', 'b']"
When applied on object detection predictions from a single image, assuming that $inputs.reference_class_names
holds a list of reference classes.
Data Aggregation¶
The block may take input from different blocks, hence its behavior may differ depending on context:
-
data
batch_size=1
: whenever single input is provided - block will provide the output as in the example above - CSV header will be placed in the first row, the second row will hold the data -
data
batch_size>1
: each datapoint will create one row in CSV document, but only the last batch element will be fed with the aggregated output, leaving other batch elements' outputs empty
When should I expect batch_size=1
?¶
You may expect batch_size=1
in the following scenarios:
-
CSV Formatter was connected to the output of block that only operates on one image and produces one prediction
-
CSV Formatter was connected to the output of block that aggregates data for whole batch and produces single non-empty output (which is exactly the characteristics of CSV Formatter itself)
When should I expect batch_size>1
?¶
You may expect batch_size=1
in the following scenarios:
- CSV Formatter was connected to the output of block that produces single prediction for single image, but batch of images were fed - then CSV Formatter will aggregate the CSV content and output it in the position of the last batch element:
--- input_batch[0] ----> ┌───────────────────────┐ ----> <Empty>
--- input_batch[1] ----> │ │ ----> <Empty>
... │ CSV Formatter │ ----> <Empty>
... │ │ ----> <Empty>
--- input_batch[n] ----> └───────────────────────┘ ----> {"csv_content": "..."}
Format of CSV document for batch_size>1
If the example presented above is applied for larger input batch sizes - the output document structure would be as follows:
timestamp,predictions,reference
"2024-10-16T11:15:15.336322+00:00","['a', 'b', 'c']","['a', 'b']"
"2024-10-16T11:15:15.436322+00:00","['b', 'c']","['a', 'b']"
"2024-10-16T11:15:15.536322+00:00","['a', 'c']","['a', 'b']"
Type identifier¶
Use the following identifier in step "type"
field: roboflow_core/csv_formatter@v1
to add the block as
as step in your workflow.
Properties¶
Name | Type | Description | Refs |
---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
columns_data |
Dict[str, Union[bool, float, int, str]] |
References data to be used to construct each and every column. | ✅ |
columns_operations |
Dict[str, List[Union[ClassificationPropertyExtract, ConvertDictionaryToJSON, ConvertImageToBase64, ConvertImageToJPEG, DetectionsFilter, DetectionsOffset, DetectionsPropertyExtract, DetectionsRename, DetectionsSelection, DetectionsShift, DetectionsToDictionary, Divide, ExtractDetectionProperty, ExtractFrameMetadata, ExtractImageProperty, LookupTable, Multiply, NumberRound, NumericSequenceAggregate, PickDetectionsByParentClass, RandomNumber, SequenceAggregate, SequenceApply, SequenceElementsCount, SequenceLength, SequenceMap, SortDetections, StringMatches, StringSubSequence, StringToLowerCase, StringToUpperCase, TimestampToISOFormat, ToBoolean, ToNumber, ToString]]] |
UQL definitions of operations to be performed on defined data w.r.t. each column. | ❌ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow
runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to CSV Formatter
in version v1
.
- inputs:
Line Counter
,Single-Label Classification Model
,Slack Notification
,YOLO-World Model
,Image Convert Grayscale
,Absolute Static Crop
,Perspective Correction
,OpenAI
,Distance Measurement
,Image Slicer
,OpenAI
,Cosine Similarity
,Halo Visualization
,Byte Tracker
,Corner Visualization
,Email Notification
,Detections Classes Replacement
,Object Detection Model
,Template Matching
,Roboflow Dataset Upload
,Overlap Filter
,Dynamic Crop
,Cache Set
,VLM as Classifier
,Depth Estimation
,Dynamic Zone
,Model Monitoring Inference Aggregator
,Cache Get
,Llama 3.2 Vision
,Anthropic Claude
,Crop Visualization
,Blur Visualization
,Dominant Color
,Image Threshold
,Stability AI Inpainting
,Relative Static Crop
,Path Deviation
,Clip Comparison
,Moondream2
,Twilio SMS Notification
,OCR Model
,Data Aggregator
,Google Vision OCR
,Property Definition
,Pixelate Visualization
,Stitch OCR Detections
,Image Slicer
,Time in Zone
,JSON Parser
,Webhook Sink
,Line Counter Visualization
,Byte Tracker
,Image Blur
,Florence-2 Model
,Delta Filter
,Detections Stabilizer
,LMM For Classification
,Instance Segmentation Model
,Keypoint Detection Model
,Bounding Rectangle
,Detections Stitch
,Stability AI Image Generation
,VLM as Classifier
,Identify Changes
,Detection Offset
,Camera Focus
,First Non Empty Or Default
,Polygon Zone Visualization
,Detections Filter
,Time in Zone
,Local File Sink
,Grid Visualization
,Instance Segmentation Model
,Trace Visualization
,Roboflow Custom Metadata
,Continue If
,Circle Visualization
,Environment Secrets Store
,Dimension Collapse
,Clip Comparison
,Triangle Visualization
,QR Code Detection
,Gaze Detection
,Line Counter
,Size Measurement
,Byte Tracker
,LMM
,Detections Consensus
,Velocity
,Buffer
,Stitch Images
,Segment Anything 2 Model
,Object Detection Model
,Model Comparison Visualization
,Keypoint Detection Model
,SIFT Comparison
,CLIP Embedding Model
,Expression
,CogVLM
,SmolVLM2
,VLM as Detector
,Image Preprocessing
,Pixel Color Count
,Background Color Visualization
,Barcode Detection
,Keypoint Visualization
,Color Visualization
,Multi-Label Classification Model
,Classification Label Visualization
,Camera Calibration
,Label Visualization
,Reference Path Visualization
,Single-Label Classification Model
,Google Gemini
,Roboflow Dataset Upload
,Identify Outliers
,Qwen2.5-VL
,Multi-Label Classification Model
,Detections Transformation
,SIFT Comparison
,Image Contours
,Polygon Visualization
,CSV Formatter
,SIFT
,Florence-2 Model
,Detections Merge
,Ellipse Visualization
,Mask Visualization
,Rate Limiter
,Bounding Box Visualization
,Dot Visualization
,VLM as Detector
,Path Deviation
- outputs:
Line Counter
,Polygon Zone Visualization
,Slack Notification
,Time in Zone
,Local File Sink
,YOLO-World Model
,Instance Segmentation Model
,Trace Visualization
,Roboflow Custom Metadata
,Perspective Correction
,OpenAI
,Distance Measurement
,Circle Visualization
,Clip Comparison
,OpenAI
,Triangle Visualization
,Halo Visualization
,Line Counter
,Size Measurement
,Corner Visualization
,Email Notification
,LMM
,Roboflow Dataset Upload
,Dynamic Crop
,Cache Set
,Model Monitoring Inference Aggregator
,Cache Get
,Segment Anything 2 Model
,Llama 3.2 Vision
,Anthropic Claude
,Model Comparison Visualization
,Crop Visualization
,CLIP Embedding Model
,CogVLM
,Image Threshold
,Stability AI Inpainting
,Image Preprocessing
,Keypoint Visualization
,Background Color Visualization
,Path Deviation
,Pixel Color Count
,Color Visualization
,Twilio SMS Notification
,Classification Label Visualization
,Google Vision OCR
,Label Visualization
,Time in Zone
,Reference Path Visualization
,Webhook Sink
,Google Gemini
,Roboflow Dataset Upload
,Line Counter Visualization
,Image Blur
,Florence-2 Model
,SIFT Comparison
,LMM For Classification
,Instance Segmentation Model
,Polygon Visualization
,Florence-2 Model
,Mask Visualization
,Ellipse Visualization
,Detections Stitch
,Bounding Box Visualization
,Dot Visualization
,Stability AI Image Generation
,Path Deviation
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
CSV Formatter
in version v1
has.
Bindings
Example JSON definition of step CSV Formatter
in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/csv_formatter@v1",
"columns_data": {
"predictions": "$steps.model.predictions",
"reference": "$inputs.reference_class_names"
},
"columns_operations": {
"predictions": [
{
"property_name": "class_name",
"type": "DetectionsPropertyExtract"
}
]
}
}