Merge pull request #417 from layumi/master

Add one new dataset University-1652
pull/430/head
Kaiyang 2021-02-14 11:17:33 +08:00 committed by GitHub
commit 6e498f8b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 111 additions and 2 deletions

View File

@ -33,6 +33,7 @@ You can find some research projects that are built on top of Torchreid `here <ht
What's new What's new
------------ ------------
- [Feb 2021] We support the new multi-view multi-source geo-localization dataset `University-1652 <https://dl.acm.org/doi/abs/10.1145/3394171.3413896>`_.
- [Feb 2021] ``v1.3.5``: Now the `cython code <https://github.com/KaiyangZhou/deep-person-reid/pull/412>`_ works on Windows (credit to `lablabla <https://github.com/lablabla>`_). - [Feb 2021] ``v1.3.5``: Now the `cython code <https://github.com/KaiyangZhou/deep-person-reid/pull/412>`_ works on Windows (credit to `lablabla <https://github.com/lablabla>`_).
- [Jan 2021] Our recent work, `MixStyle <https://openreview.net/forum?id=6xHJ37MVxxp>`_ (mixing instance-level feature statistics of samples of different domains for improving domain generalization), has been accepted to ICLR'21. The code has been released at https://github.com/KaiyangZhou/mixstyle-release where the person re-ID part is based on Torchreid. - [Jan 2021] Our recent work, `MixStyle <https://openreview.net/forum?id=6xHJ37MVxxp>`_ (mixing instance-level feature statistics of samples of different domains for improving domain generalization), has been accepted to ICLR'21. The code has been released at https://github.com/KaiyangZhou/mixstyle-release where the person re-ID part is based on Torchreid.
- [Jan 2021] A new evaluation metric called `mean Inverse Negative Penalty (mINP)` for person re-ID has been introduced in `Deep Learning for Person Re-identification: A Survey and Outlook (TPAMI 2021) <https://arxiv.org/abs/2001.04193>`_. Their code can be accessed at `<https://github.com/mangye16/ReID-Survey>`_. - [Jan 2021] A new evaluation metric called `mean Inverse Negative Penalty (mINP)` for person re-ID has been introduced in `Deep Learning for Person Re-identification: A Survey and Outlook (TPAMI 2021) <https://arxiv.org/abs/2001.04193>`_. Their code can be accessed at `<https://github.com/mangye16/ReID-Survey>`_.
@ -230,6 +231,10 @@ Image-reid datasets
- `QMUL-iLIDS <http://www.eecs.qmul.ac.uk/~sgg/papers/ZhengGongXiang_BMVC09.pdf>`_ - `QMUL-iLIDS <http://www.eecs.qmul.ac.uk/~sgg/papers/ZhengGongXiang_BMVC09.pdf>`_
- `PRID <https://pdfs.semanticscholar.org/4c1b/f0592be3e535faf256c95e27982db9b3d3d3.pdf>`_ - `PRID <https://pdfs.semanticscholar.org/4c1b/f0592be3e535faf256c95e27982db9b3d3d3.pdf>`_
Geo-localization datasets
^^^^^^^^^^^^^^^^^^^^^^^
- `University-1652 <https://dl.acm.org/doi/abs/10.1145/3394171.3413896>`_
Video-reid datasets Video-reid datasets
^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
- `MARS <http://www.liangzheng.org/1320.pdf>`_ - `MARS <http://www.liangzheng.org/1320.pdf>`_

View File

