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
47e59b16
Unverified
Commit
47e59b16
authored
Mar 01, 2021
by
Philip Meier
Committed by
GitHub
Mar 01, 2021
Browse files
separate caching logic from download (#3448)
Co-authored-by:
Francisco Massa
<
fvsmassa@gmail.com
>
parent
b266c2f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
torchvision/datasets/phototour.py
torchvision/datasets/phototour.py
+5
-2
No files found.
torchvision/datasets/phototour.py
View file @
47e59b16
...
@@ -92,8 +92,10 @@ class PhotoTour(VisionDataset):
...
@@ -92,8 +92,10 @@ class PhotoTour(VisionDataset):
self
.
download
()
self
.
download
()
if
not
self
.
_check_datafile_exists
():
if
not
self
.
_check_datafile_exists
():
raise
RuntimeError
(
'Dataset not found.'
+
try
:
' You can use download=True to download it'
)
self
.
cache
()
except
Exception
as
error
:
raise
RuntimeError
(
"Dataset not found. You can use download=True to download it"
)
from
error
# load the serialized data
# load the serialized data
self
.
data
,
self
.
labels
,
self
.
matches
=
torch
.
load
(
self
.
data_file
)
self
.
data
,
self
.
labels
,
self
.
matches
=
torch
.
load
(
self
.
data_file
)
...
@@ -151,6 +153,7 @@ class PhotoTour(VisionDataset):
...
@@ -151,6 +153,7 @@ class PhotoTour(VisionDataset):
os
.
unlink
(
fpath
)
os
.
unlink
(
fpath
)
def
cache
(
self
)
->
None
:
# process and save as torch files
# process and save as torch files
print
(
'# Caching data {}'
.
format
(
self
.
data_file
))
print
(
'# Caching data {}'
.
format
(
self
.
data_file
))
...
...
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