Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
d8eef4e4
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
d8eef4e4
编写于
11月 30, 2020
作者:
L
LielinJiang
提交者:
GitHub
11月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove dependence of scipy (#29121)
* lazy import for scipy * rm unused check
上级
a069e1ca
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
9 deletion
+15
-9
python/paddle/__init__.py
python/paddle/__init__.py
+0
-3
python/paddle/dataset/flowers.py
python/paddle/dataset/flowers.py
+4
-1
python/paddle/utils/lazy_import.py
python/paddle/utils/lazy_import.py
+5
-1
python/paddle/vision/datasets/flowers.py
python/paddle/vision/datasets/flowers.py
+3
-1
python/requirements.txt
python/requirements.txt
+0
-3
python/unittest_py/requirements.txt
python/unittest_py/requirements.txt
+3
-0
未找到文件。
python/paddle/__init__.py
浏览文件 @
d8eef4e4
...
...
@@ -13,9 +13,6 @@
# limitations under the License.
import
os
from
paddle.check_import_scipy
import
check_import_scipy
check_import_scipy
(
os
.
name
)
try
:
from
paddle.version
import
full_version
as
__version__
...
...
python/paddle/dataset/flowers.py
浏览文件 @
d8eef4e4
...
...
@@ -35,7 +35,6 @@ import itertools
import
functools
from
.common
import
download
import
tarfile
import
scipy.io
as
scio
from
paddle.dataset.image
import
*
from
paddle.reader
import
map_readers
,
xmap_readers
from
paddle
import
compat
as
cpt
...
...
@@ -45,6 +44,7 @@ import numpy as np
from
multiprocessing
import
cpu_count
import
six
from
six.moves
import
cPickle
as
pickle
from
paddle.utils
import
try_import
__all__
=
[
'train'
,
'test'
,
'valid'
]
DATA_URL
=
'http://paddlemodels.bj.bcebos.com/flowers/102flowers.tgz'
...
...
@@ -108,8 +108,11 @@ def reader_creator(data_file,
:return: data reader
:rtype: callable
'''
scio
=
try_import
(
'scipy.io'
)
labels
=
scio
.
loadmat
(
label_file
)[
'labels'
][
0
]
indexes
=
scio
.
loadmat
(
setid_file
)[
dataset_name
][
0
]
img2label
=
{}
for
i
in
indexes
:
img
=
"jpg/image_%05d.jpg"
%
i
...
...
python/paddle/utils/lazy_import.py
浏览文件 @
d8eef4e4
...
...
@@ -19,6 +19,10 @@ import importlib
def
try_import
(
module_name
):
"""Try importing a module, with an informative error message on failure."""
install_name
=
module_name
if
module_name
.
find
(
'.'
)
>
-
1
:
install_name
=
module_name
.
split
(
'.'
)[
0
]
if
module_name
==
'cv2'
:
install_name
=
'opencv-python'
...
...
@@ -28,7 +32,7 @@ def try_import(module_name):
except
ImportError
:
err_msg
=
(
"Failed importing {}. This likely means that some paddle modules "
"require
s
additional dependencies that have to be "
"require additional dependencies that have to be "
"manually installed (usually with `pip install {}`). "
).
format
(
module_name
,
install_name
)
raise
ImportError
(
err_msg
)
python/paddle/vision/datasets/flowers.py
浏览文件 @
d8eef4e4
...
...
@@ -18,11 +18,11 @@ import os
import
io
import
tarfile
import
numpy
as
np
import
scipy.io
as
scio
from
PIL
import
Image
import
paddle
from
paddle.io
import
Dataset
from
paddle.utils
import
try_import
from
paddle.dataset.common
import
_check_exists_and_download
__all__
=
[
"Flowers"
]
...
...
@@ -127,6 +127,8 @@ class Flowers(Dataset):
for
ele
in
self
.
data_tar
.
getmembers
():
self
.
name2mem
[
ele
.
name
]
=
ele
scio
=
try_import
(
'scipy.io'
)
self
.
labels
=
scio
.
loadmat
(
self
.
label_file
)[
'labels'
][
0
]
self
.
indexes
=
scio
.
loadmat
(
self
.
setid_file
)[
self
.
flag
][
0
]
...
...
python/requirements.txt
浏览文件 @
d8eef4e4
...
...
@@ -4,9 +4,6 @@ numpy>=1.13 ; python_version>="3.5" and platform_system != "Windows"
numpy>=1.13, <=1.19.3 ; python_version>="3.5" and platform_system == "Windows"
protobuf>=3.1.0
gast==0.3.3
scipy>=0.19.0, <=1.2.1 ; python_version<"3.5"
scipy<=1.3.1 ; python_version=="3.5"
scipy ; python_version>"3.5"
rarfile
Pillow
six
...
...
python/unittest_py/requirements.txt
浏览文件 @
d8eef4e4
...
...
@@ -6,4 +6,7 @@ gym
opencv-python<=4.2.0.32
visualdl ; python_version>="3.5"
paddle2onnx>=0.4
scipy>=0.19.0, <=1.2.1 ; python_version<"3.5"
scipy<=1.3.1 ; python_version=="3.5"
scipy ; python_version>"3.5"
prettytable
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录