Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
1feb6376
Unverified
Commit
1feb6376
authored
Jan 14, 2022
by
Philip Meier
Committed by
GitHub
Jan 14, 2022
Browse files
fix category file generation (#5188)
parent
e3767f8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
torchvision/prototype/datasets/_builtin/dtd.py
torchvision/prototype/datasets/_builtin/dtd.py
+4
-1
torchvision/prototype/datasets/_builtin/oxford_iiit_pet.py
torchvision/prototype/datasets/_builtin/oxford_iiit_pet.py
+4
-1
No files found.
torchvision/prototype/datasets/_builtin/dtd.py
View file @
1feb6376
...
...
@@ -132,6 +132,9 @@ class DTD(Dataset):
return
self
.
_classify_archive
(
data
)
==
DTDDemux
.
IMAGES
def
_generate_categories
(
self
,
root
:
pathlib
.
Path
)
->
List
[
str
]:
dp
=
self
.
resources
(
self
.
default_config
)[
0
].
load
(
pathlib
.
Path
(
root
)
/
self
.
name
)
resources
=
self
.
resources
(
self
.
default_config
)
dp
=
resources
[
0
].
load
(
root
)
dp
=
Filter
(
dp
,
self
.
_filter_images
)
return
sorted
({
pathlib
.
Path
(
path
).
parent
.
name
for
path
,
_
in
dp
})
torchvision/prototype/datasets/_builtin/oxford_iiit_pet.py
View file @
1feb6376
...
...
@@ -145,10 +145,13 @@ class OxfordIITPet(Dataset):
def
_generate_categories
(
self
,
root
:
pathlib
.
Path
)
->
List
[
str
]:
config
=
self
.
default_config
dp
=
self
.
resources
(
config
)[
1
].
load
(
pathlib
.
Path
(
root
)
/
self
.
name
)
resources
=
self
.
resources
(
config
)
dp
=
resources
[
1
].
load
(
root
)
dp
=
Filter
(
dp
,
self
.
_filter_split_and_classification_anns
)
dp
=
Filter
(
dp
,
path_comparator
(
"name"
,
f
"
{
config
.
split
}
.txt"
))
dp
=
CSVDictParser
(
dp
,
fieldnames
=
(
"image_id"
,
"label"
),
delimiter
=
" "
)
raw_categories_and_labels
=
{(
data
[
"image_id"
].
rsplit
(
"_"
,
1
)[
0
],
data
[
"label"
])
for
data
in
dp
}
raw_categories
,
_
=
zip
(
*
sorted
(
raw_categories_and_labels
,
key
=
lambda
raw_category_and_label
:
int
(
raw_category_and_label
[
1
]))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment