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:
Byte Tracker
,Distance Measurement
,Time in Zone
,Dot Visualization
,Perspective Correction
,Delta Filter
,Blur Visualization
,Clip Comparison
,OpenAI
,Keypoint Detection Model
,EasyOCR
,Stability AI Outpainting
,VLM as Classifier
,Twilio SMS Notification
,Continue If
,Google Vision OCR
,Roboflow Dataset Upload
,Email Notification
,Instance Segmentation Model
,Image Convert Grayscale
,Detections Stabilizer
,Bounding Box Visualization
,Llama 3.2 Vision
,Rate Limiter
,Reference Path Visualization
,Image Preprocessing
,Local File Sink
,First Non Empty Or Default
,OpenAI
,Image Slicer
,Cosine Similarity
,Detections Stitch
,SIFT Comparison
,Dominant Color
,Velocity
,Object Detection Model
,Buffer
,Stability AI Image Generation
,SmolVLM2
,Dimension Collapse
,Cache Get
,Roboflow Custom Metadata
,SIFT Comparison
,Model Comparison Visualization
,Dynamic Zone
,Line Counter
,Time in Zone
,QR Code Detection
,Relative Static Crop
,Polygon Visualization
,Slack Notification
,JSON Parser
,Triangle Visualization
,YOLO-World Model
,Single-Label Classification Model
,Detections Classes Replacement
,Data Aggregator
,Bounding Rectangle
,Circle Visualization
,Label Visualization
,Google Gemini
,VLM as Detector
,Multi-Label Classification Model
,Detections Merge
,Path Deviation
,CSV Formatter
,Detections Consensus
,Moondream2
,Segment Anything 2 Model
,Expression
,LMM For Classification
,Polygon Zone Visualization
,VLM as Classifier
,Identify Outliers
,Morphological Transformation
,Size Measurement
,Corner Visualization
,LMM
,Pixel Color Count
,Florence-2 Model
,PTZ Tracking (ONVIF)
.md),Grid Visualization
,Image Threshold
,Florence-2 Model
,Halo Visualization
,Multi-Label Classification Model
,CogVLM
,Detection Offset
,Detections Combine
,Byte Tracker
,Line Counter Visualization
,Perception Encoder Embedding Model
,Stitch OCR Detections
,VLM as Detector
,CLIP Embedding Model
,Keypoint Detection Model
,Identify Changes
,Camera Focus
,SIFT
,Clip Comparison
,Image Slicer
,Keypoint Visualization
,Template Matching
,OCR Model
,Line Counter
,Instance Segmentation Model
,Dynamic Crop
,Roboflow Dataset Upload
,Mask Visualization
,Qwen2.5-VL
,Background Color Visualization
,Webhook Sink
,Camera Calibration
,Depth Estimation
,QR Code Generator
,Property Definition
,Time in Zone
,Trace Visualization
,Detections Transformation
,Contrast Equalization
,Byte Tracker
,Cache Set
,Crop Visualization
,Overlap Filter
,Object Detection Model
,Pixelate Visualization
,Model Monitoring Inference Aggregator
,Gaze Detection
,Anthropic Claude
,Barcode Detection
,Image Contours
,OpenAI
,Path Deviation
,Detections Filter
,Classification Label Visualization
,Image Blur
,Absolute Static Crop
,Stability AI Inpainting
,Icon Visualization
,Ellipse Visualization
,Color Visualization
,Environment Secrets Store
,Single-Label Classification Model
,Stitch Images
- outputs:
Distance Measurement
,Time in Zone
,Polygon Zone Visualization
,LMM For Classification
,Dot Visualization
,Morphological Transformation
,Size Measurement
,Perspective Correction
,Corner Visualization
,LMM
,Pixel Color Count
,Florence-2 Model
,PTZ Tracking (ONVIF)
.md),Image Threshold
,Florence-2 Model
,Halo Visualization
,OpenAI
,CogVLM
,Line Counter Visualization
,Perception Encoder Embedding Model
,Stitch OCR Detections
,Stability AI Outpainting
,Twilio SMS Notification
,CLIP Embedding Model
,Google Vision OCR
,Roboflow Dataset Upload
,Email Notification
,Instance Segmentation Model
,Clip Comparison
,Keypoint Visualization
,Llama 3.2 Vision
,Bounding Box Visualization
,Line Counter
,Instance Segmentation Model
,Reference Path Visualization
,Dynamic Crop
,Roboflow Dataset Upload
,Mask Visualization
,Image Preprocessing
,Background Color Visualization
,Local File Sink
,Webhook Sink
,OpenAI
,QR Code Generator
,Detections Stitch
,Trace Visualization
,Time in Zone
,Contrast Equalization
,Cache Set
,Crop Visualization
,Stability AI Image Generation
,SIFT Comparison
,Roboflow Custom Metadata
,Cache Get
,Model Comparison Visualization
,Model Monitoring Inference Aggregator
,Line Counter
,Anthropic Claude
,Time in Zone
,Polygon Visualization
,Slack Notification
,OpenAI
,Path Deviation
,Triangle Visualization
,YOLO-World Model
,Classification Label Visualization
,Detections Classes Replacement
,Circle Visualization
,Image Blur
,Label Visualization
,Google Gemini
,Stability AI Inpainting
,Icon Visualization
,Ellipse Visualization
,Color Visualization
,Path Deviation
,Moondream2
,Segment Anything 2 Model
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"
}
]
}
}