Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
曾经的那一瞬间
Models
提交
48693cad
M
Models
项目概览
曾经的那一瞬间
/
Models
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
48693cad
编写于
11月 21, 2019
作者:
P
Pengchong Jin
提交者:
A. Unique TensorFlower
11月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move get_non_empty_box_indices to box_utils.
PiperOrigin-RevId: 281846940
上级
4c872f63
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
16 deletion
+16
-16
official/vision/detection/dataloader/maskrcnn_parser.py
official/vision/detection/dataloader/maskrcnn_parser.py
+1
-1
official/vision/detection/dataloader/retinanet_parser.py
official/vision/detection/dataloader/retinanet_parser.py
+3
-3
official/vision/detection/dataloader/shapemask_parser.py
official/vision/detection/dataloader/shapemask_parser.py
+2
-2
official/vision/detection/utils/box_utils.py
official/vision/detection/utils/box_utils.py
+10
-0
official/vision/detection/utils/input_utils.py
official/vision/detection/utils/input_utils.py
+0
-10
未找到文件。
official/vision/detection/dataloader/maskrcnn_parser.py
浏览文件 @
48693cad
...
...
@@ -234,7 +234,7 @@ class Parser(object):
boxes
,
image_scale
,
(
image_height
,
image_width
),
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
classes
=
tf
.
gather
(
classes
,
indices
)
if
self
.
_include_mask
:
...
...
official/vision/detection/dataloader/retinanet_parser.py
浏览文件 @
48693cad
...
...
@@ -251,7 +251,7 @@ class Parser(object):
boxes
=
input_utils
.
resize_and_crop_boxes
(
boxes
,
image_scale
,
(
image_height
,
image_width
),
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
classes
=
tf
.
gather
(
classes
,
indices
)
...
...
@@ -311,7 +311,7 @@ class Parser(object):
boxes
=
input_utils
.
resize_and_crop_boxes
(
boxes
,
image_scale
,
(
image_height
,
image_width
),
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
classes
=
tf
.
gather
(
classes
,
indices
)
...
...
@@ -414,7 +414,7 @@ class Parser(object):
boxes
=
input_utils
.
resize_and_crop_boxes
(
boxes
,
image_scale
,
(
image_height
,
image_width
),
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
# Assigns anchors.
...
...
official/vision/detection/dataloader/shapemask_parser.py
浏览文件 @
48693cad
...
...
@@ -268,7 +268,7 @@ class Parser(object):
boxes
,
image_scale
,
self
.
_output_size
,
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
classes
=
tf
.
gather
(
classes
,
indices
)
masks
=
tf
.
gather
(
masks
,
indices
)
...
...
@@ -427,7 +427,7 @@ class Parser(object):
tf
.
expand_dims
(
masks
,
axis
=-
1
),
image_scale
,
self
.
_output_size
,
offset
)
# Filters out ground truth boxes that are all zeros.
indices
=
input
_utils
.
get_non_empty_box_indices
(
boxes
)
indices
=
box
_utils
.
get_non_empty_box_indices
(
boxes
)
boxes
=
tf
.
gather
(
boxes
,
indices
)
classes
=
tf
.
gather
(
classes
,
indices
)
...
...
official/vision/detection/utils/box_utils.py
浏览文件 @
48693cad
...
...
@@ -523,3 +523,13 @@ def bbox_overlap(boxes, gt_boxes):
iou
=
tf
.
where
(
padding_mask
,
-
tf
.
ones_like
(
iou
),
iou
)
return
iou
def
get_non_empty_box_indices
(
boxes
):
"""Get indices for non-empty boxes."""
# Selects indices if box height or width is 0.
height
=
boxes
[:,
2
]
-
boxes
[:,
0
]
width
=
boxes
[:,
3
]
-
boxes
[:,
1
]
indices
=
tf
.
where
(
tf
.
logical_and
(
tf
.
greater
(
height
,
0
),
tf
.
greater
(
width
,
0
)))
return
indices
[:,
0
]
official/vision/detection/utils/input_utils.py
浏览文件 @
48693cad
...
...
@@ -362,13 +362,3 @@ def resize_and_crop_masks(masks,
def
random_horizontal_flip
(
image
,
boxes
=
None
,
masks
=
None
):
"""Randomly flips input image and bounding boxes."""
return
preprocessor
.
random_horizontal_flip
(
image
,
boxes
,
masks
)
def
get_non_empty_box_indices
(
boxes
):
"""Get indices for non-empty boxes."""
# Selects indices if box height or width is 0.
height
=
boxes
[:,
2
]
-
boxes
[:,
0
]
width
=
boxes
[:,
3
]
-
boxes
[:,
1
]
indices
=
tf
.
where
(
tf
.
logical_and
(
tf
.
greater
(
height
,
0
),
tf
.
greater
(
width
,
0
)))
return
indices
[:,
0
]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录