Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
227c409d
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
227c409d
编写于
8月 04, 2020
作者:
Y
yangyongjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change comment and nms in yolov3-darknet53.
上级
b0b4fa08
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
52 deletion
+45
-52
model_zoo/official/cv/yolov3_darknet53/eval.py
model_zoo/official/cv/yolov3_darknet53/eval.py
+21
-21
model_zoo/official/cv/yolov3_darknet53/src/transforms.py
model_zoo/official/cv/yolov3_darknet53/src/transforms.py
+24
-31
未找到文件。
model_zoo/official/cv/yolov3_darknet53/eval.py
浏览文件 @
227c409d
...
...
@@ -90,35 +90,35 @@ class DetectionEngine:
for
i
in
keep_index
]
self
.
det_boxes
.
extend
(
keep_box
)
def
_nms
(
self
,
dets
,
thresh
):
def
_nms
(
self
,
predicts
,
threshold
):
"""Calculate NMS."""
# conver xywh -> xmin ymin xmax ymax
x1
=
de
ts
[:,
0
]
y1
=
de
ts
[:,
1
]
x2
=
x1
+
de
ts
[:,
2
]
y2
=
y1
+
de
ts
[:,
3
]
scores
=
de
ts
[:,
4
]
x1
=
predic
ts
[:,
0
]
y1
=
predic
ts
[:,
1
]
x2
=
x1
+
predic
ts
[:,
2
]
y2
=
y1
+
predic
ts
[:,
3
]
scores
=
predic
ts
[:,
4
]
areas
=
(
x2
-
x1
+
1
)
*
(
y2
-
y1
+
1
)
order
=
scores
.
argsort
()[::
-
1
]
keep
=
[]
reserved_boxes
=
[]
while
order
.
size
>
0
:
i
=
order
[
0
]
keep
.
append
(
i
)
x
x1
=
np
.
maximum
(
x1
[
i
],
x1
[
order
[
1
:]])
y
y1
=
np
.
maximum
(
y1
[
i
],
y1
[
order
[
1
:]])
x
x2
=
np
.
minimum
(
x2
[
i
],
x2
[
order
[
1
:]])
y
y2
=
np
.
minimum
(
y2
[
i
],
y2
[
order
[
1
:]])
w
=
np
.
maximum
(
0.0
,
xx2
-
x
x1
+
1
)
h
=
np
.
maximum
(
0.0
,
yy2
-
y
y1
+
1
)
inter
=
w
*
h
ovr
=
inter
/
(
areas
[
i
]
+
areas
[
order
[
1
:]]
-
inter
)
ind
s
=
np
.
where
(
ovr
<=
thresh
)[
0
]
order
=
order
[
inds
+
1
]
return
keep
reserved_boxes
.
append
(
i
)
max_
x1
=
np
.
maximum
(
x1
[
i
],
x1
[
order
[
1
:]])
max_
y1
=
np
.
maximum
(
y1
[
i
],
y1
[
order
[
1
:]])
min_
x2
=
np
.
minimum
(
x2
[
i
],
x2
[
order
[
1
:]])
min_
y2
=
np
.
minimum
(
y2
[
i
],
y2
[
order
[
1
:]])
intersect_w
=
np
.
maximum
(
0.0
,
min_x2
-
max_
x1
+
1
)
intersect_h
=
np
.
maximum
(
0.0
,
min_y2
-
max_
y1
+
1
)
inter
sect_area
=
intersect_w
*
intersect_
h
ovr
=
inter
sect_area
/
(
areas
[
i
]
+
areas
[
order
[
1
:]]
-
intersect_area
)
ind
exs
=
np
.
where
(
ovr
<=
threshold
)[
0
]
order
=
order
[
ind
ex
s
+
1
]
return
reserved_boxes
def
write_result
(
self
):
"""Save result to file."""
...
...
model_zoo/official/cv/yolov3_darknet53/src/transforms.py
浏览文件 @
227c409d
...
...
@@ -73,42 +73,35 @@ def statistic_normalize_img(img, statistic_norm):
def
get_interp_method
(
interp
,
sizes
=
()):
"""Get the interpolation method for resize functions.
"""
Get the interpolation method for resize functions.
The major purpose of this function is to wrap a random interp method selection
and a auto-estimation method.
Parameters
----------
interp : int
interpolation method for all resizing operations
Possible values:
0: Nearest Neighbors Interpolation.
1: Bilinear interpolation.
2: Bicubic interpolation over 4x4 pixel neighborhood.
3: Nearest Neighbors. [Originally it should be Area-based,
as we cannot find Area-based, so we use NN instead.
Area-based (resampling using pixel area relation). It may be a
preferred method for image decimation, as it gives moire-free
results. But when the image is zoomed, it is similar to the Nearest
Neighbors method. (used by default).
4: Lanczos interpolation over 8x8 pixel neighborhood.
9: Cubic for enlarge, area for shrink, bilinear for others
10: Random select from interpolation method metioned above.
Note:
Note:
When shrinking an image, it will generally look best with AREA-based
interpolation, whereas, when enlarging an image, it will generally look best
with Bicubic (slow) or Bilinear (faster but still looks OK).
More details can be found in the documentation of OpenCV, please refer to
http://docs.opencv.org/master/da/d54/group__imgproc__transform.html.
sizes : tuple of int
(old_height, old_width, new_height, new_width), if None provided, auto(9)
will return Area(2) anyway.
Returns
-------
int
interp method from 0 to 4
with Bicubic or Bilinear.
Args:
interp (int): Interpolation method for all resizing operations.
- 0: Nearest Neighbors Interpolation.
- 1: Bilinear interpolation.
- 2: Bicubic interpolation over 4x4 pixel neighborhood.
- 3: Nearest Neighbors. Originally it should be Area-based, as we cannot find Area-based,
so we use NN instead. Area-based (resampling using pixel area relation).
It may be a preferred method for image decimation, as it gives moire-free results.
But when the image is zoomed, it is similar to the Nearest Neighbors method. (used by default).
- 4: Lanczos interpolation over 8x8 pixel neighborhood.
- 9: Cubic for enlarge, area for shrink, bilinear for others.
- 10: Random select from interpolation method mentioned above.
sizes (tuple): Format should like (old_height, old_width, new_height, new_width),
if None provided, auto(9) will return Area(2) anyway. Default: ()
Returns:
int, interp method from 0 to 4.
"""
if
interp
==
9
:
if
sizes
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录