New features
- Added support for INT8 calibration - Added support for non square models - Updated mAP comparison between models
This commit is contained in:
@@ -52,7 +52,7 @@ void read(const char*& buffer, T& val)
|
||||
|
||||
cudaError_t cudaYoloLayer (
|
||||
const void* input, void* output, const uint& batchSize,
|
||||
const uint& gridSize, const uint& numOutputClasses,
|
||||
const uint& gridSizeX, const uint& gridSizeY, const uint& numOutputClasses,
|
||||
const uint& numBBoxes, uint64_t outputSize, cudaStream_t stream, const uint modelCoords, const float modelScale, const uint modelType);
|
||||
|
||||
YoloLayer::YoloLayer (const void* data, size_t length)
|
||||
@@ -60,7 +60,8 @@ YoloLayer::YoloLayer (const void* data, size_t length)
|
||||
const char *d = static_cast<const char*>(data);
|
||||
read(d, m_NumBoxes);
|
||||
read(d, m_NumClasses);
|
||||
read(d, m_GridSize);
|
||||
read(d, m_GridSizeX);
|
||||
read(d, m_GridSizeY);
|
||||
read(d, m_OutputSize);
|
||||
|
||||
read(d, m_type);
|
||||
@@ -94,10 +95,11 @@ YoloLayer::YoloLayer (const void* data, size_t length)
|
||||
};
|
||||
|
||||
YoloLayer::YoloLayer (
|
||||
const uint& numBoxes, const uint& numClasses, const uint& gridSize, const uint model_type, const uint new_coords, const float scale_x_y, const float beta_nms, const std::vector<float> anchors, std::vector<std::vector<int>> mask) :
|
||||
const uint& numBoxes, const uint& numClasses, const uint& gridSizeX, const uint& gridSizeY, const uint model_type, const uint new_coords, const float scale_x_y, const float beta_nms, const std::vector<float> anchors, std::vector<std::vector<int>> mask) :
|
||||
m_NumBoxes(numBoxes),
|
||||
m_NumClasses(numClasses),
|
||||
m_GridSize(gridSize),
|
||||
m_GridSizeX(gridSizeX),
|
||||
m_GridSizeY(gridSizeY),
|
||||
m_type(model_type),
|
||||
m_new_coords(new_coords),
|
||||
m_scale_x_y(scale_x_y),
|
||||
@@ -107,8 +109,9 @@ YoloLayer::YoloLayer (
|
||||
{
|
||||
assert(m_NumBoxes > 0);
|
||||
assert(m_NumClasses > 0);
|
||||
assert(m_GridSize > 0);
|
||||
m_OutputSize = m_GridSize * m_GridSize * (m_NumBoxes * (4 + 1 + m_NumClasses));
|
||||
assert(m_GridSizeX > 0);
|
||||
assert(m_GridSizeY > 0);
|
||||
m_OutputSize = m_GridSizeX * m_GridSizeY * (m_NumBoxes * (4 + 1 + m_NumClasses));
|
||||
};
|
||||
|
||||
nvinfer1::Dims
|
||||
@@ -142,7 +145,7 @@ int YoloLayer::enqueue(
|
||||
cudaStream_t stream)
|
||||
{
|
||||
CHECK(cudaYoloLayer(
|
||||
inputs[0], outputs[0], batchSize, m_GridSize, m_NumClasses, m_NumBoxes,
|
||||
inputs[0], outputs[0], batchSize, m_GridSizeX, m_GridSizeY, m_NumClasses, m_NumBoxes,
|
||||
m_OutputSize, stream, m_new_coords, m_scale_x_y, m_type));
|
||||
return 0;
|
||||
}
|
||||
@@ -161,7 +164,7 @@ size_t YoloLayer::getSerializationSize() const
|
||||
}
|
||||
}
|
||||
|
||||
return sizeof(m_NumBoxes) + sizeof(m_NumClasses) + sizeof(m_GridSize) + sizeof(m_OutputSize) + sizeof(m_type)
|
||||
return sizeof(m_NumBoxes) + sizeof(m_NumClasses) + sizeof(m_GridSizeX) + sizeof(m_GridSizeY) + sizeof(m_OutputSize) + sizeof(m_type)
|
||||
+ sizeof(m_new_coords) + sizeof(m_scale_x_y) + sizeof(m_beta_nms) + anchorsSum * sizeof(float) + maskSum * sizeof(int);
|
||||
}
|
||||
|
||||
@@ -170,7 +173,8 @@ void YoloLayer::serialize(void* buffer) const
|
||||
char *d = static_cast<char*>(buffer);
|
||||
write(d, m_NumBoxes);
|
||||
write(d, m_NumClasses);
|
||||
write(d, m_GridSize);
|
||||
write(d, m_GridSizeX);
|
||||
write(d, m_GridSizeY);
|
||||
write(d, m_OutputSize);
|
||||
|
||||
write(d, m_type);
|
||||
@@ -199,7 +203,7 @@ void YoloLayer::serialize(void* buffer) const
|
||||
|
||||
nvinfer1::IPluginV2* YoloLayer::clone() const
|
||||
{
|
||||
return new YoloLayer (m_NumBoxes, m_NumClasses, m_GridSize, m_type, m_new_coords, m_scale_x_y, m_beta_nms, m_Anchors, m_Mask);
|
||||
return new YoloLayer (m_NumBoxes, m_NumClasses, m_GridSizeX, m_GridSizeY, m_type, m_new_coords, m_scale_x_y, m_beta_nms, m_Anchors, m_Mask);
|
||||
}
|
||||
|
||||
REGISTER_TENSORRT_PLUGIN(YoloLayerPluginCreator);
|
||||
Reference in New Issue
Block a user