---
title: "Box Orientation"
description: "Why the green bottom edge of every box must lie on the same side of the part, what a wrong angle does in training and on the robot, and how LumiScan Annotation Web helps to keep it right."
product: "LumiScan Annotation Web"
component: "lumiscan-annotation-web"
version: "2.4.1"
display_version: "2.4.1.2"
latest_version: true
language: "en"
url: "https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/box-orientation.html"
---

# Box Orientation – LumiScan Annotation Web

An oriented box says not only *where* a part is but also *which way it points*. The green bottom edge sets the direction, and the angle of the box follows from it (see [Center lines and the bottom edge](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/annotating-images.html#center-lines-and-bottom-edge)). For most parts that angle is the part’s real rotation: LumiScan Training learns it from your boxes, and an application such as LumiScan VGR uses it to turn the part the right way before placing it. The angle is only as right as the green edge, so the rule of this page is short:

> [!IMPORTANT]
> For each label, decide which side of the part is its bottom, and put the green bottom edge on exactly that side in every box, whatever way the part lies in the image.

[Video](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/videos/box-orientation.mp4)

## Parts with a unique orientation

The bracket in the images on this page looks different in every rotation: the chamfered corner, the large hole, the slot and the foot with its small hole line up only one way. Such a part has exactly one correct angle between −180° and 180°.

![The same bracket four times, turned by 0°, 90°, 180° and −90°: the chamfered corner, the large hole and the foot with the small hole are in a different place each time](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/orientation/orientation-rotations.jpg)

Most industrial parts are like this, even if the difference is small: one hole off-centre, a notch, a printed mark. Annotate them all with an orientation. Only parts that truly look the same in every rotation are an exception, see [Parts without an orientation](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/box-orientation.html#parts-without-orientation).

## One rule per label

Choose the bottom side by a feature that is easy to see in every image, also when the part is tilted, half in shadow or partly covered. For the bracket, the rule is: **the bottom edge lies along the foot**. Then every box of the label has its green edge along the foot, and the angle of each box is the bracket’s rotation, across the whole range from −180° to 180°:

![Five brackets at different rotations, each with a box whose green bottom edge lies along the foot; their angles are 18°, 147°, −64°, −128° and 96°](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/orientation/orientation-consistent.jpg)

- Write the rule down with an example image, where every annotator sees it, before the first image is annotated. Changing it later means checking every box already drawn.
- Use a feature of the part, never the image: "bottom edge at the bottom of the image" gives an angle near 0° for every part, whatever its real rotation.
- If two labels look alike (a part and its mirror-image counterpart, for example), give each its own rule, based on the feature that tells them apart.

## What goes wrong when the edge is on another side

The outline of a box can be perfect while its direction is wrong. Two typical mistakes, marked as the review marks them:

![The same five brackets; two boxes are marked: 1 has its green edge on the side opposite the foot (−33° instead of 147°), 2 has it on a neighbouring side (−38° instead of −128°)](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/orientation/orientation-inconsistent.jpg)

|   |   |
| --- | --- |
| 1: opposite side | The outline fits, but the angle is off by 180°. This is the most common mistake: the box looks correct at first glance. |
| 2: neighbouring side | The outline fits too, but the angle is off by 90°, and width and height are swapped. |

In both cases only the green edge shows the mistake.

[Video](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/videos/box-orientation-why.mp4)

### In training

The network learns the angle from the examples it is given. If the same bracket, lying the same way, is labelled 147° in one image and −33° in the next, the examples contradict each other. The network cannot learn which way the bracket points, only roughly where its long side is: its angle predictions become uncertain and often come out turned by 180°, and with 90° mistakes width and height get mixed up as well. A few such boxes already do noticeable harm, because each one teaches the opposite of all the correct boxes.

Wrong boxes in the validation or test share also falsify the results of the training: a correct prediction is counted as an error, and the network looks worse or better than it is.

### On the robot

A robot typically grips the part at the centre of the box and turns it by the angle so that it arrives in the fixture the right way round. The centre of a box with the wrong bottom edge is still right, so the part is picked up without any problem. The mistake only shows when it is put down:

![Top: box at 18° with the green edge along the foot; turned by −18°, the bracket fits its fixture (green outline, tick). Bottom: the same bracket with a box at −162°; turned by 162°, it arrives upside down and does not fit (red outline, cross)](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_images/orientation/orientation-consequence.jpg)

An angle off by 180° places the part the wrong way round: it does not fit, sits on its fixture askew, or is assembled the wrong way, and that is often noticed only later in the line.

## Keeping the orientation right

- **Look at the green edge** before you save. If it is on the wrong side, do not draw the box again: `R` makes the next side clockwise the bottom edge, `Shift+R` the next side counter-clockwise; `R` twice moves it to the opposite side. The outline stays where it is (see [Center lines and the bottom edge](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/annotating-images.html#center-lines-and-bottom-edge)).
- **Draw from the bottom**: with the [center-line rectangle](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/annotating-images.html#center-line-rectangle), click the bottom of the part first; with the [edge rectangle](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/annotating-images.html#edge-rectangle), click the two ends of the bottom edge first and then move the mouse towards the top. The direction then comes out right without turning.
- **Templates** remember the orientation of the box they were made from. Make the template with the bottom edge on the correct side, and turn a placed template box to match the part (see [Box templates](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/copying-boxes-and-templates.html#box-templates)). The same applies to boxes copied from the previous image.
- **Box suggestions** can have the bottom edge on any side, especially those of the detector. Check the green edge of every suggestion before you accept it (see [Box suggestions](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/box-suggestions.html)).
- **Two annotators per image**: the [review](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/several-annotators-per-image.html) marks boxes whose angles differ by more than 135° as *bottom edge on the other side*. Such a difference never comes from imprecise drawing, so it is worth agreeing on the rule again with both annotators.

The angle is stored in the annotation file as `angleRad`, measured from the green bottom edge (see [Annotation files](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/annotation-files.html)).

## Parts without an orientation {#parts-without-orientation}

Some parts look exactly the same in every rotation, for example a round washer or a ball. For them, the angle of the box means nothing, and any angle is as good as another. Mark such labels as **Labels without orientation** when you [export the annotations](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/export-for-lumiscan-training.html) (`nonRotables` in LumiScan Training): the training then ignores their angle.

Use this only for parts that really have no front and back. A part that only looks *almost* symmetric, such as a bracket whose only difference is a small hole, still has an orientation, and the robot needs it: annotate it with a rule, as described above.

## Try it with the sample images {#sample-images}

Two downloads with the same 24 images of brackets and washers (synthetic camera images, 1280 × 960 pixels, grayscale), free to use for testing and training:

|   |   |
| --- | --- |
| [Sample project](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_attachments/lumiscan-annotation-web-sample-brackets.lumiscan-project.tar) (14 MB) | The images **with** their reference annotations, as a project file to load on your server: **Projects** → **Import project** (see [Exporting and importing](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/projects.html#exporting-and-importing)). The project *Sample – oriented brackets* has the labels `bracket` and `washer`; `washer` is already a label without orientation for the [export](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/export-for-lumiscan-training.html). |
| [Sample images](https://docs.hdvisionsystems.com/en/lumiscan-annotation-web/_attachments/lumiscan-annotation-web-sample-brackets.zip) (14 MB) | The images **without** annotations, to annotate yourself (`images/`), the reference annotations as CSV files of the desktop tool (`reference/`) and a short guide (`README.txt`). |

Annotate the images of the ZIP with the rule of this page, the green bottom edge along the foot, and compare your boxes with the sample project: the angles should agree within a few degrees, never by 180°.
