Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
3d496ef9
C
Cvat
项目概览
疯人忠
/
Cvat
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cvat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3d496ef9
编写于
6月 15, 2021
作者:
B
Boris Sekachev
提交者:
GitHub
6月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added some fixes to DEXTR model handler (#3325)
* Added some fixes to DEXTR model handler * Updated Changelog
上级
7699bd36
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
12 deletion
+11
-12
CHANGELOG.md
CHANGELOG.md
+1
-1
serverless/openvino/dextr/nuclio/model_handler.py
serverless/openvino/dextr/nuclio/model_handler.py
+10
-11
未找到文件。
CHANGELOG.md
浏览文件 @
3d496ef9
...
...
@@ -13,7 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
Filter
`is_active`
for user list (
<https://github.com/openvinotoolkit/cvat/pull/3235>
)
-
Ability to export/import tasks (
<https://github.com/openvinotoolkit/cvat/pull/3056>
)
### Changed
-
Updated manifest format, added meta with related images (
<https://github.com/openvinotoolkit/cvat/pull/3122>
)
...
...
@@ -36,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
Fix CLI create an infinite loop if git repository responds with failure (
<https://github.com/openvinotoolkit/cvat/pull/3267>
)
-
Bug with sidebar & fullscreen (
<https://github.com/openvinotoolkit/cvat/pull/3289>
)
-
504 Gateway Time-out on
`data/meta`
requests (
<https://github.com/openvinotoolkit/cvat/pull/3269>
)
-
Some code issues in Deep Extreme Cut handler code (
<https://github.com/openvinotoolkit/cvat/pull/3325>
)
### Security
...
...
serverless/openvino/dextr/nuclio/model_handler.py
浏览文件 @
3d496ef9
# Copyright (C) 2018-202
0
Intel Corporation
# Copyright (C) 2018-202
1
Intel Corporation
#
# SPDX-License-Identifier: MIT
...
...
@@ -21,7 +21,7 @@ class ModelHandler:
# polygon: [[x1,y1], [x2,y2], [x3,y3], [x4,y4], ...]
def
handle
(
self
,
image
,
points
):
DEXTR_PADDING
=
50
DEXTR_TRESHOLD
=
0.
9
DEXTR_TRESHOLD
=
0.
8
DEXTR_SIZE
=
512
numpy_image
=
np
.
array
(
image
)
...
...
@@ -43,7 +43,7 @@ class ModelHandler:
resized
=
resized
[:,
:,
:
3
]
# Make a heatmap
points
=
points
-
[
min
(
points
[:,
0
]),
min
(
points
[:,
1
])]
+
[
DEXTR_PADDING
,
DEXTR_PADDING
]
points
=
points
-
[
bounding_box
[
0
],
bounding_box
[
1
]
]
points
=
(
points
*
[
DEXTR_SIZE
/
numpy_cropped
.
shape
[
1
],
DEXTR_SIZE
/
numpy_cropped
.
shape
[
0
]]).
astype
(
int
)
heatmap
=
np
.
zeros
(
shape
=
resized
.
shape
[:
2
],
dtype
=
np
.
float64
)
for
point
in
points
:
...
...
@@ -51,25 +51,24 @@ class ModelHandler:
gaussian_y_axis
=
np
.
arange
(
0
,
DEXTR_SIZE
,
1
,
float
)[:,
np
.
newaxis
]
-
point
[
1
]
gaussian
=
np
.
exp
(
-
4
*
np
.
log
(
2
)
*
((
gaussian_x_axis
**
2
+
gaussian_y_axis
**
2
)
/
100
)).
astype
(
np
.
float64
)
heatmap
=
np
.
maximum
(
heatmap
,
gaussian
)
cv2
.
normalize
(
heatmap
,
heatmap
,
0
,
255
,
cv2
.
NORM_MINMAX
)
cv2
.
normalize
(
heatmap
,
heatmap
,
0
,
255
,
cv2
.
NORM_MINMAX
)
# Concat an image and a heatmap
input_dextr
=
np
.
concatenate
((
resized
,
heatmap
[:,
:,
np
.
newaxis
].
astype
(
resized
.
dtype
)),
axis
=
2
)
input_dextr
=
input_dextr
.
transpose
((
2
,
0
,
1
))
pred
=
self
.
model
.
infer
(
input_dextr
[
np
.
newaxis
,
...],
False
)[
0
,
0
,
:,
:]
pred
=
cv2
.
resize
(
pred
,
tuple
(
reversed
(
numpy_cropped
.
shape
[:
2
])),
interpolation
=
cv2
.
INTER_CUBIC
)
result
=
np
.
zeros
(
numpy_image
.
shape
[:
2
])
result
[
bounding_box
[
1
]:
bounding_box
[
1
]
+
pred
.
shape
[
0
],
bounding_box
[
0
]:
bounding_box
[
0
]
+
pred
.
shape
[
1
]]
=
pred
>
DEXTR_TRESHOLD
pred
=
(
pred
>
DEXTR_TRESHOLD
).
astype
(
np
.
uint8
)
pred
=
cv2
.
resize
(
pred
,
tuple
(
reversed
(
numpy_cropped
.
shape
[:
2
])),
interpolation
=
cv2
.
INTER_NEAREST
)
result
=
np
.
zeros
(
numpy_image
.
shape
[:
2
]).
astype
(
np
.
uint8
)
result
[
bounding_box
[
1
]:
bounding_box
[
1
]
+
pred
.
shape
[
0
],
bounding_box
[
0
]:
bounding_box
[
0
]
+
pred
.
shape
[
1
]]
=
pred
# Convert a mask to a polygon
result
=
np
.
array
(
result
,
dtype
=
np
.
uint8
)
cv2
.
normalize
(
result
,
result
,
0
,
255
,
cv2
.
NORM_MINMAX
)
contours
=
None
if
int
(
cv2
.
__version__
.
split
(
'.'
)[
0
])
>
3
:
contours
=
cv2
.
findContours
(
result
,
cv2
.
RETR_EXTERNAL
,
cv2
.
CHAIN_APPROX_
TC89_KCOS
)[
0
]
contours
=
cv2
.
findContours
(
result
,
cv2
.
RETR_EXTERNAL
,
cv2
.
CHAIN_APPROX_
SIMPLE
)[
0
]
else
:
contours
=
cv2
.
findContours
(
result
,
cv2
.
RETR_EXTERNAL
,
cv2
.
CHAIN_APPROX_
TC89_KCOS
)[
1
]
contours
=
cv2
.
findContours
(
result
,
cv2
.
RETR_EXTERNAL
,
cv2
.
CHAIN_APPROX_
SIMPLE
)[
1
]
contours
=
max
(
contours
,
key
=
lambda
arr
:
arr
.
size
)
if
contours
.
shape
.
count
(
1
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录