Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
61dcfbe9
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
61dcfbe9
编写于
11月 04, 2020
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add automatic download function to the flowers dataset
上级
a3dcc0cb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
10 deletion
+14
-10
paddlehub/datasets/canvas.py
paddlehub/datasets/canvas.py
+2
-2
paddlehub/datasets/flowers.py
paddlehub/datasets/flowers.py
+9
-5
paddlehub/datasets/minicoco.py
paddlehub/datasets/minicoco.py
+3
-3
未找到文件。
paddlehub/datasets/canvas.py
浏览文件 @
61dcfbe9
...
...
@@ -19,8 +19,8 @@ from typing import Callable
import
paddle
import
numpy
as
np
import
paddlehub.env
as
hubenv
from
paddlehub.vision.utils
import
get_img_file
from
paddlehub.env
import
DATA_HOME
from
paddlehub.utils.download
import
download_data
...
...
@@ -47,7 +47,7 @@ class Canvas(paddle.io.Dataset):
elif
self
.
mode
==
'test'
:
self
.
file
=
'test'
self
.
file
=
os
.
path
.
join
(
DATA_HOME
,
'canvas'
,
self
.
file
)
self
.
file
=
os
.
path
.
join
(
hubenv
.
DATA_HOME
,
'canvas'
,
self
.
file
)
self
.
data
=
get_img_file
(
self
.
file
)
def
__getitem__
(
self
,
idx
:
int
)
->
np
.
ndarray
:
...
...
paddlehub/datasets/flowers.py
浏览文件 @
61dcfbe9
...
...
@@ -14,14 +14,18 @@
# limitations under the License.
import
os
from
typing
import
Callable
,
Tuple
import
paddle
import
numpy
as
np
from
paddlehub.env
import
DATA_HOME
import
paddlehub.env
as
hubenv
from
paddlehub.utils.download
import
download_data
@
download_data
(
url
=
'https://bj.bcebos.com/paddlehub-dataset/flower_photos.tar.gz'
)
class
Flowers
(
paddle
.
io
.
Dataset
):
def
__init__
(
self
,
transforms
=
None
,
mode
=
'train'
):
def
__init__
(
self
,
transforms
:
Callable
,
mode
:
str
=
'train'
):
self
.
mode
=
mode
self
.
transforms
=
transforms
self
.
num_classes
=
5
...
...
@@ -32,14 +36,14 @@ class Flowers(paddle.io.Dataset):
self
.
file
=
'test_list.txt'
else
:
self
.
file
=
'validate_list.txt'
self
.
file
=
os
.
path
.
join
(
DATA_HOME
,
'flower_photos'
,
self
.
file
)
self
.
file
=
os
.
path
.
join
(
hubenv
.
DATA_HOME
,
'flower_photos'
,
self
.
file
)
with
open
(
self
.
file
,
'r'
)
as
file
:
self
.
data
=
file
.
read
().
split
(
'
\n
'
)
def
__getitem__
(
self
,
idx
):
def
__getitem__
(
self
,
idx
)
->
Tuple
[
np
.
ndarray
,
int
]
:
img_path
,
grt
=
self
.
data
[
idx
].
split
(
' '
)
img_path
=
os
.
path
.
join
(
DATA_HOME
,
'flower_photos'
,
img_path
)
img_path
=
os
.
path
.
join
(
hubenv
.
DATA_HOME
,
'flower_photos'
,
img_path
)
im
=
self
.
transforms
(
img_path
)
return
im
,
int
(
grt
)
...
...
paddlehub/datasets/minicoco.py
浏览文件 @
61dcfbe9
...
...
@@ -19,8 +19,8 @@ from typing import Callable
import
paddle
import
numpy
as
np
import
paddlehub.env
as
hubenv
from
paddlehub.vision.utils
import
get_img_file
from
paddlehub.env
import
DATA_HOME
from
paddlehub.utils.download
import
download_data
...
...
@@ -46,8 +46,8 @@ class MiniCOCO(paddle.io.Dataset):
self
.
file
=
'train'
elif
self
.
mode
==
'test'
:
self
.
file
=
'test'
self
.
file
=
os
.
path
.
join
(
DATA_HOME
,
'minicoco'
,
self
.
file
)
self
.
style_file
=
os
.
path
.
join
(
DATA_HOME
,
'minicoco'
,
'21styles'
)
self
.
file
=
os
.
path
.
join
(
hubenv
.
DATA_HOME
,
'minicoco'
,
self
.
file
)
self
.
style_file
=
os
.
path
.
join
(
hubenv
.
DATA_HOME
,
'minicoco'
,
'21styles'
)
self
.
data
=
get_img_file
(
self
.
file
)
self
.
style
=
get_img_file
(
self
.
style_file
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录