I’ve successfully trained a custom model and integrated it into the detectnet-camera project (https://github.com/dusty-nv/jetson-inference/tree/master/detectnet-camera)
I am now trying to add “custom” boxes to the camera frames in addition to the bounding boxes from the model inferencing, but my custom boxes are not showing up.
Below is a list of modifications I made to accomplish my desired goal. What am I missing? Thanks!
In detectnet-camera.cpp:
float* targetBoxColorCPU = NULL;
float* targetBoxColorCUDA = NULL;
if( !cudaAllocMapped((void**)&targetBoxCPU, (void**)&targetBoxCUDA, sizeof(float4)) ||
!cudaAllocMapped((void**)&targetBoxColorCPU, (void**)&targetBoxColorCUDA, sizeof(float4)) )
{
printf("detectnet-console: failed to alloc output memory\n");
return 0;
}
//
// after net->Detect(...) if block
//
targetBoxCPU[0] = 410.0f;
targetBoxCPU[1] = 60.0f;
targetBoxCPU[2] = 1000.0f;
targetBoxCPU[3] = 530.0f;
targetBoxColorCPU[0] = 250.0f;
targetBoxColorCPU[1] = 0.0f;
targetBoxColorCPU[2] = 0.0f;
targetBoxColorCPU[3] = 100.0f;
if( !net->DrawTargetBox((float*)imgRGBA, (float*)imgRGBA, camera->GetWidth(), camera->GetHeight(), targetBoxCUDA, targetBoxColorCUDA, 1) )
printf("detect-console: failed to draw target boxes\n");
CUDA(cudaDeviceSynchronize());
in detectNet.cpp
// DrawTargetBox
bool detectNet::DrawTargetBox( float* input, float* output, uint32_t width, uint32_t height, const float* targetBoxes, const float* targetBoxColor, int numBoxes)
{
if( !input || !output || width == 0 || height == 0 || !targetBoxes || !targetBoxColor || numBoxes < 1)
return false;
if( CUDA_FAILED(cudaRectOutlineOverlay((float4*)input, (float4*)output, width, height, (float4*)targetBoxes, numBoxes, (float&)targetBoxColor)) )
return false;
return true;
}