Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
057ef8bd
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
057ef8bd
编写于
4月 06, 2022
作者:
F
Feng Ni
提交者:
GitHub
4月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tqdm eval and infer (#5587)
上级
ae54352f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
28 deletion
+16
-28
ppdet/engine/callbacks.py
ppdet/engine/callbacks.py
+0
-4
ppdet/engine/tracker.py
ppdet/engine/tracker.py
+13
-22
ppdet/engine/trainer.py
ppdet/engine/trainer.py
+3
-2
未找到文件。
ppdet/engine/callbacks.py
浏览文件 @
057ef8bd
...
...
@@ -141,10 +141,6 @@ class LogPrinter(Callback):
dtime
=
str
(
data_time
),
ips
=
ips
)
logger
.
info
(
fmt
)
if
mode
==
'eval'
:
step_id
=
status
[
'step_id'
]
if
step_id
%
100
==
0
:
logger
.
info
(
"Eval iter: {}"
.
format
(
step_id
))
def
on_epoch_end
(
self
,
status
):
if
dist
.
get_world_size
()
<
2
or
dist
.
get_rank
()
==
0
:
...
...
ppdet/engine/tracker.py
浏览文件 @
057ef8bd
...
...
@@ -17,12 +17,11 @@ from __future__ import division
from
__future__
import
print_function
import
os
import
cv2
import
glob
import
re
import
paddle
import
numpy
as
np
import
os.path
as
osp
from
tqdm
import
tqdm
from
collections
import
defaultdict
from
ppdet.core.workspace
import
create
...
...
@@ -31,8 +30,7 @@ from ppdet.modeling.mot.utils import Detection, get_crops, scale_coords, clip_bo
from
ppdet.modeling.mot.utils
import
MOTTimer
,
load_det_results
,
write_mot_results
,
save_vis_results
from
ppdet.modeling.mot.tracker
import
JDETracker
,
DeepSORTTracker
from
ppdet.metrics
import
Metric
,
MOTMetric
,
KITTIMOTMetric
from
ppdet.metrics
import
MCMOTMetric
from
ppdet.metrics
import
Metric
,
MOTMetric
,
KITTIMOTMetric
,
MCMOTMetric
import
ppdet.utils.stats
as
stats
from
.callbacks
import
Callback
,
ComposeCallback
...
...
@@ -142,11 +140,8 @@ class Tracker(object):
self
.
model
.
eval
()
results
=
defaultdict
(
list
)
# support single class and multi classes
for
step_id
,
data
in
enumerate
(
dataloader
):
for
step_id
,
data
in
enumerate
(
tqdm
(
dataloader
)
):
self
.
status
[
'step_id'
]
=
step_id
if
frame_id
%
40
==
0
:
logger
.
info
(
'Processing frame {} ({:.2f} fps)'
.
format
(
frame_id
,
1.
/
max
(
1e-5
,
timer
.
average_time
)))
# forward
timer
.
tic
()
pred_dets
,
pred_embs
=
self
.
model
(
data
)
...
...
@@ -210,12 +205,8 @@ class Tracker(object):
det_file
))
tracker
=
self
.
model
.
tracker
for
step_id
,
data
in
enumerate
(
dataloader
):
for
step_id
,
data
in
enumerate
(
tqdm
(
dataloader
)
):
self
.
status
[
'step_id'
]
=
step_id
if
frame_id
%
40
==
0
:
logger
.
info
(
'Processing frame {} ({:.2f} fps)'
.
format
(
frame_id
,
1.
/
max
(
1e-5
,
timer
.
average_time
)))
ori_image
=
data
[
'ori_image'
]
# [bs, H, W, 3]
ori_image_shape
=
data
[
'ori_image'
].
shape
[
1
:
3
]
# ori_image_shape: [H, W]
...
...
@@ -339,8 +330,8 @@ class Tracker(object):
results
[
0
].
append
(
(
frame_id
+
1
,
online_tlwhs
,
online_scores
,
online_ids
))
save_vis_results
(
data
,
frame_id
,
online_ids
,
online_tlwhs
,
online_scores
,
timer
.
average_time
,
show_image
,
save_dir
,
self
.
cfg
.
num_classes
)
online_scores
,
timer
.
average_time
,
show_image
,
save_dir
,
self
.
cfg
.
num_classes
)
elif
isinstance
(
tracker
,
JDETracker
):
# trick hyperparams only used for MOTChallenge (MOT17, MOT20) Test-set
...
...
@@ -366,12 +357,12 @@ class Tracker(object):
online_scores
[
cls_id
].
append
(
tscore
)
# save results
results
[
cls_id
].
append
(
(
frame_id
+
1
,
online_tlwhs
[
cls_id
],
online_scores
[
cls_id
],
online_ids
[
cls_id
]))
(
frame_id
+
1
,
online_tlwhs
[
cls_id
],
online_scores
[
cls_id
],
online_ids
[
cls_id
]))
timer
.
toc
()
save_vis_results
(
data
,
frame_id
,
online_ids
,
online_tlwhs
,
online_scores
,
timer
.
average_time
,
show_image
,
save_dir
,
self
.
cfg
.
num_classes
)
online_scores
,
timer
.
average_time
,
show_image
,
save_dir
,
self
.
cfg
.
num_classes
)
frame_id
+=
1
...
...
@@ -417,7 +408,7 @@ class Tracker(object):
save_dir
=
os
.
path
.
join
(
output_dir
,
'mot_outputs'
,
seq
)
if
save_images
or
save_videos
else
None
logger
.
info
(
'
start
seq: {}'
.
format
(
seq
))
logger
.
info
(
'
Evaluate
seq: {}'
.
format
(
seq
))
self
.
dataset
.
set_images
(
self
.
get_infer_images
(
infer_dir
))
dataloader
=
create
(
'EvalMOTReader'
)(
self
.
dataset
,
0
)
...
...
@@ -458,7 +449,6 @@ class Tracker(object):
os
.
system
(
cmd_str
)
logger
.
info
(
'Save video in {}.'
.
format
(
output_video_path
))
logger
.
info
(
'Evaluate seq: {}'
.
format
(
seq
))
# update metrics
for
metric
in
self
.
_metrics
:
metric
.
update
(
data_root
,
seq
,
data_type
,
result_root
,
...
...
@@ -582,6 +572,7 @@ class Tracker(object):
write_mot_results
(
result_filename
,
results
,
data_type
,
self
.
cfg
.
num_classes
)
def
get_trick_hyperparams
(
video_name
,
ori_buffer
,
ori_thresh
):
if
video_name
[:
3
]
!=
'MOT'
:
# only used for MOTChallenge (MOT17, MOT20) Test-set
...
...
@@ -610,5 +601,5 @@ def get_trick_hyperparams(video_name, ori_buffer, ori_thresh):
track_thresh
=
0.3
else
:
track_thresh
=
ori_thresh
return
track_buffer
,
ori_thresh
ppdet/engine/trainer.py
浏览文件 @
057ef8bd
...
...
@@ -20,6 +20,7 @@ import os
import
sys
import
copy
import
time
from
tqdm
import
tqdm
import
numpy
as
np
import
typing
...
...
@@ -500,7 +501,7 @@ class Trainer(object):
flops_loader
=
create
(
'{}Reader'
.
format
(
self
.
mode
.
capitalize
()))(
self
.
dataset
,
self
.
cfg
.
worker_num
,
self
.
_eval_batch_sampler
)
self
.
_flops
(
flops_loader
)
for
step_id
,
data
in
enumerate
(
loader
):
for
step_id
,
data
in
enumerate
(
tqdm
(
loader
)
):
self
.
status
[
'step_id'
]
=
step_id
self
.
_compose_callback
.
on_step_begin
(
self
.
status
)
# forward
...
...
@@ -553,7 +554,7 @@ class Trainer(object):
flops_loader
=
create
(
'TestReader'
)(
self
.
dataset
,
0
)
self
.
_flops
(
flops_loader
)
results
=
[]
for
step_id
,
data
in
enumerate
(
loader
):
for
step_id
,
data
in
enumerate
(
tqdm
(
loader
)
):
self
.
status
[
'step_id'
]
=
step_id
# forward
outs
=
self
.
model
(
data
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录