Safemotion Lib
Loading...
Searching...
No Matches
viper.py
Go to the documentation of this file.
1# encoding: utf-8
2"""
3@author: xingyu liao
4@contact: sherlockliao01@gmail.com
5"""
6
7import os
8from glob import glob
9
10from fastreid.data.datasets import DATASET_REGISTRY
11from fastreid.data.datasets.bases import ImageDataset
12
13__all__ = ['VIPeR', ]
14
15
16@DATASET_REGISTRY.register()
18 dataset_dir = "VIPeR"
19 dataset_name = "viper"
20
21 def __init__(self, root='datasets', **kwargs):
22 self.root = root
23 self.train_path = os.path.join(self.root, self.dataset_dir)
24
25 required_files = [self.train_path]
26 self.check_before_run(required_files)
27
28 train = self.process_train(self.train_path)
29
30 super().__init__(train, [], [], **kwargs)
31
32 def process_train(self, train_path):
33 data = []
34
35 file_path_list = ['cam_a', 'cam_b']
36
37 for file_path in file_path_list:
38 camid = self.dataset_name + "_" + file_path
39 img_list = glob(os.path.join(train_path, file_path, "*.bmp"))
40 for img_path in img_list:
41 img_name = img_path.split('/')[-1]
42 pid = self.dataset_name + "_" + img_name.split('_')[0]
43 data.append([img_path, pid, camid])
44
45 return data
check_before_run(self, required_files)
Definition bases.py:113
process_train(self, train_path)
Definition viper.py:32
__init__(self, root='datasets', **kwargs)
Definition viper.py:21