Choose objects, label boxes, and split scenes

Prepare labels that describe what you want a detector to find, and keep evaluation images separate.

Browser walkthrough·Beginner·About 15 min

Label a scene and choose a split

This image is 320 pixels wide and 200 pixels high. The block spans x = 40 to 110 and y = 50 to 120. Use the questions below to check its label and decide how to split a capture session.

An illustrative block and diskA block fills coordinates 40,50 to 110,120. A disk is centered at 220,100 with radius 25. There are two real objects. Dashed boxes show their full extents.blockdisk
Which YOLO label describes the block, class 0?

You recorded 100 neighboring frames in one session. Where should they go?

Requirements and learning goals

Before you start

  • A browser with JavaScript
  • No model, installation, or images required for this first lesson

You will be able to

  • Convert pixel boxes to YOLO labels
  • Distinguish training, validation, and test data
  • Recognize leakage between capture sessions

Define what counts as an object

A detector learns from images paired with class labels and . Before training, decide what the classes mean. In our supplied project, a block is a filled square and a disk is a filled circle. Both vary in position, size, and color. An empty scene has no target object and therefore an empty label file. Allow about 15 minutes for this browser lesson.

For your own project, choose two visually distinguishable objects, such as a washer and a bolt. Write a rule for partly visible objects and apply it consistently. Do not label a shadow as an object or silently leave a visible target unmarked. A missing label can teach the model that a real object is background.

Work through a box

The example image is 320 pixels wide and 200 pixels high. The block extends from (40, 50) to (110, 120), measured from the image's top-left corner. Its center is (75, 85) and its width and height are both 70 pixels.

A label stores class_id center_x center_y width height. Divide horizontal values by image width and vertical values by image height. The resulting label is 0 0.234375 0.425 0.21875 0.35. These coordinates describe the full box; they are not confidence scores. A class ID starts at zero and must match the class list used for training.

Checkpoint 1 of 2

Another box in the same 320-by-200 image is 80 pixels wide and 80 pixels high. What are its normalized width and height?

Commit to an answer. Every choice explains itself.

Keep different jobs separate

Training images update the model. Validation images help you choose the model, threshold, and other settings. Test images are reserved for a final assessment after those choices are fixed.

Neighboring frames from one recording often have almost the same object, background, and lighting. Keep the whole capture session in one split. Also group near-duplicate shots together. Renaming or resizing a file does not make it an independent test example.

Checkpoint 2 of 2

You try five confidence thresholds and keep the one that scores best on the test images. What is wrong with that?

Commit to an answer. Every choice explains itself.

Try it

  1. Calculate the block's center and normalized width before selecting its label in the lab.
  2. Answer the capture-session question. Explain why alternating neighboring frames between training and test is misleading.
  3. Work out the disk's box yourself. Its center is (220, 100) and its diameter is 50 pixels. Class 1 represents the disk.

Check the expected result

The block label is the one calculated above. The disk label is 1 0.6875 0.5 0.15625 0.25. Its width differs from its height after normalization because the image is not square.

You are done when you can explain why a model could score well on leaked test frames yet fail in a new room. The supplied training project generates separate images for each split, but they still share one simple rendering process. That is enough to practice the workflow, not to establish performance on real objects.

Troubleshooting

If the normalized center equals the top-left corner, calculate the midpoint before dividing. If a coordinate exceeds one, check that you used the right image dimension and did not mix pixels with normalized values. The following lesson supplies a runnable dataset and training script, so you do not need to gather photos before trying the workflow.

Reference: Ultralytics detection dataset format.

Can you do each of these?

  • Convert pixel boxes to YOLO labels
  • Distinguish training, validation, and test data
  • Recognize leakage between capture sessions

0 of 2 checkpoints solved. Try checkpoint 1

Teach a detector your own objects
All lessons in this topic
  1. 1. Choose objects, label boxes, and split scenes
  2. 2. Train a small detector on a supplied dataset
  3. 3. Measure mistakes on unseen scenes
  4. 4. Use your own objects and keep an honest final test

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.