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
32d254bb
Unverified
Commit
32d254bb
authored
Dec 21, 2022
by
deepsghimire
Committed by
GitHub
Dec 21, 2022
Browse files
Fixes use download_and_extract in SBU dataset (#7046) (#7051)
parent
b0aa60ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
torchvision/datasets/sbu.py
torchvision/datasets/sbu.py
+2
-7
No files found.
torchvision/datasets/sbu.py
View file @
32d254bb
...
@@ -3,7 +3,7 @@ from typing import Any, Callable, Optional, Tuple
...
@@ -3,7 +3,7 @@ from typing import Any, Callable, Optional, Tuple
from
PIL
import
Image
from
PIL
import
Image
from
.utils
import
check_integrity
,
download_url
from
.utils
import
check_integrity
,
download_and_extract_archive
,
download_url
from
.vision
import
VisionDataset
from
.vision
import
VisionDataset
...
@@ -90,17 +90,12 @@ class SBU(VisionDataset):
...
@@ -90,17 +90,12 @@ class SBU(VisionDataset):
def
download
(
self
)
->
None
:
def
download
(
self
)
->
None
:
"""Download and extract the tarball, and download each individual photo."""
"""Download and extract the tarball, and download each individual photo."""
import
tarfile
if
self
.
_check_integrity
():
if
self
.
_check_integrity
():
print
(
"Files already downloaded and verified"
)
print
(
"Files already downloaded and verified"
)
return
return
download_url
(
self
.
url
,
self
.
root
,
self
.
filename
,
self
.
md5_checksum
)
download_and_extract_archive
(
self
.
url
,
self
.
root
,
self
.
root
,
self
.
filename
,
self
.
md5_checksum
)
# Extract file
with
tarfile
.
open
(
os
.
path
.
join
(
self
.
root
,
self
.
filename
),
"r:gz"
)
as
tar
:
tar
.
extractall
(
path
=
self
.
root
)
# Download individual photos
# Download individual photos
with
open
(
os
.
path
.
join
(
self
.
root
,
"dataset"
,
"SBU_captioned_photo_dataset_urls.txt"
))
as
fh
:
with
open
(
os
.
path
.
join
(
self
.
root
,
"dataset"
,
"SBU_captioned_photo_dataset_urls.txt"
))
as
fh
:
...
...
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