Hand_dataset processing and labeling of open source datasets

  • Step 1: Click the link to download the hand_dataset open source dataset, as shown in the figure below:
    insert image description here
  • After the download is successful, get the hand_date.rar compressed package, decompress this compressed package, and its data content is shown in the figure below:
    insert image description hereSince the data labeling part of the open source dataset is developed in M ​​language, the developer here needs to download Matlab, the version of Matlab 2019b used in this article , About the download and installation of Matlab, you can download and install it yourself here.
  • Step 2: After the download is successful, open Matlab, as shown in the figure below:
    insert image description here
  • Step 3: Next, make the training data, enter Matlab and click the open button, enter the hand_dataset dataset, and select the corresponding training_dateset/displaydata.m file, as shown in the figure below:
    insert image description here
    insert image description here
  • Step 4: Use the marked data set and click the run button to display the original gesture frame. The result of imshow is shown in the figure below:
    insert image description here
    Since darknet only supports rectangular frames, rotation cannot exist. When there is a non-rectangular case, It needs to be converted, and the circumscribing rectangle is usually used as the hand frame , as shown in the following figure:
    insert image description here
  • Step 5: Download the following code, and decompress the hand_dataset_mcoding.rar inside, enter the hand_dataset_mcoding directory, and replace the downloaded /training_dataset/displaydata.m code with the original open source code. From the perspective of the vector, refit the hand frame and make it according to the data format accepted by darknet.
链接:https://pan.baidu.com/s/1qJfgRDNgeSDTVtrhEcHIYg  提取码:d7t9 
darknet标注信息的数据格式如下:
Class id    center_x    center_y    w    h
对数据格式解释如下:
Class id:表示标注框的类别,从0开始计算,当前只要手部1类检测物体,故Class id全为0;
center_x:表示归一化后的手部框中心点坐标的X值。归一化坐标 = 实际坐标 / 整个图片宽
center_y:表示归一化后的手部框中心点坐标的Y值。归一化坐标 = 实际坐标 / 整个图片高
w:表示归一化后的手部框的宽。归一化长度 = 实际长度 / 整个图片宽
h:表示归一化后的手部框的高。归一化长度 = 实际长度 /整个图片高
  • Step 6: Before running displaydata.m, you need to carefully check whether the code path matches the actual path. After the change is successful, after running this code, a log message will appear in the command line window, as shown in the figure below:
    insert image description here
  • Due to the large amount of data, you need to wait a few minutes for the conversion to complete.
  • After the conversion is complete, the marked txt format file can be generated in the created directory, as shown in the following figure:
    insert image description here
  • Step 7: Create a new JPEGImages folder under the same folder as labels, and copy the original .jpg to this file, as shown in the figure below: Make sure that the file name of the label file
    insert image description here
    corresponds to the image name in JPEGImages , and the amount of labeled data must be consistent with the original image, which needs to be checked carefully .
    insert image description here
  • After the generation is successful, click to open any annotation file, such as Poselet_159.txt, as shown in the figure below:
    insert image description here
  • Step 8: In the training_dataset directory, create a new list folder, and create a hand_train.txt file in it, which stores the global path of all images in the training JPEGImages, as shown in the following figure:
    insert image description here
  • Step 9: Enter the hand_dataset_mcoding directory, put the /training_dataset/listcode.m code in the same directory as displaydata.m, as shown in the following figure:
    insert image description here
  • Step 10: Analyze the listcode.m code, where the relative path needs to be modified according to the actual path, which can be modified by referring to the following figure:
    insert image description here
  • Step 11: Click the run button and wait for a while to complete the automatic conversion, as shown in the figure below:
    insert image description here
    At this point, the training set is created. Similarly, the conversion method of test_dataset and validation_dataset is the same as that of the training set. It will not be detailed here. The conversion code can refer to The .m file under the test_dataset folder and the .m file under the validation_dataset folder, as shown in the following figure:
    insert image description here
    insert image description here

Guess you like

Origin blog.csdn.net/Wu_GuiMing/article/details/123718854