-
Notifications
You must be signed in to change notification settings - Fork 63
Added a new dataset: GTA 5 #15
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR and sorry for the long time it took me to review it!!
There are a few minor modifications to make, but overall looks good to me. Once you are done with them it can be merged. Thank you!
@@ -33,3 +33,6 @@ shared_path = /data/lisatmp4/romerosa/datasets/davis/ | |||
|
|||
[gatech] | |||
shared_path = /data/lisatmp4/dejoieti/data/GATECH/ | |||
|
|||
[gta5] | |||
shared_path = /data/lisatmp4/vazquezd/Datasets/gta5/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the dataset to https://github.com/fvisin/dataset_loaders/blob/master/dataset_loaders/__init__.py as well (both the import and in __all__)
dataset_loaders/images/gta5.py
Outdated
class GTA5Dataset(ThreadedDataset): | ||
'''The GTA5 semantic segmentation dataset | ||
|
||
The GTA5 dataset [1] consists of 24966 densely labelled frames split into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace [1]
with [GTA5]_
please
10 parts for convenience. The class labels are compatible with the CamVid | ||
and CityScapes datasets. | ||
|
||
The dataset should be downloaded from [1]_ into the `shared_path` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[1]_
--> [GTA5]_
|
||
References | ||
---------- | ||
.. [1] https://download.visinf.tu-darmstadt.de/data/from_games/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[1]
--> [GTA5]
dataset_loaders/images/gta5.py
Outdated
mean = [0, 0, 0] | ||
std = [1, 1, 1] | ||
|
||
mapping_type = 'cityscapes' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like to have this hardcoded. If having both mappings makes sense please create three classes: a GTA5_abstract
class with the common code and two subclasses GTA5_camvid
and GTA5_cityscapes
that define the relevant attributes.
Unfortunately non_void_nclasses
is an attribute of the class and not of the object, so it cannot simply be set in the constructor. It should not be too convoluted to have two classes I hope.
dataset_loaders/images/gta5.py
Outdated
import scipy.io | ||
split = scipy.io.loadmat(os.path.join(self.path, 'split.mat')) | ||
split = split[self.which_set + "Ids"] | ||
for id in split: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id
is a built-in function in python. Please replace it with something else (e.g., f
or name
)
dataset_loaders/images/gta5.py
Outdated
for id in split: | ||
filenames.append(str(id[0]).zfill(5)+'.png') | ||
self._filenames = filenames | ||
# print(filenames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the commented command
# cycle through the different videos | ||
for prefix in prefix_list: | ||
per_subset_names[prefix] = [el for el in filenames if | ||
el.startswith(prefix)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering the filenames by the prefix every time get_names
is called seems wasteful: why don't you make self.filenames
a dictionary and modify the filenames function to store a list of filenames for each prefix?
This should work but please check it:
def filenames(self):
if self._filenames is None:
filenames = {}
split = scipy.io.loadmat(os.path.join(self.path, 'split.mat'))
split = split[self.which_set + "Ids"]
for name in split:
prefix = name[:6]
filenames.setdefault(prefix, []).append(name[0].zfill(5) + '.png')
self._filenames = filenames
return self._filenames
You can then remove self.prefix_list
and the related function, and return self.filenames directly in get_names()
.
dataset_loaders/images/gta5.py
Outdated
""" | ||
from skimage import io | ||
from PIL import Image | ||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move all the imports at the top of the file
img = io.imread(os.path.join(self.image_path, frame)) | ||
img = img.astype(floatX) / 255. | ||
|
||
# mask = io.imread(os.path.join(self.mask_path, frame)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the commented out line please
Hello @david-vazquez! Thanks for updating the PR.
Comment last updated on October 23, 2017 at 21:36 Hours UTC |
Thank you again for investigating the issue with the zoom! |
Hey @david-vazquez any update on this? :) |
@david-vazquez do you have time to work on this? I have a student that could help you closing the PR |
Hi I have added the dataset loader for GTA 5.