|On this page…|
The Training Image Labeler provides an easy way to label positive samples that the trainCascadeObjectDetector function uses to create a cascade classifier. Using this app, you can:
Interactively specify rectangular regions of interest (ROIs).
Using the ROIs, you can detect objects of interest in target images with the vision.CascadeObjectDetector System object.
You can load multiple images at one time, draw ROIs, and then export the ROI information in the appropriate format for the trainCascadeObjectDetector. The labeler app supports all image data formats that the trainCascadeObjectDetector function uses.
In the MATLAB® desktop, on the Apps tab, click the Training Image Labeler icon, . Or, at the command line, type:
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 have loaded images, you can delineate ROIs. You can switch between images and continue creating ROIs. Drag the cursor over the object in the image that you want to identify for an ROI. You can modify the size of an ROI by clicking either the corner or side grips. To copy and paste an ROI, left-click within it's 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-box, , in the upper-right corner.
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 name is 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 the Export ROIs button, the app exports the ROI information to the MATLAB workspace in a 1-by-M structure, where M represents the number of images. 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 are prompted to name the variable or to accept the default positiveInstances name. The first field, imageFileName, contains the full path and file name of the images. The app does not copy and resave images, so the stored path refers to the original image and folder that you loaded the images from. The second field, objectBoundingBoxes, contains the ROI [x, y, width, height] information.