Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e3fd0d56
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看板
提交
e3fd0d56
编写于
5月 10, 2017
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass unit test
上级
a6ec6c05
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
5 deletion
+20
-5
paddle/scripts/run_python_tests.sh
paddle/scripts/run_python_tests.sh
+1
-1
python/paddle/v2/image.py
python/paddle/v2/image.py
+17
-2
python/paddle/v2/tests/CMakeLists.txt
python/paddle/v2/tests/CMakeLists.txt
+1
-1
python/paddle/v2/tests/test_image.py
python/paddle/v2/tests/test_image.py
+1
-1
未找到文件。
paddle/scripts/run_python_tests.sh
浏览文件 @
e3fd0d56
...
...
@@ -29,7 +29,7 @@ if [ $USE_VIRTUALENV_FOR_TEST -ne 0 ]; then
fi
export
PYTHONPATH
=
$SCRIPTPATH
/../../python/
$PYTHON
-m
pip
install
$SCRIPTPATH
/../dist/
*
.whl requests matplotlib
ipython
==
5.3
$PYTHON
-m
pip
install
$SCRIPTPATH
/../dist/
*
.whl requests matplotlib
opencv-python
ipython
==
5.3
for
fn
in
"
$@
"
do
...
...
python/paddle/v2/image.py
浏览文件 @
e3fd0d56
...
...
@@ -45,8 +45,13 @@ def load_image(file, is_color=True):
return a color image. Otherwise, it will
load and return a gray image.
"""
flag
=
cv2
.
CV_LOAD_IMAGE_COLOR
if
is_color
else
\
cv2
.
CV_LOAD_IMAGE_GRAYSCALE
# cv2.IMAGE_COLOR for OpenCV3
# cv2.CV_LOAD_IMAGE_COLOR for older OpenCV Version
# cv2.IMAGE_GRAYSCALE for OpenCV3
# cv2.CV_LOAD_IMAGE_GRAYSCALE for older OpenCV Version
# Here, use constant 1 and 0
# 1: COLOR, 0: GRAYSCALE
flag
=
1
if
is_color
else
0
im
=
cv2
.
imread
(
file
,
flag
)
return
im
...
...
@@ -178,6 +183,11 @@ def simple_transform(im, resize_size, crop_size, is_train, is_color=True):
Simply data argumentation for traing. These operations includes
resizing, croping and flipping.
Example usage:
.. code-block:: python
im = simple_transform(im, 256, 224, True)
:param im: The input image with HWC layout.
:type im: ndarray
:param resize_size: The shorter edge length of the resized image.
...
...
@@ -209,6 +219,11 @@ def load_and_transform(filename,
data argumentation. Please refer the `simple_transform` interface
for the transform operation.
Example usage:
.. code-block:: python
im = load_and_transform('cat.jpg', 256, 224, True)
:param filename: The file name of input image.
:type filename: string
:param resize_size: The shorter edge length of the resized image.
...
...
python/paddle/v2/tests/CMakeLists.txt
浏览文件 @
e3fd0d56
add_python_test
(
test_v2_api test_data_feeder.py test_parameters.py
test_layer.py test_rnn_layer.py test_topology.py test_image
)
test_layer.py test_rnn_layer.py test_topology.py test_image
.py
)
python/paddle/v2/tests/test_image.py
浏览文件 @
e3fd0d56
...
...
@@ -26,7 +26,7 @@ class Image(unittest.TestCase):
self
.
assertEqual
(
3
,
im
.
shape
[
2
])
# flip
im
=
left_right_flip
(
im
)
im
=
image
.
left_right_flip
(
im
)
im2
=
np
.
flip
(
im
,
1
)
self
.
assertEqual
(
im
.
all
(),
im2
.
all
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录