lewes6369 / TensorRT-Yolov3

TensorRT for Yolov3
MIT License
489 stars 165 forks source link

About the yolo-det flow output size. #71

Closed zcc199710 closed 4 years ago

zcc199710 commented 4 years ago

First of all, thank you for your contribution to the open source community.,(I don't used all the code, only I use two plug-ins, Yolo and upsample.) When I don't have yolo-det layer, the yolov3 network will have three outputs: "yololayer 82-conv", "layer 94-conv", "layer 106-conv". Their sizes are 211313, 212626, 325252, respectively. I define the scale directly when I forward. Cuda Malloc (& buffers [output Index0], 1 OUTPUT_SIZE0 sizeof (float)); CUDA Malloc (& buffers [output Index1], 1 OUTPUT_SIZE1 sizeof (float); Cuda Malloc (& buffers [output Index 2], 1 OUTPUT_SIZE2 sizeof (float));

Context. enqueue (batchSize, buffers, stream, nullptr);

CudaMemcpyAsync (output 0, buffers [output index 0], batchSize OUTPUT_SIZE0 sizeof (float), cudaMemcpyDeviceToHost, stream);
CudaMemcpyAsync (output 1, buffers [output Index1], batchSize OUTPUT_SIZE1 sizeof (float), cudaMemcpyDeviceToHost, stream); CudaMemcpyAsync (output 2, buffers [output Index 2], batchSize OUTPUT_SIZE2 sizeof (float), cudaMemcpyDeviceToHost, stream);

Then you can copy their output in output 1, output 2, output 3. I want to know how to define my output size if the output layer is replaced by yolo-det, or whether it is reflected in your code. I have seen it for a long time, and I can see net. getoutputsize (), but I do not understand it. can you provite some blog or website about the form of output.
Thank you !

zcc199710 commented 4 years ago

find some code ,sorry , use this code can get the outputsize ,but i can't sure the output size is assert , ASSERT.

Dims dims = mTrtEngine->getBindingDimensions(i); DataType dtype = mTrtEngine->getBindingDataType(i); int64_t totalSize = volume(dims) mTrtBatchSize getElementSize(dtype); mTrtBindBufferSize[i] = totalSize; mTrtCudaBuffer[i] = safeCudaMalloc(totalSize); if(mTrtEngine->bindingIsInput(i)) mTrtInputCount++;