Hi,
I define three plugin type layers.
one of the plugin is like
layer {
name: "p5/upsample"
type: "IPlugin"
bottom: "p5/reduce"
top: "p5/upsample"
}
and one of the plugin is like
layer {
name: "roi_pooling"
type: "IPlugin"
bottom: "p2"
bottom: "p3"
bottom: "p4"
bottom: "p5"
bottom: "all_rois"
bottom: "all_scores"
top: "all_roi_pooling"
}
but when creating the plugin, the roi_pooling plugin layer is omitted by pluginFactory.
class PluginFactory : public nvinfer1::IPluginFactory, public nvcaffeparser1::IPluginFactory
{
public:
// deserialization plugin implementation
virtual nvinfer1::IPlugin* createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights) override
{
LOG(INFO) << "createPlugin " << layerName; // this prints both upsample and roi_pooling plugin
assert(isPlugin(layerName));
// create the instance here
}
IPlugin* createPlugin(const char* layerName, const void* serialData, size_t serialLength) override
{
LOG(INFO) << "createPlugin " << layerName; // this prints only upsample plugin
assert(isPlugin(layerName));
// create the instance here
}
}
Moreover, when calling serialize by gie engine.
like
gieModelStream = engine->serialize();
the roi pooling plugin does not execute plugin API configure, getWorkSpace and initialize.
for example
template<typename Dtype>
class ROIPool: public IPlugin {
public:
ROIPool(int proposal_limit, vector<float> scales, int base_roi_scale, int pool_h, int pool_w, float rpn_nms_thresh)
{
int getNbOutputs() const override
{
LOG(INFO) << "ROIPool getNbOutputs"; // got executed
return 1;
}
Dims getOutputDimensions(int index, const Dims* inputs, int nbInputDims) override
{
LOG(INFO) << "roi pool getOutputDimensions"; // got executed
CHECK(nbInputDims == 6);
CHECK(inputs[0].nbDims == 3);
CHECK(inputs[1].nbDims == 3);
CHECK(inputs[2].nbDims == 3);
CHECK(inputs[3].nbDims == 3);
// rois
CHECK(inputs[4].nbDims == 2);
// scores
CHECK(inputs[5].nbDims == 2);
CHECK(inputs[4].d[0] == inputs[5].d[0]);
CHECK(index == 0);
LOG(INFO) << "proposal_limit " << proposal_limit_;
return Dims4(proposal_limit_, inputs[0].d[0], pooled_height_, pooled_width_);
}
void configure(const Dims*inputs, int nbInputs, const Dims* outputs, int nbOutputs, int) override
{
LOG(INFO) << "roi pool configure"; // not executed
for (int i = 0; i < nbInputs - 2; i++) {
height_.push_back(inputs[i].d[1]);
width_.push_back(inputs[i].d[2]);
}
num_rois_ = inputs[4].d[0];
channels_ = inputs[0].d[0];
output_count_ = channels_ * pooled_height_ * pooled_width_;
}
virtual size_t getWorkspaceSize(int maxBatchSize) const override
{
LOG(INFO) << "roi pool getWorkspaceSize"; // not executed
return 0;
}
int initialize() override
{
LOG(INFO) << "ROIPool initialize"; // not executed
return 0;
}
}
Any idea?