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
71755dad
Commit
71755dad
authored
Dec 02, 2016
by
Soumith Chintala
Browse files
cifar10/100 only load train/test and not both
parent
2d55b9d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
torchvision/datasets/cifar.py
torchvision/datasets/cifar.py
+23
-23
No files found.
torchvision/datasets/cifar.py
View file @
71755dad
...
@@ -42,35 +42,35 @@ class CIFAR10(data.Dataset):
...
@@ -42,35 +42,35 @@ class CIFAR10(data.Dataset):
+
' You can use download=True to download it'
)
+
' You can use download=True to download it'
)
# now load the picked numpy arrays
# now load the picked numpy arrays
self
.
train_data
=
[]
if
self
.
train
:
self
.
train_labels
=
[]
self
.
train_data
=
[]
for
fentry
in
self
.
train_list
:
self
.
train_labels
=
[]
f
=
fentry
[
0
]
for
fentry
in
self
.
train_list
:
f
=
fentry
[
0
]
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
fo
=
open
(
file
,
'rb'
)
entry
=
pickle
.
load
(
fo
)
self
.
train_data
.
append
(
entry
[
'data'
])
if
'labels'
in
entry
:
self
.
train_labels
+=
entry
[
'labels'
]
else
:
self
.
train_labels
+=
entry
[
'fine_labels'
]
fo
.
close
()
self
.
train_data
=
np
.
concatenate
(
self
.
train_data
)
self
.
train_data
=
self
.
train_data
.
reshape
((
50000
,
3
,
32
,
32
))
else
:
f
=
self
.
test_list
[
0
][
0
]
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
fo
=
open
(
file
,
'rb'
)
fo
=
open
(
file
,
'rb'
)
entry
=
pickle
.
load
(
fo
)
entry
=
pickle
.
load
(
fo
)
self
.
t
rain
_data
.
append
(
entry
[
'data'
]
)
self
.
t
est
_data
=
entry
[
'data'
]
if
'labels'
in
entry
:
if
'labels'
in
entry
:
self
.
t
rain
_labels
+
=
entry
[
'labels'
]
self
.
t
est
_labels
=
entry
[
'labels'
]
else
:
else
:
self
.
t
rain
_labels
+
=
entry
[
'fine_labels'
]
self
.
t
est
_labels
=
entry
[
'fine_labels'
]
fo
.
close
()
fo
.
close
()
self
.
test_data
=
self
.
test_data
.
reshape
((
10000
,
3
,
32
,
32
))
self
.
train_data
=
np
.
concatenate
(
self
.
train_data
)
f
=
self
.
test_list
[
0
][
0
]
file
=
os
.
path
.
join
(
root
,
self
.
base_folder
,
f
)
fo
=
open
(
file
,
'rb'
)
entry
=
pickle
.
load
(
fo
)
self
.
test_data
=
entry
[
'data'
]
if
'labels'
in
entry
:
self
.
test_labels
=
entry
[
'labels'
]
else
:
self
.
test_labels
=
entry
[
'fine_labels'
]
fo
.
close
()
self
.
train_data
=
self
.
train_data
.
reshape
((
50000
,
3
,
32
,
32
))
self
.
test_data
=
self
.
test_data
.
reshape
((
10000
,
3
,
32
,
32
))
def
__getitem__
(
self
,
index
):
def
__getitem__
(
self
,
index
):
if
self
.
train
:
if
self
.
train
:
...
...
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