Transform the vot dataset into 4 corner format

Posted wangxiaocvpr

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Transform the vot dataset into 4 corner format相关的知识,希望对你有一定的参考价值。

Transform the vot dataset into 4 corner format

 

Matlab code to change the 8 value ground truth into 4 corner format: (x1, y1, width, height). 

 

clc;  close all;  clear all; 

path = /Tracking_Benchmark/VOT2018/;
videoFiles = dir(path); 
videoFiles = videoFiles(3:end); 

for i =1:size(videoFiles, 1)
    videoName = videoFiles(i).name; 
    disp(videoName); 
    
    gt_path = [path videoName /groundtruth.txt]; 
    gt = importdata(gt_path); 
    
    if size(gt, 2) >= 6
        x = gt(:,1:2:end);
        y = gt(:,2:2:end);
        gt = [min(x,[],2), min(y,[],2), max(x,[],2) - min(x,[],2), max(y,[],2) - min(y,[],2)];
    end
    
    imgFiles = dir([path videoName /color/*.jpg]);  
    firstFrame = imread([path videoName /color/ imgFiles(1).name]); 
    targetObject = imcrop(firstFrame, gt(1, :));
    
    imshow(targetObject);
    
    new_gt_path = [path videoName /groundtruth_new.txt]; 
    fid = fopen(new_gt_path, w) ; 
    
    
    for j =1:size(gt, 1)
        fprintf(fid, %s, num2str(gt(j, 1))); 
        fprintf(fid, %s, ,); 
        fprintf(fid, %s, num2str(gt(j, 2))); 
        fprintf(fid, %s, ,); 
        fprintf(fid, %s, num2str(gt(j, 3))); 
        fprintf(fid, %s, ,); 
        fprintf(fid, %s \n, num2str(gt(j, 4))); 
    end 
    
end 

 

以上是关于Transform the vot dataset into 4 corner format的主要内容,如果未能解决你的问题,请参考以下文章

PyTorch:数据读取1 - Datasets及数据集划分

如何使用Matplotlib从PyTorch保存图形?

1-The INRIA Holidays dataset 数据集

Experiments on the NYC dataset(updated 3rd,Aug)

(error) LOADING Redis is loading the dataset in memory

使用faster rcnn 跑vot2015的数据集