Label Images for Classification Model Training



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:

  1. Interactively specify rectangular regions of interest (ROIs).


  1. Using the ROIs, you can detect objects of interest in target images with the vision.CascadeObjectDetector System object.


  2. 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.


Open the Training Image Labeler

  1. MATLAB® Toolstrip: Open the Apps tab, under Image Processing and Computer Vision, click the app icon.
    打开App工具栏,在Image Processing and Computer Vision子项目下,打开trainingImageLabeler程序。如下图所示:

  2. MATLAB command prompt: Enter trainingImageLabeler.

App Controls

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.
用户可以想Data Browser中添加图片,并且图片的数量没有限制。用户可以选择、移除和创建用户感兴趣区域(ROI),并且可以保存用户会话。当用户完成以上工作时,用户可以将ROI信息导出为XML文件。

Add Images

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.

Specify Regions of Interest

After you load 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 also use the following shortcuts:

  1. Control-C to copy
  2. Control-V to paste
  3. Control-X to cut

Remove, Rotate, and Sort Images

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.

New Session

When you start a new session, you can save the current session before clearing it.

Open Session

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.

Save 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.

Export ROIs

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.

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页