Fix route layer
This commit is contained in:
@@ -107,14 +107,14 @@ eval = val2017 (COCO)
|
|||||||
sample = 1920x1080 video
|
sample = 1920x1080 video
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE**: Used maintain-aspect-ratio=1 in config_infer file for YOLOv4 (with letter_box=1), YOLOv5 and YOLOR models.
|
**NOTE**: Used maintain-aspect-ratio=1 in config_infer file for Darknet (with letter_box=1) and PyTorch models.
|
||||||
|
|
||||||
#### NMS config
|
#### NMS config
|
||||||
|
|
||||||
- Eval
|
- Eval
|
||||||
|
|
||||||
```
|
```
|
||||||
nms-iou-threshold = 0.6 / 0.65 (YOLOv5, YOLOR, YOLOv7 PyTorch) / 0.7 (PP-YOLOE)
|
nms-iou-threshold = 0.6 (Darknet) / 0.65 (PyTorch) / 0.7 (Paddle)
|
||||||
pre-cluster-threshold = 0.001
|
pre-cluster-threshold = 0.001
|
||||||
topk = 300
|
topk = 300
|
||||||
```
|
```
|
||||||
@@ -122,7 +122,7 @@ topk = 300
|
|||||||
- Test
|
- Test
|
||||||
|
|
||||||
```
|
```
|
||||||
nms-iou-threshold = 0.45 / 0.7 (PP-YOLOE)
|
nms-iou-threshold = 0.45 / 0.7 (Paddle)
|
||||||
pre-cluster-threshold = 0.25
|
pre-cluster-threshold = 0.25
|
||||||
topk = 300
|
topk = 300
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ gie-unique-id=1
|
|||||||
process-mode=1
|
process-mode=1
|
||||||
network-type=0
|
network-type=0
|
||||||
cluster-mode=2
|
cluster-mode=2
|
||||||
maintain-aspect-ratio=0
|
maintain-aspect-ratio=1
|
||||||
parse-bbox-func-name=NvDsInferParseYolo
|
parse-bbox-func-name=NvDsInferParseYolo
|
||||||
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
|
custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
|
||||||
engine-create-func-name=NvDsInferYoloCudaEngineGet
|
engine-create-func-name=NvDsInferYoloCudaEngineGet
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ nvinfer1::ITensor* reorgLayer(
|
|||||||
slice1->setName(slice1LayerName.c_str());
|
slice1->setName(slice1LayerName.c_str());
|
||||||
|
|
||||||
nvinfer1::ISliceLayer *slice2 = network->addSlice(
|
nvinfer1::ISliceLayer *slice2 = network->addSlice(
|
||||||
*input, nvinfer1::Dims{3, {0, 0, 1}}, nvinfer1::Dims{3, {inputDims.d[0], inputDims.d[1] / 2, inputDims.d[2] / 2}},
|
*input, nvinfer1::Dims{3, {0, 1, 0}}, nvinfer1::Dims{3, {inputDims.d[0], inputDims.d[1] / 2, inputDims.d[2] / 2}},
|
||||||
nvinfer1::Dims{3, {1, 2, 2}});
|
nvinfer1::Dims{3, {1, 2, 2}});
|
||||||
assert(slice2 != nullptr);
|
assert(slice2 != nullptr);
|
||||||
std::string slice2LayerName = "slice2_" + std::to_string(layerIdx);
|
std::string slice2LayerName = "slice2_" + std::to_string(layerIdx);
|
||||||
slice2->setName(slice2LayerName.c_str());
|
slice2->setName(slice2LayerName.c_str());
|
||||||
|
|
||||||
nvinfer1::ISliceLayer *slice3 = network->addSlice(
|
nvinfer1::ISliceLayer *slice3 = network->addSlice(
|
||||||
*input, nvinfer1::Dims{3, {0, 1, 0}}, nvinfer1::Dims{3, {inputDims.d[0], inputDims.d[1] / 2, inputDims.d[2] / 2}},
|
*input, nvinfer1::Dims{3, {0, 0, 1}}, nvinfer1::Dims{3, {inputDims.d[0], inputDims.d[1] / 2, inputDims.d[2] / 2}},
|
||||||
nvinfer1::Dims{3, {1, 2, 2}});
|
nvinfer1::Dims{3, {1, 2, 2}});
|
||||||
assert(slice3 != nullptr);
|
assert(slice3 != nullptr);
|
||||||
std::string slice3LayerName = "slice3_" + std::to_string(layerIdx);
|
std::string slice3LayerName = "slice3_" + std::to_string(layerIdx);
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ nvinfer1::ITensor* routeLayer(
|
|||||||
layers += std::to_string(idxLayers[idxLayers.size() - 1]);
|
layers += std::to_string(idxLayers[idxLayers.size() - 1]);
|
||||||
|
|
||||||
if (concatInputs.size() == 1)
|
if (concatInputs.size() == 1)
|
||||||
return concatInputs[0];
|
output = concatInputs[0];
|
||||||
|
else {
|
||||||
int axis = 0;
|
int axis = 0;
|
||||||
if (block.find("axis") != block.end())
|
if (block.find("axis") != block.end())
|
||||||
axis = std::stoi(block.at("axis"));
|
axis = std::stoi(block.at("axis"));
|
||||||
@@ -60,6 +60,7 @@ nvinfer1::ITensor* routeLayer(
|
|||||||
concat->setName(concatLayerName.c_str());
|
concat->setName(concatLayerName.c_str());
|
||||||
concat->setAxis(axis);
|
concat->setAxis(axis);
|
||||||
output = concat->getOutput(0);
|
output = concat->getOutput(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (block.find("groups") != block.end())
|
if (block.find("groups") != block.end())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -304,6 +304,16 @@ NvDsInferStatus Yolo::buildYoloNetwork(std::vector<float>& weights, nvinfer1::IN
|
|||||||
else if (m_ConfigBlocks.at(i).at("type") == "reorg")
|
else if (m_ConfigBlocks.at(i).at("type") == "reorg")
|
||||||
{
|
{
|
||||||
std::string inputVol = dimsToString(previous->getDimensions());
|
std::string inputVol = dimsToString(previous->getDimensions());
|
||||||
|
if (m_NetworkType.find("yolov2") != std::string::npos) {
|
||||||
|
nvinfer1::IPluginV2* reorgPlugin = createReorgPlugin(2);
|
||||||
|
assert(reorgPlugin != nullptr);
|
||||||
|
nvinfer1::IPluginV2Layer* reorg = network.addPluginV2(&previous, 1, *reorgPlugin);
|
||||||
|
assert(reorg != nullptr);
|
||||||
|
std::string reorglayerName = "reorg_" + std::to_string(i);
|
||||||
|
reorg->setName(reorglayerName.c_str());
|
||||||
|
previous = reorg->getOutput(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
previous = reorgLayer(i, m_ConfigBlocks.at(i), previous, &network);
|
previous = reorgLayer(i, m_ConfigBlocks.at(i), previous, &network);
|
||||||
assert(previous != nullptr);
|
assert(previous != nullptr);
|
||||||
std::string outputVol = dimsToString(previous->getDimensions());
|
std::string outputVol = dimsToString(previous->getDimensions());
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ class Layers(object):
|
|||||||
self.fc.write('[net]\n' +
|
self.fc.write('[net]\n' +
|
||||||
'width=%d\n' % self.width +
|
'width=%d\n' % self.width +
|
||||||
'height=%d\n' % self.height +
|
'height=%d\n' % self.height +
|
||||||
'channels=3\n')
|
'channels=3\n' +
|
||||||
|
'letter_box=1\n')
|
||||||
|
|
||||||
def reorg(self):
|
def reorg(self):
|
||||||
self.blocks[self.current] += 1
|
self.blocks[self.current] += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user