Safemotion Lib
Loading...
Searching...
No Matches
smreid
fastreid
data
datasets
cuhk_sysu.py
Go to the documentation of this file.
1
# encoding: utf-8
2
"""
3
@author: xingyu liao
4
@contact: sherlockliao01@gmail.com
5
"""
6
7
import
glob
8
import
os.path
as
osp
9
import
re
10
import
warnings
11
12
from
.bases
import
ImageDataset
13
from
..datasets
import
DATASET_REGISTRY
14
15
16
@DATASET_REGISTRY.register()
17
class
cuhkSYSU
(
ImageDataset
):
18
r"""CUHK SYSU datasets.
19
20
The dataset is collected from two sources: street snap and movie.
21
In street snap, 12,490 images and 6,057 query persons were collected
22
with movable cameras across hundreds of scenes while 5,694 images and
23
2,375 query persons were selected from movies and TV dramas.
24
25
Dataset statistics:
26
- identities: xxx.
27
- images: 12936 (train).
28
"""
29
dataset_dir =
'cuhk_sysu'
30
dataset_name =
"cuhksysu"
31
32
def
__init__
(self, root='datasets', **kwargs):
33
self.
root
= root
34
self.
dataset_dir
dataset_dir
= osp.join(self.
root
, self.
dataset_dir
dataset_dir
)
35
36
self.
data_dir
= osp.join(self.
dataset_dir
dataset_dir
,
"cropped_images"
)
37
38
required_files = [self.
data_dir
]
39
self.
check_before_run
(required_files)
40
41
train = self.
process_dir
(self.
data_dir
)
42
query = []
43
gallery = []
44
45
super(cuhkSYSU, self).
__init__
(train, query, gallery, **kwargs)
46
47
def
process_dir
(self, dir_path):
48
img_paths = glob.glob(osp.join(dir_path,
'*.jpg'
))
49
pattern = re.compile(
r'p([-\d]+)_s(\d)'
)
50
51
data = []
52
for
img_path
in
img_paths:
53
pid, _ = map(int, pattern.search(img_path).groups())
54
pid = self.
dataset_name
+
"_"
+ str(pid)
55
camid = self.
dataset_name
+
"_0"
56
data.append((img_path, pid, camid))
57
58
return
data
fastreid.data.datasets.bases.Dataset.check_before_run
check_before_run(self, required_files)
Definition
bases.py:113
fastreid.data.datasets.bases.ImageDataset
Definition
bases.py:126
fastreid.data.datasets.cuhk_sysu.cuhkSYSU
Definition
cuhk_sysu.py:17
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.__init__
__init__(self, root='datasets', **kwargs)
Definition
cuhk_sysu.py:32
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.dataset_dir
str dataset_dir
Definition
cuhk_sysu.py:29
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.dataset_dir
dataset_dir
Definition
cuhk_sysu.py:34
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.root
root
Definition
cuhk_sysu.py:33
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.process_dir
process_dir(self, dir_path)
Definition
cuhk_sysu.py:47
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.data_dir
data_dir
Definition
cuhk_sysu.py:36
fastreid.data.datasets.cuhk_sysu.cuhkSYSU.dataset_name
str dataset_name
Definition
cuhk_sysu.py:30
Generated by
1.10.0