Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
4bd7aa25
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4bd7aa25
编写于
9月 21, 2020
作者:
K
Kaipeng Deng
提交者:
GitHub
9月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use paddle.get_default_dtype in vision datasets. test=develop (#27426)
上级
fc61efd7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
4 deletion
+19
-4
python/paddle/vision/datasets/cifar.py
python/paddle/vision/datasets/cifar.py
+4
-1
python/paddle/vision/datasets/flowers.py
python/paddle/vision/datasets/flowers.py
+4
-1
python/paddle/vision/datasets/folder.py
python/paddle/vision/datasets/folder.py
+3
-0
python/paddle/vision/datasets/mnist.py
python/paddle/vision/datasets/mnist.py
+4
-1
python/paddle/vision/datasets/voc2012.py
python/paddle/vision/datasets/voc2012.py
+4
-1
未找到文件。
python/paddle/vision/datasets/cifar.py
浏览文件 @
4bd7aa25
...
...
@@ -19,6 +19,7 @@ import numpy as np
import
six
from
six.moves
import
cPickle
as
pickle
import
paddle
from
paddle.io
import
Dataset
from
paddle.dataset.common
import
_check_exists_and_download
...
...
@@ -113,6 +114,8 @@ class Cifar10(Dataset):
# read dataset into memory
self
.
_load_data
()
self
.
dtype
=
paddle
.
get_default_dtype
()
def
_init_url_md5_flag
(
self
):
self
.
data_url
=
CIFAR10_URL
self
.
data_md5
=
CIFAR10_MD5
...
...
@@ -142,7 +145,7 @@ class Cifar10(Dataset):
image
=
np
.
reshape
(
image
,
[
3
,
32
,
32
])
if
self
.
transform
is
not
None
:
image
=
self
.
transform
(
image
)
return
image
,
label
return
image
.
astype
(
self
.
dtype
),
np
.
array
(
label
).
astype
(
'int64'
)
def
__len__
(
self
):
return
len
(
self
.
data
)
...
...
python/paddle/vision/datasets/flowers.py
浏览文件 @
4bd7aa25
...
...
@@ -21,6 +21,7 @@ import numpy as np
import
scipy.io
as
scio
from
PIL
import
Image
import
paddle
from
paddle.io
import
Dataset
from
paddle.dataset.common
import
_check_exists_and_download
...
...
@@ -104,6 +105,8 @@ class Flowers(Dataset):
# read dataset into memory
self
.
_load_anno
()
self
.
dtype
=
paddle
.
get_default_dtype
()
def
_load_anno
(
self
):
self
.
name2mem
=
{}
self
.
data_tar
=
tarfile
.
open
(
self
.
data_file
)
...
...
@@ -124,7 +127,7 @@ class Flowers(Dataset):
if
self
.
transform
is
not
None
:
image
=
self
.
transform
(
image
)
return
image
,
label
.
astype
(
'int64'
)
return
image
.
astype
(
self
.
dtype
)
,
label
.
astype
(
'int64'
)
def
__len__
(
self
):
return
len
(
self
.
indexes
)
python/paddle/vision/datasets/folder.py
浏览文件 @
4bd7aa25
...
...
@@ -15,6 +15,7 @@
import
os
import
sys
import
paddle
from
paddle.io
import
Dataset
from
paddle.utils
import
try_import
...
...
@@ -143,6 +144,8 @@ class DatasetFolder(Dataset):
self
.
samples
=
samples
self
.
targets
=
[
s
[
1
]
for
s
in
samples
]
self
.
dtype
=
paddle
.
get_default_dtype
()
def
_find_classes
(
self
,
dir
):
"""
Finds the class folders in a dataset.
...
...
python/paddle/vision/datasets/mnist.py
浏览文件 @
4bd7aa25
...
...
@@ -19,6 +19,7 @@ import gzip
import
struct
import
numpy
as
np
import
paddle
from
paddle.io
import
Dataset
from
paddle.dataset.common
import
_check_exists_and_download
...
...
@@ -95,6 +96,8 @@ class MNIST(Dataset):
# read dataset into memory
self
.
_parse_dataset
()
self
.
dtype
=
paddle
.
get_default_dtype
()
def
_parse_dataset
(
self
,
buffer_size
=
100
):
self
.
images
=
[]
self
.
labels
=
[]
...
...
@@ -145,7 +148,7 @@ class MNIST(Dataset):
image
=
np
.
reshape
(
image
,
[
1
,
28
,
28
])
if
self
.
transform
is
not
None
:
image
=
self
.
transform
(
image
)
return
image
,
label
return
image
.
astype
(
self
.
dtype
),
label
.
astype
(
'int64'
)
def
__len__
(
self
):
return
len
(
self
.
labels
)
python/paddle/vision/datasets/voc2012.py
浏览文件 @
4bd7aa25
...
...
@@ -19,6 +19,7 @@ import tarfile
import
numpy
as
np
from
PIL
import
Image
import
paddle
from
paddle.io
import
Dataset
from
paddle.dataset.common
import
_check_exists_and_download
...
...
@@ -96,6 +97,8 @@ class VOC2012(Dataset):
# read dataset into memory
self
.
_load_anno
()
self
.
dtype
=
paddle
.
get_default_dtype
()
def
_load_anno
(
self
):
self
.
name2mem
=
{}
self
.
data_tar
=
tarfile
.
open
(
self
.
data_file
)
...
...
@@ -127,7 +130,7 @@ class VOC2012(Dataset):
label
=
np
.
array
(
label
)
if
self
.
transform
is
not
None
:
data
=
self
.
transform
(
data
)
return
data
,
label
return
data
.
astype
(
self
.
dtype
),
label
.
astype
(
self
.
dtype
)
def
__len__
(
self
):
return
len
(
self
.
data
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录