@@ -14,8 +14,10 @@ using namespace nvinfer1;
14
14
namespace nvinfer1 {
15
15
16
16
int predictorDecode (int batchSize,
17
- const void *const *inputs, void **outputs, unsigned int num_boxes, unsigned int num_classes, unsigned int image_height,
18
- unsigned int image_width, const std::vector<float >& bbox_reg_weights, void *workspace, size_t workspace_size, cudaStream_t stream);
17
+ const void *const *inputs, void **outputs, unsigned int num_boxes,
18
+ unsigned int num_classes, unsigned int image_height,
19
+ unsigned int image_width, const std::vector<float >& bbox_reg_weights,
20
+ void *workspace, size_t workspace_size, cudaStream_t stream);
19
21
20
22
/*
21
23
input1: scores{N,C,1,1} N->nums C->num of classes
@@ -34,7 +36,7 @@ class PredictorDecodePlugin : public IPluginV2Ext {
34
36
std::vector<float > _bbox_reg_weights;
35
37
mutable int size = -1 ;
36
38
37
- protected:
39
+ protected:
38
40
void deserialize (void const * data, size_t length) {
39
41
const char * d = static_cast <const char *>(data);
40
42
read (d, _num_boxes);
@@ -51,7 +53,9 @@ class PredictorDecodePlugin : public IPluginV2Ext {
51
53
}
52
54
53
55
size_t getSerializationSize () const override {
54
- return sizeof (_num_boxes) + sizeof (_num_classes) + sizeof (_image_height) + sizeof (_image_width) + sizeof (size_t ) + sizeof (float )*_bbox_reg_weights.size ();
56
+ return sizeof (_num_boxes) + sizeof (_num_classes) +
57
+ sizeof (_image_height) + sizeof (_image_width) + sizeof (size_t ) +
58
+ sizeof (float )*_bbox_reg_weights.size ();
55
59
}
56
60
57
61
void serialize (void *buffer) const override {
@@ -66,14 +70,18 @@ class PredictorDecodePlugin : public IPluginV2Ext {
66
70
}
67
71
}
68
72
69
- public:
70
- PredictorDecodePlugin (unsigned int num_boxes, unsigned int image_height, unsigned int image_width, std::vector<float > const & bbox_reg_weights)
71
- : _num_boxes(num_boxes), _image_height(image_height), _image_width(image_width), _bbox_reg_weights(bbox_reg_weights) {}
73
+ public:
74
+ PredictorDecodePlugin (unsigned int num_boxes, unsigned int image_height,
75
+ unsigned int image_width, std::vector<float > const & bbox_reg_weights)
76
+ : _num_boxes(num_boxes), _image_height(image_height),
77
+ _image_width (image_width), _bbox_reg_weights(bbox_reg_weights) {}
72
78
73
- PredictorDecodePlugin (unsigned int num_boxes, unsigned int num_classes, unsigned int image_height, unsigned int image_width,
74
- std::vector<float > const & bbox_reg_weights)
75
- : _num_boxes(num_boxes), _num_classes(num_classes), _image_height(image_height), _image_width(image_width),
76
- _bbox_reg_weights (bbox_reg_weights) {}
79
+ PredictorDecodePlugin (unsigned int num_boxes, unsigned int num_classes,
80
+ unsigned int image_height, unsigned int image_width,
81
+ std::vector<float > const & bbox_reg_weights)
82
+ : _num_boxes(num_boxes), _num_classes(num_classes),
83
+ _image_height(image_height), _image_width(image_width),
84
+ _bbox_reg_weights(bbox_reg_weights) {}
77
85
78
86
PredictorDecodePlugin (void const * data, size_t length) {
79
87
this ->deserialize (data, length);
@@ -108,17 +116,19 @@ class PredictorDecodePlugin : public IPluginV2Ext {
108
116
109
117
size_t getWorkspaceSize (int maxBatchSize) const override {
110
118
if (size < 0 ) {
111
- size = predictorDecode (maxBatchSize, nullptr , nullptr , _num_boxes, _num_classes, _image_height, _image_width, _bbox_reg_weights,
112
- nullptr , 0 , nullptr );
119
+ size = predictorDecode (maxBatchSize, nullptr , nullptr ,
120
+ _num_boxes, _num_classes, _image_height, _image_width,
121
+ _bbox_reg_weights, nullptr , 0 , nullptr );
113
122
}
114
123
return size;
115
124
}
116
125
117
126
int enqueue (int batchSize,
118
127
const void *const *inputs, void **outputs,
119
128
void *workspace, cudaStream_t stream) override {
120
- return predictorDecode (batchSize, inputs, outputs, _num_boxes, _num_classes, _image_height, _image_width, _bbox_reg_weights,
121
- workspace, getWorkspaceSize (batchSize), stream);
129
+ return predictorDecode (batchSize, inputs, outputs, _num_boxes,
130
+ _num_classes, _image_height, _image_width, _bbox_reg_weights,
131
+ workspace, getWorkspaceSize (batchSize), stream);
122
132
}
123
133
124
134
void destroy () override {
@@ -166,7 +176,7 @@ class PredictorDecodePlugin : public IPluginV2Ext {
166
176
return new PredictorDecodePlugin (_num_boxes, _num_classes, _image_height, _image_width, _bbox_reg_weights);
167
177
}
168
178
169
- private:
179
+ private:
170
180
template <typename T> void write (char *& buffer, const T& val) const {
171
181
*reinterpret_cast <T*>(buffer) = val;
172
182
buffer += sizeof (T);
@@ -179,7 +189,7 @@ class PredictorDecodePlugin : public IPluginV2Ext {
179
189
};
180
190
181
191
class PredictorDecodePluginCreator : public IPluginCreator {
182
- public:
192
+ public:
183
193
PredictorDecodePluginCreator () {}
184
194
185
195
const char *getPluginName () const override {
0 commit comments