got-10k数据预处理

本文详细介绍了got10k数据集的文件格式,包括groundtruth.txt、cover.label、absense.label、cut_by_image.label和meta_info.ini文件的作用。接着,讨论了如何使用shutil库在Python中移动got10k文件夹,以及如何裁剪数据集以获取图像对,并将数据集信息整理成JSON文件,以便于后续处理和分析。

got数据文件夹格式

  |-- GOT-10k/
     |-- train/
     |  |-- GOT-10k_Train_000001/
     |  |   ......
     |  |-- GOT-10k_Train_009335/
     |  |-- list.txt
     |-- val/
     |  |-- GOT-10k_Val_000001/
     |  |   ......
     |  |-- GOT-10k_Val_000180/
     |  |-- list.txt
     |-- test/
     |  |-- GOT-10k_Test_000001/
     |  |   ......
     |  |-- GOT-10k_Test_000180/
     |  |-- list.txt

数据标注描述

Each sequence folder contains 4 annotation files and 1 meta file. A brief description of these files follows (let N denotes sequence length):

  • groundtruth.txt – An N×4 matrix with each line representing object location [xmin, ymin, width, height] in one frame.
  • cover.label – An N×1 array representing object visible ratios, with levels ranging from 0~8.
  • absense.label – An binary N×1 array indicating whether an object is absent or present in each frame.
  • cut_by_image.label – An binary N×1 array indicating whether an object is cut by image in each frame.
  • meta_info.ini – Meta information about the sequence, including object and motion classes, video URL and more.

Values 0~8 in file cover.label correspond to ranges of object visible ratios: 0%, (0%, 15%], (15%~30%], (30%, 45%], (45%, 60%], (60%, 75%], (75%, 90%], (90%, 100%) and 100% respectively.

使用shutil移动got10k文件夹

# -*- coding: utf-8 -*- 
import shutil
import os 

dst = r'C:\Users\lpf\Desktop\dataset\Got10k\train'
dst1 = r'd:/Learning_Data/BasicCode/move_file/c'
path = []
def Test1(rootDir, path):
    list_dirs = os.walk(rootDir)
    for root, dirs, files in list_dirs:
        for d in dirs:
            if d[-3]=='_':
            # if d[-1]=='a':
                
                s=os.path.join(root, d)
                path.append(s)
                # shutil.move(d,dst1)
        # for f in files:
        #     print (os.path.join(root, f))
Test1(r"C:\Users\lpf\Desktop\dataset\Got10k", path)
def Test2(rootDir, path):
    list_dirs = os.walk(rootDir)
    for root, dirs, files in list_dirs:
        for d in dirs:
            # if d[-3]=='_':
            # # if d[-1]=='a':
                
            s=os.path.join(root, d)
            path.append(s)
# Test1(r'd:\Learning_Data\BasicCode\move_file')
# print(path[0])

# shutil.move(path[0],dst)
images_path = []
for images in path:
    Test2(images, images_path)
    # break
print(images_path[0])
print(len(images_path))
print(images_path[-1])
count = 0
# images_path
for i in images_path:
    shutil.move(i,dst)
    count += 1
    if count % 100 == 0:
        print("已完成移动{}个文件......".format(count))
print("finish")

裁剪数据集,获取图像对

from os.path import join, isdir, exists
from os import listdir, mkdir, makedirs
import cv2
import numpy as np
import glob
from concurrent import
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值