Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f6d414d2
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6d414d2
编写于
2月 10, 2020
作者:
K
Kaipeng Deng
提交者:
GitHub
2月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable data unittest (#216)
* enable data unittest
上级
ae3e9a8b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
10 deletion
+28
-10
.travis/requirements.txt
.travis/requirements.txt
+4
-2
.travis/unittest.sh
.travis/unittest.sh
+17
-2
ppdet/data/parallel_map.py
ppdet/data/parallel_map.py
+5
-4
ppdet/data/tests/test_dataset.py
ppdet/data/tests/test_dataset.py
+2
-2
未找到文件。
.travis/requirements.txt
浏览文件 @
f6d414d2
# add python requirements for unittests here, note install Cython
# add python requirements for unittests here, note install pycocotools
# and pycocotools directly is not supported in travis ci.
# directly is not supported in travis ci, it is installed by compiling
# from source files in unittest.sh
tqdm
tqdm
cython
.travis/unittest.sh
浏览文件 @
f6d414d2
...
@@ -12,7 +12,7 @@ unittest(){
...
@@ -12,7 +12,7 @@ unittest(){
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
exit
1
exit
1
fi
fi
find
"./ppdet
/modeling
"
-name
'tests'
-type
d
-print0
|
\
find
"./ppdet"
-name
'tests'
-type
d
-print0
|
\
xargs
-0
-I
{}
-n1
bash
-c
\
xargs
-0
-I
{}
-n1
bash
-c
\
'python -m unittest discover -v -s {}'
'python -m unittest discover -v -s {}'
}
}
...
@@ -20,11 +20,26 @@ unittest(){
...
@@ -20,11 +20,26 @@ unittest(){
trap
'abort'
0
trap
'abort'
0
set
-e
set
-e
# install travis python dependencies
# install travis python dependencies
exclude pycocotools
if
[
-f
".travis/requirements.txt"
]
;
then
if
[
-f
".travis/requirements.txt"
]
;
then
pip
install
-r
.travis/requirements.txt
pip
install
-r
.travis/requirements.txt
fi
fi
# install pycocotools
if
[
`
pip list |
grep
pycocotools |
wc
-l
`
-eq
0
]
;
then
# install git if needed
if
[
-n
`
which git
`
]
;
then
apt-get update
apt-get
install
-y
git
fi
;
git clone https://github.com/cocodataset/cocoapi.git
cd
cocoapi/PythonAPI
make
install
python setup.py
install
--user
cd
../..
rm
-rf
cocoapi
fi
export
PYTHONPATH
=
`
pwd
`
:
$PYTHONPATH
export
PYTHONPATH
=
`
pwd
`
:
$PYTHONPATH
unittest
.
unittest
.
...
...
ppdet/data/parallel_map.py
浏览文件 @
f6d414d2
...
@@ -70,10 +70,11 @@ class ParallelMap(object):
...
@@ -70,10 +70,11 @@ class ParallelMap(object):
"multi-process reader on Windows."
)
"multi-process reader on Windows."
)
self
.
_use_process
=
False
self
.
_use_process
=
False
if
self
.
_use_process
and
type
(
memsize
)
is
str
:
if
self
.
_use_process
and
type
(
memsize
)
is
str
:
assert
memsize
[
-
1
].
lower
()
==
'g'
,
\
assert
memsize
[
-
1
].
lower
()
in
[
'g'
,
'm'
],
\
"invalid param for memsize[%s], should be ended with 'G' or 'g'"
%
(
memsize
)
"invalid param for memsize[%s], should be "
\
gb
=
memsize
[:
-
1
]
"ended with 'G' or 'g' or 'M' or 'm'"
%
(
memsize
)
self
.
_memsize
=
int
(
gb
)
*
1024
**
3
power
=
3
if
memsize
[
-
1
].
lower
()
==
'g'
else
2
self
.
_memsize
=
int
(
memsize
[:
-
1
])
*
(
1024
**
power
)
self
.
_started
=
False
self
.
_started
=
False
self
.
_source
=
source
self
.
_source
=
source
self
.
_worker
=
worker
self
.
_worker
=
worker
...
...
ppdet/data/tests/test_dataset.py
浏览文件 @
f6d414d2
...
@@ -109,7 +109,7 @@ class TestDataset(unittest.TestCase):
...
@@ -109,7 +109,7 @@ class TestDataset(unittest.TestCase):
return
2
*
sample
return
2
*
sample
test_worker
=
ParallelMap
(
test_worker
=
ParallelMap
(
mem_sc
,
_worker
,
worker_num
=
2
,
use_process
=
True
)
mem_sc
,
_worker
,
worker_num
=
2
,
use_process
=
True
,
memsize
=
'2M'
)
ct
=
0
ct
=
0
for
i
,
d
in
enumerate
(
test_worker
):
for
i
,
d
in
enumerate
(
test_worker
):
...
@@ -131,7 +131,7 @@ class TestDataset(unittest.TestCase):
...
@@ -131,7 +131,7 @@ class TestDataset(unittest.TestCase):
return
2
*
sample
return
2
*
sample
test_worker
=
ParallelMap
(
test_worker
=
ParallelMap
(
mem_sc
,
_worker
,
worker_num
=
2
,
use_process
=
True
)
mem_sc
,
_worker
,
worker_num
=
2
,
use_process
=
True
,
memsize
=
'2M'
)
ct
=
0
ct
=
0
for
i
,
d
in
enumerate
(
test_worker
):
for
i
,
d
in
enumerate
(
test_worker
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录