The Training Image Labeler provides an easy way to label objects in images. Using this app, you can:
Interactively specify rectangular regions of interest (ROIs) for multiple categories of objects.
Export ROIs for training or evaluating an object detector.
Train an object detector using the
MATLAB® Toolstrip: Open the Apps tab, under Image Processing and Computer Vision, click the app icon.
MATLAB command prompt: Enter
You can add an unlimited number of images to the Data Browser. You can then select, remove, and create ROIs, and save your session. When you are done, you can export the ROI information to an XML file.
Use the Add Images icon to select and add images to the Data Browser. You can add more images at any time during your editing session. The source images remain in the folder where they were originally located. The app does not make copies of the original images or move them. If you rotate the images in the Data Browser, the app overwrites the images in their original location with the modified orientation.
The app provides a list of image thumbnails that you loaded for the session. Next to each thumbnail, you see the file name and number of ROIs created in that image.
After you load images, you can delineate ROIs. You can switch between images and continue creating ROIs. The app allows you to create ROI Labels for multiple object categories. Each ROI label has a name and a color. First create the labels and then draw the ROIs in images.
Click the Add ROI label for each object category.
Name each ROI label and select its color.
Select the category from the ROI labels list you created.
Draw an ROI by dragging the cursor over the object in the image.
To modify the size of an ROI, click either the corner or side grips. To keep the aspect ratio of the ROI while changing its size, hold Shift.
To copy and paste an ROI, click within its border to select it. You can select one or more ROIs to move or to copy and paste.
To delete an ROI, click the red x in its upper-right corner.
If the object of interest fills the entire image, right-click the image and select Add full image ROI from the menu.
To show or hide the label names in the currently displayed image, select Show ROI Labels.
You can also use the following common shortcuts:
Ctrl+C to copy
Ctrl+V to paste
Ctrl+X to cut
You can remove, rotate, or sort the images. Right-click any image to access these options. To select multiple images, press Ctrl+click. To select consecutive images, press Shift+click. To sort images by the number of ROIs, from least amount of ROIs contained in each image, right-click any image and select Sort list by number of ROIs.
When you start a new session, you can save the current session before clearing it.
You can open a new session to replace or add to the current session. The app loads the selected MAT session file. To replace your current session, from the Open Session options, select Open an existing session. To combine multiple sessions, select Add session to the current session.
You can name and save your session to a .MAT file. The default
LabelingSession. The saved session file
contains all the required information to reload the session in the
state that you saved it. It contains the paths to the original images,
the coordinates for the ROI bounding boxes for each image, file names,
and logical information to record the state of the files.
When you click Export ROIs, the app exports the ROI information to the MATLAB workspace as an M-by-N table containing the image file names and the ROIs. The image file names are stored in the first column of the table. The subsequent columns contain the ROIs for each category.
If you only have one
ROI label, the app gives you the additional option to export the ROIs
struct array. The structure contains two
fields. One field stores the image file location and the other field
stores the corresponding ROI information for each image.
You can import ROIs created using another labeling method. The ROIs must be stored in a table using the same format as the ROIs exported by the app. The table can be a variable in the MATLAB workspace, or it can be saved as a MAT file.