Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support centernet dev1.x #1219

Merged
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3435296
support centernet head
hanrui1sensetime Oct 18, 2022
756fa08
add centernet head ut
hanrui1sensetime Oct 18, 2022
96644a3
add centernet
hanrui1sensetime Oct 18, 2022
fe97bd1
add centernet
hanrui1sensetime Oct 18, 2022
2f20161
add support models
hanrui1sensetime Oct 18, 2022
b23ab0f
fix mdformat
hanrui1sensetime Oct 19, 2022
3bd715f
fix reg test
hanrui1sensetime Oct 19, 2022
ba46743
fix scale
hanrui1sensetime Oct 19, 2022
6004ea6
fix conflicts
hanrui1sensetime Oct 24, 2022
fecd330
fix test.py show_dir kwargs
hanrui1sensetime Oct 31, 2022
77fec5c
fix for profile in T4
hanrui1sensetime Oct 31, 2022
d042cf8
fix dynamic shape
hanrui1sensetime Nov 1, 2022
adbf53e
fix lint
hanrui1sensetime Nov 1, 2022
3a53adc
move rescale and border to outside
hanrui1sensetime Nov 2, 2022
5269e8f
fix ut
hanrui1sensetime Nov 2, 2022
58755e1
fix lint
hanrui1sensetime Nov 2, 2022
a18754b
update ort torchscript benchmark
hanrui1sensetime Nov 2, 2022
9314817
fix centernet
hanrui1sensetime Nov 3, 2022
94cf03c
fix ut
hanrui1sensetime Nov 3, 2022
5ee8bd8
remove unused file
hanrui1sensetime Nov 4, 2022
1d49368
support centernet sdk
hanrui1sensetime Nov 7, 2022
b772d66
remove unused rewriter
hanrui1sensetime Nov 7, 2022
4621aa5
fix lint
hanrui1sensetime Nov 7, 2022
0cd31a8
fix flake8
hanrui1sensetime Nov 7, 2022
ce16874
remove unused line
hanrui1sensetime Nov 8, 2022
f034022
fix lint
hanrui1sensetime Nov 8, 2022
0cd10e3
fix lint
hanrui1sensetime Nov 8, 2022
deec016
fix conflict
hanrui1sensetime Nov 8, 2022
8e8706b
fix doc links
hanrui1sensetime Nov 8, 2022
ab8ce5a
fix mdformat
hanrui1sensetime Nov 8, 2022
22a0069
fix scale_factor as default
hanrui1sensetime Nov 8, 2022
7208924
fix conflict of docs
hanrui1sensetime Nov 9, 2022
106a5f9
apart random pad and pad
hanrui1sensetime Nov 9, 2022
e6d4d6c
fix sdk
hanrui1sensetime Nov 9, 2022
29c0bb1
fix centernet docs
hanrui1sensetime Nov 10, 2022
dc6694e
fix code style of cpp
hanrui1sensetime Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_base_ = [
'../_base_/base_dynamic.py', '../../_base_/backends/tensorrt-fp16.py'
]

