Visual data preparation

For data visualization tasks in preparation for recording:

1. Get the picture data from the video

  1. First, a specified length of the clip (2-3s) is effective fragment from video editing tools can be used directly (recommended fast clip)

  1. The video clip into frames picture.

    • Right-view video clips of the first 属性, then turn 详细信息to see 帧速率, this rate is an important parameter is the late-generated image.

    • Tools can be used ffmpegto generate images, can also be written directly script to complete the work. Here the use of the recording ffmpegoperation of the process:

      Installation and configuration environment, see: https://blog.csdn.net/weixin_33895016/article/details/93944142

      Use: video files into the directory, shift + 右键where open Powershell, enter the command:

      -i ffmpeg " video.mp4 " -r 1 -q: v 2 -f image2 vid_% d.jpg
       # ffmpeg -i video frames per second -r -q: v picture quality parameters -f picture naming format
  1. [Optional] rename the file. Needs to be generated above the file name changed to 000x.jpg, 00xx.jpg, 0xxx.jpgthe form, you can use the following script:

    def rename(file_path):
        """
        It will give the image files in a given directory rename (0000.jpg format)
        :param file_path:
        :return:
        "" " 
        # First of all the images obtained (List) 
        Images = []
         # Key X = the lambda: int (X [: -. 4]): '.' Backwards fourth number of the dividing line, in accordance with the left '.' numbers in ascending order (note logic here is written according to step 2 of vid_% d.jpg named above) 
        for F in the sorted (the os.listdir (the os.path.join (file_path)), Key = the lambda the X-: int (the X-[4: -4])):   # list obtained is out of order, remember what row sequence 
            sub_path = os.path.join (file_path, f)
             IF os.path.isfile (sub_path):
                images.append(sub_path)
        print(images)
        # 重新命名
        count = 0
        for img in images:
            if count < 10:
                os.rename(img, os.path.join(file_path, '000' + str(count) + ".jpg"))
            elif count < 100:
                os.rename(img, os.path.join(file_path, '00' + str(count) + ".jpg"))
            elif count < 1000:
                os.rename(img, os.path.join(file_path, '0' + str(count) + ".jpg"))
            count += 1
        print("rename completed!")

2. direct access to picture data

It's really nothing.

3. Photo Tagger

Here the main record windowslabel at target detection data denoted format Pascal VOCformat. Similarly the rest of the system.

  1. Must first select a data annotation tool, it recommended labelme. Not recommended online command-line installation, you can go here to download [extraction code: ldxp], there will be unpacked a datafolder and a labeme.exeprogram.

    [Optional] datafolder contains a txtfile, after which the object is used to configure the marked categories, you can pop category options when labeling without manual input. For example there are a,b,c,d,efive categories, txtthe following documents:

  1. Direct open label labelme.execan be. Click on the left sidebar open Dirto open the file that contains the data to import picture data, click Create RectBoxor use the shortcut wto create a new callout box, finished ctrl+ssaved as xmla file.

 

Reference: https://blog.csdn.net/weixin_33895016/article/details/93944142

 

Guess you like

Origin www.cnblogs.com/zishu/p/12596016.html