Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
Models
提交
ca8b7e92
M
Models
项目概览
MegEngine 天元
/
Models
通知
6
Star
3
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ca8b7e92
编写于
8月 19, 2020
作者:
J
Jianfeng Wang
提交者:
GitHub
8月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(detection): support Objects365 (#58)
上级
31a9096c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
101 addition
and
3 deletion
+101
-3
official/vision/detection/configs/faster_rcnn_res50_objects365_1x_800size.py
...ection/configs/faster_rcnn_res50_objects365_1x_800size.py
+47
-0
official/vision/detection/configs/retinanet_res50_objects365_1x_800size.py
...etection/configs/retinanet_res50_objects365_1x_800size.py
+47
-0
official/vision/detection/tools/inference.py
official/vision/detection/tools/inference.py
+5
-1
official/vision/detection/tools/test.py
official/vision/detection/tools/test.py
+1
-1
official/vision/detection/tools/utils.py
official/vision/detection/tools/utils.py
+1
-1
未找到文件。
official/vision/detection/configs/faster_rcnn_res50_objects365_1x_800size.py
0 → 100644
浏览文件 @
ca8b7e92
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from
official.vision.detection
import
models
class
CustomFasterRCNNConfig
(
models
.
FasterRCNNConfig
):
def
__init__
(
self
):
super
().
__init__
()
# ------------------------ data cfg -------------------------- #
self
.
train_dataset
=
dict
(
name
=
"objects365"
,
root
=
"train"
,
ann_file
=
"annotations/objects365_train_20190423.json"
,
remove_images_without_annotations
=
True
,
)
self
.
test_dataset
=
dict
(
name
=
"objects365"
,
root
=
"val"
,
ann_file
=
"annotations/objects365_val_20190423.json"
,
remove_images_without_annotations
=
False
,
)
self
.
num_classes
=
365
# ------------------------ training cfg ---------------------- #
self
.
nr_images_epoch
=
400000
def
faster_rcnn_res50_objects365_1x_800size
(
batch_size
=
1
,
**
kwargs
):
r
"""
Faster-RCNN FPN trained from Objects365 dataset.
`"Faster-RCNN" <https://arxiv.org/abs/1506.01497>`_
`"FPN" <https://arxiv.org/abs/1612.03144>`_
"""
cfg
=
CustomFasterRCNNConfig
()
cfg
.
backbone_pretrained
=
False
return
models
.
FasterRCNN
(
cfg
,
batch_size
=
batch_size
,
**
kwargs
)
Net
=
models
.
FasterRCNN
Cfg
=
CustomFasterRCNNConfig
official/vision/detection/configs/retinanet_res50_objects365_1x_800size.py
0 → 100644
浏览文件 @
ca8b7e92
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from
official.vision.detection
import
models
class
CustomRetinaNetConfig
(
models
.
RetinaNetConfig
):
def
__init__
(
self
):
super
().
__init__
()
# ------------------------ data cfg -------------------------- #
self
.
train_dataset
=
dict
(
name
=
"objects365"
,
root
=
"train"
,
ann_file
=
"annotations/objects365_train_20190423.json"
,
remove_images_without_annotations
=
True
,
)
self
.
test_dataset
=
dict
(
name
=
"objects365"
,
root
=
"val"
,
ann_file
=
"annotations/objects365_val_20190423.json"
,
remove_images_without_annotations
=
False
,
)
self
.
num_classes
=
365
# ------------------------ training cfg ---------------------- #
self
.
nr_images_epoch
=
400000
def
retinanet_res50_objects365_1x_800size
(
batch_size
=
1
,
**
kwargs
):
r
"""
RetinaNet trained from Objects365 dataset.
`"RetinaNet" <https://arxiv.org/abs/1708.02002>`_
`"FPN" <https://arxiv.org/abs/1612.03144>`_
"""
cfg
=
CustomRetinaNetConfig
()
cfg
.
backbone_pretrained
=
False
return
models
.
RetinaNet
(
cfg
,
batch_size
=
batch_size
,
**
kwargs
)
Net
=
models
.
RetinaNet
Cfg
=
CustomRetinaNetConfig
official/vision/detection/tools/inference.py
浏览文件 @
ca8b7e92
...
...
@@ -18,6 +18,7 @@ import megengine as mge
from
megengine
import
jit
from
megengine.data.dataset
import
COCO
from
official.vision.detection.tools.data_mapper
import
data_mapper
from
official.vision.detection.tools.utils
import
DetEvaluator
logger
=
mge
.
get_logger
(
__name__
)
...
...
@@ -61,7 +62,10 @@ def main():
model
.
inputs
[
"im_info"
].
set_value
(
im_info
)
pred_res
=
evaluator
.
predict
(
val_func
)
res_img
=
DetEvaluator
.
vis_det
(
ori_img
,
pred_res
,
is_show_label
=
True
,
classes
=
COCO
.
class_names
,
ori_img
,
pred_res
,
is_show_label
=
True
,
classes
=
data_mapper
[
cfg
.
test_dataset
[
"name"
]].
class_names
,
)
cv2
.
imwrite
(
"results.jpg"
,
res_img
)
...
...
official/vision/detection/tools/test.py
浏览文件 @
ca8b7e92
...
...
@@ -182,7 +182,7 @@ def worker(
result_queue
.
put_nowait
(
{
"det_res"
:
pred_res
,
"image_id"
:
int
(
data_dict
[
1
][
2
][
0
].
split
(
"."
)[
0
]),
"image_id"
:
int
(
data_dict
[
1
][
2
][
0
].
split
(
"."
)[
0
]
.
split
(
"_"
)[
-
1
]
),
}
)
...
...
official/vision/detection/tools/utils.py
浏览文件 @
ca8b7e92
...
...
@@ -242,7 +242,7 @@ class DetEvaluator:
dataset_class
.
class_names
[
int
(
box
[
5
])]
]
else
:
elem
[
"category_id"
]
=
int
(
box
[
5
])
elem
[
"category_id"
]
=
int
(
box
[
5
])
+
1
all_results
.
append
(
elem
)
return
all_results
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录