Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openvinotoolkit
training_toolbox_caffe
提交
59c1dde1
T
training_toolbox_caffe
项目概览
openvinotoolkit
/
training_toolbox_caffe
上一次同步 1 年多
通知
0
Star
49
Fork
21
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
training_toolbox_caffe
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
59c1dde1
编写于
1月 21, 2019
作者:
E
Evgeny Izutov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes
上级
718f6b30
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
18 deletion
+18
-18
examples/pycaffe/layers/pascal_multilabel_datalayers.py
examples/pycaffe/layers/pascal_multilabel_datalayers.py
+2
-3
examples/ssd/plot_detections.py
examples/ssd/plot_detections.py
+1
-1
python/action_metrics.py
python/action_metrics.py
+13
-13
python/requirements.txt
python/requirements.txt
+1
-0
tools/extra/resize_and_crop_images.py
tools/extra/resize_and_crop_images.py
+1
-1
未找到文件。
examples/pycaffe/layers/pascal_multilabel_datalayers.py
浏览文件 @
59c1dde1
...
...
@@ -194,7 +194,6 @@ def load_pascal_annotation(index, pascal_root):
class_to_ind
=
dict
(
zip
(
classes
,
xrange
(
21
)))
filename
=
osp
.
join
(
pascal_root
,
'Annotations'
,
index
+
'.xml'
)
# print 'Loading: {}'.format(filename)
def
get_data_from_tag
(
node
,
tag
):
return
node
.
getElementsByTagName
(
tag
)[
0
].
childNodes
[
0
].
data
...
...
@@ -247,8 +246,8 @@ def print_info(name, params):
"""
Output some info regarding the class
"""
print
"{} initialized for split: {}, with bs: {}, im_shape: {}."
.
format
(
print
(
"{} initialized for split: {}, with bs: {}, im_shape: {}."
.
format
(
name
,
params
[
'split'
],
params
[
'batch_size'
],
params
[
'im_shape'
])
params
[
'im_shape'
])
)
examples/ssd/plot_detections.py
浏览文件 @
59c1dde1
...
...
@@ -129,7 +129,7 @@ if __name__ == "__main__":
result_file
=
args
.
resultfile
img_dir
=
args
.
imgdir
if
not
os
.
path
.
exists
(
img_dir
):
print
"{} does not exist"
.
format
(
img_dir
)
print
(
"{} does not exist"
.
format
(
img_dir
)
)
sys
.
exit
()
labelmap_file
=
args
.
labelmap_file
labelmap
=
None
...
...
python/action_metrics.py
浏览文件 @
59c1dde1
...
...
@@ -25,8 +25,8 @@ from os.path import exists, basename
import
cv2
import
numpy
as
np
from
lxml
import
etree
from
tqdm
import
tqdm
from
six
import
iteritems
,
itervalues
from
tqdm
import
tqdm
os
.
environ
[
'GLOG_minloglevel'
]
=
'2'
#pylint: disable=wrong-import-position
...
...
@@ -101,7 +101,7 @@ def load_annotation(annotation_path, video_size):
roi
=
[
float
(
video_size
[
1
]),
float
(
video_size
[
0
]),
0.0
,
0.0
]
for
track
in
tqdm
(
root
,
desc
=
'Extracting annotation'
):
if
'label'
not
in
track
.
attrib
.
keys
()
or
track
.
attrib
[
'label'
]
!=
'person'
:
if
'label'
not
in
track
.
attrib
or
track
.
attrib
[
'label'
]
!=
'person'
:
continue
for
bbox
in
track
:
...
...
@@ -111,14 +111,14 @@ def load_annotation(annotation_path, video_size):
frame_id
=
int
(
bbox
.
attrib
[
'frame'
])
action_name
=
None
for
bbox_attr_id
in
range
(
len
(
bbox
)
):
for
bbox_attr_id
,
_
in
enumerate
(
bbox
):
attribute_name
=
bbox
[
bbox_attr_id
].
attrib
[
'name'
]
if
attribute_name
!=
'action'
:
continue
action_name
=
bbox
[
bbox_attr_id
].
text
if
action_name
is
not
None
and
action_name
in
ACTION_NAMES_MAP
.
keys
()
:
if
action_name
is
not
None
and
action_name
in
ACTION_NAMES_MAP
:
label
=
ACTION_NAMES_MAP
[
action_name
]
xmin
=
float
(
bbox
.
attrib
[
'xtl'
])
...
...
@@ -182,8 +182,8 @@ def calculate_similarity_matrix(set_a, set_b):
"""
similarity
=
np
.
zeros
([
len
(
set_a
),
len
(
set_b
)],
dtype
=
np
.
float32
)
for
i
in
range
(
len
(
set_a
)
):
for
j
in
range
(
len
(
set_b
)
):
for
i
,
_
in
enumerate
(
set_a
):
for
j
,
_
in
enumerate
(
set_b
):
similarity
[
i
,
j
]
=
iou
(
set_a
[
i
],
set_b
[
j
])
return
similarity
...
...
@@ -352,9 +352,9 @@ def match_detections(predicted_data, gt_data, min_iou):
total_gt_bbox_num
=
0
matched_gt_bbox_num
=
0
frame_ids
=
gt_data
.
keys
(
)
frame_ids
=
list
(
gt_data
)
for
frame_id
in
tqdm
(
frame_ids
,
desc
=
'Matching detections'
):
if
frame_id
not
in
predicted_data
.
keys
()
:
if
frame_id
not
in
predicted_data
:
all_matches
[
frame_id
]
=
[]
continue
...
...
@@ -402,7 +402,7 @@ def calc_confusion_matrix(all_matched_ids, predicted_data, gt_data, num_classes)
"""
out_cm
=
np
.
zeros
([
num_classes
,
num_classes
],
dtype
=
np
.
int32
)
for
frame_id
in
tqdm
(
all_matched_ids
.
keys
()
,
desc
=
'Evaluating'
):
for
frame_id
in
tqdm
(
all_matched_ids
,
desc
=
'Evaluating'
):
matched_ids
=
all_matched_ids
[
frame_id
]
for
match_pair
in
matched_ids
:
gt_label
=
gt_data
[
frame_id
][
match_pair
[
0
]].
label
...
...
@@ -430,7 +430,7 @@ def detection_classagnostic_metrics(all_matched_ids, predicted_data):
dtype
=
np
.
float32
)
bias
=
0
for
frame_id
in
all_matched_ids
.
keys
()
:
for
frame_id
in
all_matched_ids
:
matched_ids
=
all_matched_ids
[
frame_id
]
predicted_bboxes
=
predicted_data
[
frame_id
]
...
...
@@ -465,7 +465,7 @@ def detection_classspecific_metrics(all_matched_ids, predicted_data, gt_data, cl
false_positives
=
np
.
ones
([
num_predicted_detections
],
dtype
=
np
.
int32
)
bias
=
0
for
frame_id
in
all_matched_ids
.
keys
()
:
for
frame_id
in
all_matched_ids
:
matched_ids
=
all_matched_ids
[
frame_id
]
predicted_class_positions
=
filtered_predicted_pos
[
frame_id
]
gt_bboxes
=
gt_data
[
frame_id
]
...
...
@@ -474,7 +474,7 @@ def detection_classspecific_metrics(all_matched_ids, predicted_data, gt_data, cl
if
gt_bboxes
[
match_pair
[
0
]].
label
!=
class_id
:
continue
if
match_pair
[
1
]
not
in
predicted_class_positions
.
keys
()
:
if
match_pair
[
1
]
not
in
predicted_class_positions
:
continue
pred_local_pos
=
predicted_class_positions
[
match_pair
[
1
]]
...
...
@@ -660,7 +660,7 @@ def main():
video_size
=
read_video_size
(
task
[
1
])
annotation
,
_
=
load_annotation
(
task
[
0
],
video_size
)
valid_frame_ids
=
annotation
.
keys
(
)
valid_frame_ids
=
list
(
annotation
)
predicted_actions
=
predict_actions
(
task
[
1
],
valid_frame_ids
,
detection_net
,
args
.
in_name
,
args
.
out_name
)
...
...
python/requirements.txt
浏览文件 @
59c1dde1
...
...
@@ -17,4 +17,5 @@ Pillow>=5.1.0
six>=1.10.0
lxml>=4.2.2
opencv-python>=3.3.0
tqdm>=4.23.4
tools/extra/resize_and_crop_images.py
浏览文件 @
59c1dde1
...
...
@@ -136,7 +136,7 @@ class ResizeCropImagesMapper(mapreducer.BasicMapper):
FLAGS
.
output_side_length
)
except
Exception
as
e
:
# we ignore the exception (maybe the image is corrupted?)
print
line
,
Exception
,
e
print
(
'{}: {}'
.
format
(
line
,
e
)
yield
value
,
FLAGS
.
output_folder
mapreducer
.
REGISTER_DEFAULT_MAPPER
(
ResizeCropImagesMapper
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录