Computer vision answers · Manufacturing
How do I group detected parts into one larger object with computer vision?
So every part is counted against the right assembly.
Short answer
Train one detection model with Roboflow for free that finds both the larger object and its parts, then assign each part to the object whose box contains the part's center. You get each object with its own list of parts, ready to check or count. Label the larger object as its own class, so the model finds it directly instead of you guessing its outline from where the parts sit.
Skip the setup. Describe your images.
Describe your images and what you need to find. The agent sets up labeling, training and deployment with you.
Key facts
- What you need
- Images labeled with a class for the object and one for each part
- What you get
- Each object with its own list and count of parts
- Image sources
- Line cameras, phone photos and recorded video
- Runs on
- Cloud API, or an edge device or server running Docker

How to build part grouping, step by step
Six steps from labeled images to every object with its own list of parts.
Connect Roboflow to your coding agent, ChatGPT or Codex
Label the larger object and each part as separate classes
Train one detection model for the object and its parts
Assign each part to the object that contains it
Pythonimport supervision as sv from inference import get_model model = get_model("your-project/1") result = model.infer("line.jpg", confidence=0.4)[0] detections = sv.Detections.from_inference(result) boards = detections[detections.data["class_name"] == "board"] parts = detections[detections.data["class_name"] != "board"] centers = parts.get_anchors_coordinates(sv.Position.CENTER) for i, (x1, y1, x2, y2) in enumerate(boards.xyxy): inside = (centers[:, 0] >= x1) & (centers[:, 0] <= x2) & (centers[:, 1] >= y1) & (centers[:, 1] <= y2) print(f"board {i}:", parts.data["class_name"][inside].tolist()) # board 0: ['chip', 'chip', 'connector'] # board 1: ['chip', 'connector']Rather not write code? Ask the Roboflow agent to set this up for you
Build the grouping into a Workflow
Check each object against its expected parts
Why 2 million engineers build on Roboflow
Label faster
Auto-label with SAM 3 or your own model, then fix the misses instead of drawing every box.
RF-DETR
Roboflow’s open-source real-time detection model, built for accuracy (opens in a new tab) on small objects.
Logic built in
Counting, zones, tracking and alerts are ready-made Workflow blocks, so there is less code to write.
Your model, your weights
Use your trained weights on every plan, including free, through the open-source Inference package.
Run it anywhere
Self-host on a workstation, Docker, an on-prem GPU or an edge device, or call the cloud API.