| | |
| | | void Detecter::setOutput(int type) |
| | | { |
| | | m_OutputTensors.clear(); |
| | | if(type==0) |
| | | for (int i = 0; i < 3; ++i) |
| | | printf("0-0-0-0-0-0------------------%d",type); |
| | | if(type==2) |
| | | for (int i = 0; i < 2; ++i) |
| | | { |
| | | TensorInfo outputTensor; |
| | | outputTensor.numClasses = CLASS_BUM; |
| | | outputTensor.blobName = "yolo_" + std::to_string(i); |
| | | outputTensor.gridSize = (m_InputH / 32) * pow(2, i); |
| | | outputTensor.grid_h = (m_InputH / 32) * pow(2, i); |
| | | outputTensor.grid_w = (m_InputW / 32) * pow(2, i); |
| | | outputTensor.stride = m_InputH / outputTensor.gridSize; |
| | | outputTensor.stride_h = m_InputH / outputTensor.grid_h; |
| | | outputTensor.stride_w = m_InputW / outputTensor.grid_w; |
| | | outputTensor.numBBoxes = 3; |
| | | outputTensor.volume = outputTensor.grid_h* outputTensor.grid_w |
| | | *(outputTensor.numBBoxes*(5 + outputTensor.numClasses)); |
| | | if(i==1) |
| | | { |
| | | outputTensor.masks.push_back(1); |
| | | outputTensor.masks.push_back(2); |
| | | outputTensor.masks.push_back(3); |
| | | } |
| | | if(i==0) |
| | | { |
| | | outputTensor.masks.push_back(3); |
| | | outputTensor.masks.push_back(4); |
| | | outputTensor.masks.push_back(5); |
| | | } |
| | | outputTensor.anchors.push_back(10); |
| | | outputTensor.anchors.push_back(14); |
| | | outputTensor.anchors.push_back(23); |
| | | outputTensor.anchors.push_back(27); |
| | | outputTensor.anchors.push_back(37); |
| | | outputTensor.anchors.push_back(58); |
| | | outputTensor.anchors.push_back(81); |
| | | outputTensor.anchors.push_back(82); |
| | | outputTensor.anchors.push_back(135); |
| | | outputTensor.anchors.push_back(169); |
| | | outputTensor.anchors.push_back(344); |
| | | outputTensor.anchors.push_back(319); |
| | | |
| | | if (m_ClassNames.empty()) |
| | | { |
| | | for (uint32_t j=0;j< outputTensor.numClasses;++j) |
| | | { |
| | | m_ClassNames.push_back(std::to_string(j)); |
| | | } |
| | | } |
| | | m_OutputTensors.push_back(outputTensor); |
| | | } |
| | | else |
| | | for (int i = 0; i < 3; ++i) |
| | | { |
| | | TensorInfo outputTensor; |
| | | outputTensor.numClasses = CLASS_BUM; |
| | | outputTensor.blobName = "yolo_" + to_string(i); |
| | | // if (i==0) |
| | | // { |
| | | // outputTensor.blobName = "139_convolutional_reshape_2"; |
| | | // }else if (i==1) |
| | | // { |
| | | // outputTensor.blobName = "150_convolutional_reshape_2"; |
| | | // }else if (i==2) |
| | | // { |
| | | // outputTensor.blobName = "161_convolutional_reshape_2"; |
| | | // } |
| | | outputTensor.gridSize = (m_InputH / 32) * pow(2, 2-i); |
| | | outputTensor.grid_h = (m_InputH / 32) * pow(2, 2-i); |
| | | outputTensor.grid_w = (m_InputW / 32) * pow(2, 2-i); |
| | |
| | | outputTensor.anchors.push_back(243); |
| | | outputTensor.anchors.push_back(459); |
| | | outputTensor.anchors.push_back(401); |
| | | |
| | | if (m_ClassNames.empty()) |
| | | { |
| | | for (uint32_t j=0;j< outputTensor.numClasses;++j) |
| | | { |
| | | m_ClassNames.push_back(std::to_string(j)); |
| | | } |
| | | } |
| | | m_OutputTensors.push_back(outputTensor); |
| | | } |
| | | else |
| | | for (int i = 0; i < 2; ++i) |
| | | { |
| | | |
| | | TensorInfo outputTensor; |
| | | outputTensor.numClasses = CLASS_BUM; |
| | | outputTensor.blobName = "yolo_" + std::to_string(i); |
| | | outputTensor.gridSize = (m_InputH / 32) * pow(2, i); |
| | | outputTensor.grid_h = (m_InputH / 32) * pow(2, i); |
| | | outputTensor.grid_w = (m_InputW / 32) * pow(2, i); |
| | | outputTensor.stride = m_InputH / outputTensor.gridSize; |
| | | outputTensor.stride_h = m_InputH / outputTensor.grid_h; |
| | | outputTensor.stride_w = m_InputW / outputTensor.grid_w; |
| | | outputTensor.numBBoxes = 3; |
| | | outputTensor.volume = outputTensor.grid_h* outputTensor.grid_w |
| | | *(outputTensor.numBBoxes*(5 + outputTensor.numClasses)); |
| | | if(i==1) |
| | | { |
| | | outputTensor.masks.push_back(1); |
| | | outputTensor.masks.push_back(2); |
| | | outputTensor.masks.push_back(3); |
| | | } |
| | | if(i==0) |
| | | { |
| | | outputTensor.masks.push_back(3); |
| | | outputTensor.masks.push_back(4); |
| | | outputTensor.masks.push_back(5); |
| | | } |
| | | outputTensor.anchors.push_back(10); |
| | | outputTensor.anchors.push_back(14); |
| | | outputTensor.anchors.push_back(23); |
| | | outputTensor.anchors.push_back(27); |
| | | outputTensor.anchors.push_back(37); |
| | | outputTensor.anchors.push_back(58); |
| | | outputTensor.anchors.push_back(81); |
| | | outputTensor.anchors.push_back(82); |
| | | outputTensor.anchors.push_back(135); |
| | | outputTensor.anchors.push_back(169); |
| | | outputTensor.anchors.push_back(344); |
| | | outputTensor.anchors.push_back(319); |
| | | |
| | | if (m_ClassNames.empty()) |
| | | { |