1
// Tencent is pleased to support the open source community by making ncnn available.
3
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
5
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6
// in compliance with the License. You may obtain a copy of the License at
8
// https://opensource.org/licenses/BSD-3-Clause
10
// Unless required by applicable law or agreed to in writing, software distributed
11
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
// specific language governing permissions and limitations under the License.
17
static int test_priorbox_caffe()
19
ncnn::Mat min_sizes(1);
22
ncnn::Mat max_sizes(1);
25
ncnn::Mat aspect_ratios(2);
26
aspect_ratios[0] = 2.f;
27
aspect_ratios[1] = 3.f;
32
pd.set(2, aspect_ratios);
33
pd.set(3, 0.1f); // variances[0]
34
pd.set(4, 0.1f); // variances[1]
35
pd.set(5, 0.2f); // variances[2]
36
pd.set(6, 0.2f); // variances[3]
39
pd.set(9, -233); // image_width
40
pd.set(10, -233); // image_height
41
pd.set(11, -233.f); // step_width
42
pd.set(12, -233.f); // step_height
43
pd.set(13, 0.f); // offset
44
pd.set(14, 0.f); // step_mmdetection
45
pd.set(15, 0.f); // center_mmdetection
47
std::vector<ncnn::Mat> weights(0);
49
std::vector<ncnn::Mat> as(2);
50
as[0] = RandomMat(72, 72, 1);
51
as[1] = RandomMat(512, 512, 1);
53
int ret = test_layer("PriorBox", pd, weights, as, 1);
56
fprintf(stderr, "test_priorbox_caffe failed\n");
62
static int test_priorbox_mxnet()
64
ncnn::Mat min_sizes(2);
66
min_sizes[1] = 0.2121f;
68
ncnn::Mat max_sizes(0);
70
ncnn::Mat aspect_ratios(5);
71
aspect_ratios[0] = 1.f;
72
aspect_ratios[1] = 2.f;
73
aspect_ratios[2] = 0.5f;
74
aspect_ratios[3] = 3.f;
75
aspect_ratios[4] = 0.333333;
80
pd.set(2, aspect_ratios);
81
pd.set(3, 0.1f); // variances[0]
82
pd.set(4, 0.1f); // variances[1]
83
pd.set(5, 0.2f); // variances[2]
84
pd.set(6, 0.2f); // variances[3]
87
pd.set(9, -233); // image_width
88
pd.set(10, -233); // image_height
89
pd.set(11, -233.f); // step_width
90
pd.set(12, -233.f); // step_height
91
pd.set(13, 0.5f); // offset
92
pd.set(14, 0.f); // step_mmdetection
93
pd.set(15, 0.f); // center_mmdetection
95
std::vector<ncnn::Mat> weights(0);
97
std::vector<ncnn::Mat> as(1);
98
as[0] = RandomMat(72, 72, 1);
100
int ret = test_layer("PriorBox", pd, weights, as, 1);
103
fprintf(stderr, "test_priorbox_mxnet failed\n");
114
|| test_priorbox_caffe()
115
|| test_priorbox_mxnet();