Safemotion Lib
Loading...
Searching...
No Matches
sensereid.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__ = ['SenseReID', ]
14
15
16@DATASET_REGISTRY.register()
18 dataset_dir = "SenseReID"
19 dataset_name = "senseid"
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 file_path_list = ['test_gallery', 'test_prob']
35
36 for file_path in file_path_list:
37 sub_file = os.path.join(train_path, file_path)
38 img_name = glob(os.path.join(sub_file, "*.jpg"))
39 for img_path in img_name:
40 img_name = img_path.split('/')[-1]
41 img_info = img_name.split('_')
42 pid = self.dataset_name + "_" + img_info[0]
43 camid = self.dataset_name + "_" + img_info[1].split('.')[0]
44 data.append([img_path, pid, camid])
45 return data
check_before_run(self, required_files)
Definition bases.py:113
__init__(self, root='datasets', **kwargs)
Definition sensereid.py:21