Working and Annotating in CVAT
This page assumes you have already uploaded data to CVAT and have created a project
A physical mouse is recommended for annotating in CVAT.
There is no known way to operate the annotation interface with a keyboard alone and trackpads have been found to be inefficient and difficult to use with the interface.
The Annotation Interface
Navigation Bar & Menu
The navigation panel and drop-down menu, allow you to switch between frames, change the annotation mode, save your work, and more.
The CVAT interface arranges the different images in a dataset as different “frames
” with each frame
corresponding to a single image.
You will need to annotate each frame
individually.
For a more detailed explanation of the navigation bar and menu, see the official CVAT documentation
Controls Sidebar
Offers tools for navigating within the image, annotation tools, and additional options to merge, split, and group labels.
Note that some options are hidden in the controls sidebar and can be accessed using the bottom button (.....
)
The primary tools that you’ll be using in the controls sidebar are the Polygon tool (⬠)
and the AI tools (🪄)
.
For a more detailed explanation of the controls sidebar, see the official CVAT documentation.
Objects Sidebar
Displays annotated objects and includes a label filter, lists of objects (current frame) and labels (objects on the frame), and appearance settings.
The primary thing that we are concerned with are objects and their labels.
For a more detailed explanation of the objects sidebar, see the official CVAT documentation.
Workspace
The main annotation area where images and videos are displayed for annotation.
Some workspace settings can also be found in the general account settings. See the Settings section in CVAT Basics .
For a more detailed explanation of the workspace, see the official CVAT documentation.
Labels
In order to properly annotate, you must ensure that you have the correct labels set up. These labels differ from dataset to dataset and are stored in the label_colors.txt file within dataset’s zip file. When you create a project, the labels are automatically read in from the file.
In our case, we typically have two labels: background
, and <species name>
The <species name>
label is what we will use to identify and annotate the particular cover crop species present in an image.
If there are multiple cover crop species present in a single image, each should have its own label titled <species name>
. For example, if both hairy vetch and winter pea are both present in a single image there should be two different labels, once called hairy_vetch
and another called winter_pea
.
The background
label is automatically created by preprocessing and it represents everything that is not our plant of interest.
<species name>
label. In this case, winter_pea
background
labelDealing with the Background class
For each frame, you’ll need to deal with the label class background
that is created by default.
We are only concerned with labeling the plants in the image and therefore do not need the “background
” label. Hence you will need to delete the extraneous label.
There are two methods of removing objects: using the objects sidebar and using keyboard shortcuts.
Using the Objects sidebar
In the objects sidebar, identify the objects labeled
background
. There may be multiple objects with the same label. You will need to remove each object labeledbackground
.Click the icon of
three vertical dots (⋮)
next to the object’s label.Click on
Remove
in the dropdown that appears.Repeat for each object labeled
background
If you accidentally remove an object that you intended to keep, click the
Undo (↶
) icon in theNavigation bar
.Similarly, if you accidentally undid something that you did not intend to, click the
Redo (↷)
icon in theNavigation bar
.
There is a limit to the number of successive actions that you can undo (↶)
or redo (↷)
using the Navigation bar
and keyboard shortcuts.
background
⋮
iconRemove
background
class object is now deleted. Repeat for each object labeled background
. Using Keyboard Shortcuts
In the
Workspace
hover over the image until you seeBACKGROUND
appear by the upper right corner of the image. This should also highlight the outline of the object.Hit the
Delete (Del or ⌦)
key on your keyboard. Note that theDelete (Del)
key is different from theBackspace (⟵ or ⌫)
key and the shortcut will not work if you use the wrong key.Repeat for each object labeled
BACKGROUND
.If you accidentally remove an object that you intended to keep, press the
Ctrl
andZ
(Ctrl
+Z
) keys simultaneously toundo (↶)
the previous action.Similarly, if you accidentally undid something that you did not intend to, press the
Ctrl
andY
(Ctrl
+Y
) keys simultaneously toredo (↷)
the previous action.
There is a limit to the number of successive actions that you can undo (↶)
or redo (↷)
using the Navigation bar
and keyboard shortcuts.
BACKGROUND
Delete (Del or ⌦)
on your keyboardbackground
class object is now deleted. Repeat for each object labeled background
.Annotating
To annotate an image for Ag Image Repository, you will be creating and modifying polygons that outline the target plants that are visible in the image.
Preprocessing identifies and labels large, easily distinguishable sections of plant in the image but often misses small parts, stems, edges, and gaps.
The purpose of manually annotating the images is to outline and label those parts that are missing as well as modify existing polygons to account for gaps between plants and incorrectly generated edges.
Using the Polygon Tool
Creating a Polygon
Select the
Polygon (⬠)
tool on thecontrols sidebar
and choose the<species name>
label.Click
Shape
to enter drawing mode.
There are two ways to draw a polygon: either create points by clicking
or by dragging
the mouse on the screen while holding Shift
.
Clicking points
Left-click
to create a pointContinue to
left click
while following the outline of the plant. This will create a polygon that matches the shape of the plant.You can
right click
the previously created point to delete it.You can
zoom
in and out on the image by scrolling the mouse wheel
Shift Drag
While holding
Shift (🡅)
on your keyboard you can drag your mouse along the outline of the plant to create a polygon following the path of your cursor.
Finishing your Polygon
It is okay for your polygon to overlap with another.
Once you have finished outlining your shape, complete your polygon by clicking
Done (✔)
in thenavigation bar
or by pressing theN
key on your keyboardTo check your work, select the checkbox next to
Show bitmap
at the bottom of theobjects sidebar
Adjusting a Polygon
You can reactivate the
polygon tool (⬠)
by pressing theN
key on your keyboardTo edit a polygon, click on its center while holding
Shift
. This will open the polygon editor. Note: Clicking on the edge of the Polygon will not workIn the editor you can create new points or delete part of a polygon by closing the line on another point.
You can move the points by right-clicking and dragging the point to a new location.
To finish editing a polygon click
Done (✔)
in thenavigation bar
or by press theN
key on your keyboardTo cancel editing, press the
Escape (Esc)
key on your keyboard
Using the Segment Anything Model (SAM)
The Segment Anything Model (SAM) uses masks to identify objects in an image. We use it for creating semi-automated annotations.
In the controls sidebar select the magic wand icon to open
AI Tools (🪄)
.Select the
<species name>
label in the dropdownIn the Interactors dropdown select
<Segment Anything 2.0>
Toggle the
Convert masks to polygons
onClick
Interact
Click on the plant in the image to add it to the mask.
Use the
left click
to add parts to the mask and theright click
to remove parts from the mask.Once you have selected your mask, finish by clicking
Done (✔)
in thenavigation bar
or by pressing theN
key on your keyboard
More points improve outline accuracy, but make shape editing harder. Fewer points make shape editing easier, but reduce outline accuracy.
Cutting Holes in Polygons
To remove areas from a polygon, use the Slice mask/polygon tool
which looks like a pentagon with a diagonal line through it and is located in the hidden section of the controls sidebar (.....)
Click the bottom icon of the controls sidebar
(.....)
Click the icon of a bisected pentagon to open the tool
Click on the polygon you want to cut
Click the edge of the polygon you’re cutting
Outline the area you want to cut by using left click to add points or right click to remove points from your outline
When you are done,
left click
just outside of the image where you want the cut to endThe new polygon will be the same as your previous but will exclude the area you just cut out
You may now delete the previous polygon that does not include the cut-out
Saving your work
To save your progress, click the Save (🖫)
icon in the Navigation Bar
or press the Ctrl
and S
( Ctrl
+ S
) keys simultaneously.
Be sure to save your work often!
Save (🖫)
iconCtrl
+ S
on your keyboard at the same time