Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
46da7c45
O
oneflow
项目概览
Oneflow-Inc
/
oneflow
上一次同步 接近 3 年
通知
13
Star
2733
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oneflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46da7c45
编写于
12月 09, 2019
作者:
L
lixinqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tuple identity bugs
上级
6cc8e013
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
7 deletion
+40
-7
oneflow/core/data/coco_dataset.cpp
oneflow/core/data/coco_dataset.cpp
+3
-4
oneflow/core/kernel/piece_slice_kernel.cpp
oneflow/core/kernel/piece_slice_kernel.cpp
+4
-1
oneflow/core/kernel/tuple_identity_kernel.cpp
oneflow/core/kernel/tuple_identity_kernel.cpp
+12
-0
oneflow/core/kernel/tuple_identity_kernel.h
oneflow/core/kernel/tuple_identity_kernel.h
+2
-0
oneflow/python/model/maskrcnn/maskrcnn_train.py
oneflow/python/model/maskrcnn/maskrcnn_train.py
+9
-0
oneflow/python/ops/data_ops.py
oneflow/python/ops/data_ops.py
+10
-2
未找到文件。
oneflow/core/data/coco_dataset.cpp
浏览文件 @
46da7c45
...
...
@@ -140,12 +140,11 @@ void COCODataset::GetData(int64_t idx, DataInstance* data_inst) const {
auto
*
image_size_field
=
data_inst
->
GetField
<
DataSourceCase
::
kImageSize
>
();
auto
*
bbox_field
=
data_inst
->
GetField
<
DataSourceCase
::
kObjectBoundingBox
>
();
auto
*
label_field
=
data_inst
->
GetField
<
DataSourceCase
::
kObjectLabel
>
();
DataField
*
segm_field
=
nullptr
;
if
(
data_inst
->
HasField
<
DataSourceCase
::
kObjectSegmentationAlignedMask
>
())
{
DataField
*
segm_field
=
data_inst
->
GetField
<
DataSourceCase
::
kObjectSegmentation
>
();
if
(
segm_field
==
nullptr
&&
data_inst
->
HasField
<
DataSourceCase
::
kObjectSegmentationAlignedMask
>
())
{
segm_field
=
data_inst
->
GetOrCreateField
<
DataSourceCase
::
kObjectSegmentation
>
(
dataset_proto
().
coco
().
max_segm_poly_points
());
}
else
{
segm_field
=
data_inst
->
GetField
<
DataSourceCase
::
kObjectSegmentation
>
();
}
auto
*
bbox_list
=
dynamic_cast
<
TensorListDataField
<
float
>*>
(
bbox_field
);
if
(
bbox_list
!=
nullptr
)
{
bbox_list
->
SetShape
(
4
);
}
...
...
oneflow/core/kernel/piece_slice_kernel.cpp
浏览文件 @
46da7c45
...
...
@@ -25,7 +25,10 @@ class PieceSliceKernel final : public KernelIf<device_type> {
Blob
*
out_blob
=
BnInOp2Blob
(
"out_"
+
std
::
to_string
(
i
));
auto
out_tensor
=
out_blob
->
ReserveOneEmptyTensorList
();
out_blob
->
AddTensor
(
&
out_tensor
);
out_tensor
.
set_shape
(
in_tensor
.
shape
());
DimVector
dim_vec
;
in_tensor
.
shape
().
ToDimVector
(
&
dim_vec
);
dim_vec
.
erase
(
dim_vec
.
begin
());
out_tensor
.
set_shape
(
Shape
(
dim_vec
));
Memcpy
<
device_type
>
(
ctx
.
device_ctx
,
out_tensor
.
mut_dptr
(),
in_tensor
.
dptr
(),
in_tensor
.
ByteSize
());
in_blob
->
MoveToNextTensor
(
&
in_tensor
);
...
...
oneflow/core/kernel/tuple_identity_kernel.cpp
浏览文件 @
46da7c45
...
...
@@ -2,6 +2,18 @@
namespace
oneflow
{
template
<
DeviceType
device_type
>
void
TupleIdentityKernel
<
device_type
>::
ForwardHeader
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
{
const
auto
&
input_bns
=
this
->
op_attribute
().
input_bns
();
const
auto
&
output_bns
=
this
->
op_attribute
().
output_bns
();
CHECK_EQ
(
input_bns
.
size
(),
output_bns
.
size
());
FOR_RANGE
(
int
,
i
,
0
,
input_bns
.
size
())
{
Blob
*
out_blob
=
BnInOp2Blob
(
output_bns
.
Get
(
i
));
out_blob
->
CopyHeaderFrom
(
ctx
.
device_ctx
,
BnInOp2Blob
(
input_bns
.
Get
(
i
)));
}
}
template
<
DeviceType
device_type
>
void
TupleIdentityKernel
<
device_type
>::
ForwardDataContent
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
{
...
...
oneflow/core/kernel/tuple_identity_kernel.h
浏览文件 @
46da7c45
...
...
@@ -14,6 +14,8 @@ class TupleIdentityKernel final : public KernelIf<device_type> {
~
TupleIdentityKernel
()
=
default
;
private:
void
ForwardHeader
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
override
;
void
ForwardDataContent
(
const
KernelCtx
&
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
)
const
override
;
};
...
...
oneflow/python/model/maskrcnn/maskrcnn_train.py
浏览文件 @
46da7c45
...
...
@@ -513,6 +513,7 @@ if terminal_args.train_with_real_dataset:
random_seed
,
shuffle
,
group_by_aspect_ratio
,
max_segm_poly_points
=
1024
*
1024
,
)
data_loader
=
flow
.
data
.
DataLoader
(
coco
,
batch_size
,
batch_cache_size
)
data_loader
.
add_blob
(
...
...
@@ -544,6 +545,14 @@ if terminal_args.train_with_real_dataset:
tensor_list_variable_axis
=
0
,
is_dynamic
=
True
,
)
# data_loader.add_blob(
# "gt_segm_poly",
# data_util.DataSourceCase.kObjectSegmentation,
# shape=(64, 2, 256, 2),
# dtype=flow.double,
# tensor_list_variable_axis=0,
# is_dynamic=True,
# )
data_loader
.
add_blob
(
"gt_segm"
,
data_util
.
DataSourceCase
.
kObjectSegmentationAlignedMask
,
...
...
oneflow/python/ops/data_ops.py
浏览文件 @
46da7c45
...
...
@@ -223,11 +223,18 @@ class COCODataset(object):
random_seed
,
shuffle
=
True
,
group_by_aspect_ratio
=
True
,
max_segm_poly_points
=
1024
,
name
=
None
,
):
name
=
name
or
id_util
.
UniqueStr
(
"COCODataset_"
)
self
.
__dict__
.
update
(
locals
())
del
self
.
self
self
.
dataset_dir
=
dataset_dir
self
.
annotation_file
=
annotation_file
self
.
image_dir
=
image_dir
self
.
random_seed
=
random_seed
self
.
shuffle
=
shuffle
self
.
group_by_aspect_ratio
=
group_by_aspect_ratio
self
.
max_segm_poly_points
=
max_segm_poly_points
self
.
name
=
name
def
to_proto
(
self
,
proto
=
None
):
if
proto
is
None
:
...
...
@@ -240,6 +247,7 @@ class COCODataset(object):
proto
.
coco
.
annotation_file
=
self
.
annotation_file
proto
.
coco
.
image_dir
=
self
.
image_dir
proto
.
coco
.
group_by_aspect_ratio
=
self
.
group_by_aspect_ratio
proto
.
coco
.
max_segm_poly_points
=
self
.
max_segm_poly_points
return
proto
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录