backend_config = dict(
common_config=dict(max_workspace_size=1 << 30),
model_inputs=[
dict(
input_shapes=dict(
input=dict(
min_shape=[1, 3, 64, 64],
opt_shape=[1, 3, 800, 800],
max_shape=[1, 3, 800, 800])))
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_base_ = [
'../_base_/base_dynamic.py', '../../_base_/backends/tensorrt-int8.py'
]

backend_config = dict(
common_config=dict(max_workspace_size=1 << 30),
model_inputs=[
dict(
input_shapes=dict(
input=dict(
min_shape=[1, 3, 64, 64],
opt_shape=[1, 3, 800, 800],
max_shape=[1, 3, 800, 800])))
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
_base_ = ['../_base_/base_dynamic.py', '../../_base_/backends/tensorrt.py']

backend_config = dict(
common_config=dict(max_workspace_size=1 << 30),
model_inputs=[
dict(
input_shapes=dict(
input=dict(
min_shape=[1, 3, 64, 64],
opt_shape=[1, 3, 800, 800],
max_shape=[1, 3, 800, 800])))
])
4 changes: 4 additions & 0 deletions csrc/mmdeploy/codebase/mmdet/object_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ Result<Detections> ResizeBBox::GetBBoxes(const Value& prep_res, const Tensor& de

float w_offset = 0.f;
float h_offset = 0.f;
if (prep_res.contains("border")) {
w_offset = -prep_res["border"][1].get<int>();
h_offset = -prep_res["border"][0].get<int>();
}
int ori_width = prep_res["ori_shape"][2].get<int>();
int ori_height = prep_res["ori_shape"][1].get<int>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Result<Value> DefaultFormatBundleImpl::Process(const Value& input) {
}
}
if (!output.contains("scale_factor")) {
output["scale_factor"].push_back(1.0);
for (int i = 0; i < 4; ++i) output["scale_factor"].push_back(1.0);
hanrui1sensetime marked this conversation as resolved.
Show resolved Hide resolved
}
if (!output.contains("img_norm_cfg")) {
int channel = tensor.shape()[3];
Expand Down
15 changes: 15 additions & 0 deletions csrc/mmdeploy/preprocess/transform/pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ PadImpl::PadImpl(const Value& args) : TransformImpl(args) {
} else {
arg_.pad_val = 0.0f;
}
if (args.contains("logical_or_val")) {
// logical_or mode support.
arg_.logical_or_val = args["logical_or_val"].get<int>();
arg_.add_pix_val = args.value("add_pix_val", 0);
}
arg_.pad_to_square = args.value("pad_to_square", false);
arg_.padding_mode = args.value("padding_mode", std::string("constant"));
arg_.orientation_agnostic = args.value("orientation_agnostic", false);
Expand Down Expand Up @@ -80,6 +85,16 @@ Result<Value> PadImpl::Process(const Value& input) {
output["pad_size_divisor"] = arg_.size_divisor;
output["pad_fixed_size"].push_back(pad_h);
output["pad_fixed_size"].push_back(pad_w);
} else if (arg_.logical_or_val > 0) {
int pad_h = (height | arg_.logical_or_val) + arg_.add_pix_val;
int pad_w = (width | arg_.logical_or_val) + arg_.add_pix_val;
int offset_h = pad_h / 2 - height / 2;
int offset_w = pad_w / 2 - width / 2;
padding = {offset_w, offset_h, pad_w - width - offset_w, pad_h - height - offset_h};
output["border"].push_back(offset_h);
output["border"].push_back(offset_w);
output["border"].push_back(offset_h + height);
output["border"].push_back(offset_w + width);
} else {
output_tensor = tensor;
output["pad_fixed_size"].push_back(height);
Expand Down
2 changes: 2 additions & 0 deletions csrc/mmdeploy/preprocess/transform/pad.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class MMDEPLOY_API PadImpl : public TransformImpl {
protected:
struct pad_arg_t {
std::array<int, 2> size;
int logical_or_val;
int add_pix_val;
int size_divisor;
float pad_val;
bool pad_to_square;
Expand Down
14 changes: 14 additions & 0 deletions docs/en/03-benchmark/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,20 @@ Users can directly test the performance through [how_to_evaluate_a_model.md](../
<td align="center">37.4</td>
<td align="center">-</td>
</tr>
<tr>
<td align="center"><a href="https://github.com/open-mmlab/mmdetection/tree/3.x/configs/centernet/centernet_r18_8xb16-crop512-140e_coco.py">CenterNet</a></td>
<td align="center">Object Detection</td>
<td align="center">COCO2017</td>
<td align="center">box AP</td>
<td align="center">25.9</td>
<td align="center">26.0</td>
<td align="center">26.0</td>
<td align="center">26.0</td>
<td align="center">25.8</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<td align="center"><a href="https://github.com/open-mmlab/mmdetection/tree/master/configs/yolox/yolox_s_8x8_300e_coco.py">YOLOX</a></td>
<td align="center">Object Detection</td>
Expand Down
Loading