@ -2,7 +2,7 @@ from __future__ import print_function, absolute_import
from .image import ( from .image import (
GRID, PRID, CUHK01, CUHK02, CUHK03, MSMT17, VIPeR, SenseReID, Market1501, GRID, PRID, CUHK01, CUHK02, CUHK03, MSMT17, VIPeR, SenseReID, Market1501,
DukeMTMCreID, iLIDS DukeMTMCreID, iLIDS, University1652
) )
from .video import PRID2011, Mars, DukeMTMCVidReID, iLIDSVID from .video import PRID2011, Mars, DukeMTMCVidReID, iLIDSVID
from .dataset import Dataset, ImageDataset, VideoDataset from .dataset import Dataset, ImageDataset, VideoDataset
@ -18,7 +18,8 @@ __image_datasets = {
'ilids': iLIDS, 'ilids': iLIDS,
'sensereid': SenseReID, 'sensereid': SenseReID,
'prid': PRID, 'prid': PRID,
'cuhk02': CUHK02 'cuhk02': CUHK02,
'university1652':University1652
} }
__video_datasets = { __video_datasets = {

View File

@ -11,3 +11,4 @@ from .msmt17 import MSMT17
from .sensereid import SenseReID from .sensereid import SenseReID
from .market1501 import Market1501 from .market1501 import Market1501
from .dukemtmcreid import DukeMTMCreID from .dukemtmcreid import DukeMTMCreID
from .university1652 import University1652

View File

@ -0,0 +1,102 @@
from __future__ import division, print_function, absolute_import
import re
import glob
import os.path as osp
import os
import gdown
from ..dataset import ImageDataset
class University1652(ImageDataset):
"""University-1652.
Reference:
- Zheng et al. University-1652: A Multi-view Multi-source Benchmark for Drone-based Geo-localization. ACM MM 2020.
URL: `<https://github.com/layumi/University1652-Baseline>`_
OneDrive:
https://studentutsedu-my.sharepoint.com/:u:/g/personal/12639605_student_uts_edu_au/Ecrz6xK-PcdCjFdpNb0T0s8B_9J5ynaUy3q63_XumjJyrA?e=z4hpcz
[Backup] GoogleDrive:
https://drive.google.com/file/d/1iVnP4gjw-iHXa0KerZQ1IfIO0i1jADsR/view?usp=sharing
[Backup] Baidu Yun:
https://pan.baidu.com/s/1H_wBnWwikKbaBY1pMPjoqQ password: hrqp
Dataset statistics:
- buildings: 1652 (train + query).
- The dataset split is as follows:
| Split | #imgs | #buildings | #universities|
| -------- | ----- | ----| ----|
| Training | 50,218 | 701 | 33 |
| Query_drone | 37,855 | 701 | 39 |
| Query_satellite | 701 | 701 | 39|
| Query_ground | 2,579 | 701 | 39|
| Gallery_drone | 51,355 | 951 | 39|
| Gallery_satellite | 951 | 951 | 39|
| Gallery_ground | 2,921 | 793 | 39|
- cameras: None.
datamanager = torchreid.data.ImageDataManager(
root='reid-data',
sources='university1652',
targets='university1652',
height=256,
width=256,
batch_size_train=32,
batch_size_test=100,
transforms=['random_flip', 'random_crop']
)
"""
dataset_dir = 'university1652'
dataset_url = 'https://drive.google.com/uc?id=1iVnP4gjw-iHXa0KerZQ1IfIO0i1jADsR'
def __init__(self, root='', **kwargs):
self.root = osp.abspath(osp.expanduser(root))
self.dataset_dir = osp.join(self.root, self.dataset_dir)
print(self.dataset_dir)
if not os.path.isdir(self.dataset_dir):
os.mkdir(self.dataset_dir)
gdown.download(self.dataset_url, self.dataset_dir+'data.zip', quiet=False)
os.system('unzip %s'%(self.dataset_dir+'data.zip'))
self.train_dir = osp.join(
self.dataset_dir,'University-Release/train/'
)
self.query_dir = osp.join(self.dataset_dir, 'University-Release/test/query_drone')
self.gallery_dir = osp.join(
self.dataset_dir, 'University-Release/test/gallery_satellite'
)
required_files = [
self.dataset_dir, self.train_dir, self.query_dir, self.gallery_dir
]
self.check_before_run(required_files)
self.fake_camid = 0
train = self.process_dir(self.train_dir, relabel=True, train=True)
query = self.process_dir(self.query_dir, relabel=False)
gallery = self.process_dir(self.gallery_dir, relabel=False)
super(University1652, self).__init__(train, query, gallery, **kwargs)
def process_dir(self, dir_path, relabel=False, train=False):
IMG_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp')
if train:
img_paths = glob.glob(osp.join(dir_path, '*/*/*'))
else:
img_paths = glob.glob(osp.join(dir_path, '*/*'))
pid_container = set()
for img_path in img_paths:
if not img_path.lower().endswith(IMG_EXTENSIONS):
continue
pid = int(os.path.basename(os.path.dirname(img_path)))
pid_container.add(pid)
pid2label = {pid: label for label, pid in enumerate(pid_container)}
data = []
# no camera for university
for img_path in img_paths:
if not img_path.lower().endswith(IMG_EXTENSIONS):
continue
pid = int(os.path.basename(os.path.dirname(img_path)))
if relabel:
pid = pid2label[pid]
data.append((img_path, pid, self.fake_camid))
self.fake_camid +=1
return data