Join and Split Agents
The SplitAgent
and the JoinAgent
are both initialized with no arguments:
SplitAgent()
JoinAgent()
Overview
The SplitAgent
is used in conjunction with the JoinAgent
. The SplitAgent
creates multiple crops of an image, and the JoinAgent
consolidates the results.
Letโs take a look at a Workflow:
workflow = Workflow([
BoundingBoxSelectAgent(classes=["person"]),
SplitAgent(),
InstructorImageAgent(response_model=PPE),
ToClassificationAgent(fn=lambda x: "has ppe" if x.hardhat else "no ppe"),
JoinAgent(),
])
Split Agent
After identifying the bounding boxes around each โpersonโ, the SplitAgent
separates the detected individuals into its own branches so that subsequent processing can be applied to each person detection individually.
The result after bounding box detection
Each person is split into its own processing branch
Join Agent
After each person detection in the image has been individually assessed and classified, the JoinAgent
reassembles the individual results back into a single output. The InstructorImageAgent
and ToClassificationAgent
steps in the workflow act on each person detection individually after the split.
The final merge gathers a comprehensive output that reflects the PPE status of all detected persons in the original image, combining the results into a single image.
The result of classifying each person detection
The final joined output