How to draw simple bounding boxes and detect only person using Jetson Inference

Dear Sir,

I am using Jetson Inference (detectnet) for object detection by @dusty_nv sir
I want to detect only humans and also draw simple rectangular boxes (also control its color)
I am not getting the right code where I can change.

I am making AI based social distance compliance which detects humans and then calculates distance and accordingly makes the alert.

Please help.

Thank you

Hi,

You can check the source code here:

You can filter the output by checking the desired class ID and assign the bounding box color here:

void detectNet::SetClassColor( uint32_t classIndex, float r, float g, float b, float a )
{
	if( classIndex >= GetNumClasses() || !mClassColors[0] )
		return;
	
	const uint32_t i = classIndex * 4;
	
	mClassColors[0][i+0] = r;
	mClassColors[0][i+1] = g;
	mClassColors[0][i+2] = b;
	mClassColors[0][i+3] = a;
}

Thanks.

Thank you for your help.
But nothing concrete came out of it.

  1. I am using pednet
  2. I have to detect all pedestrians in a frame and then calculate distance between then (for covid social distancing)
  3. The people who are not following the social distancing should enclosed in red bounding box.

I changed the following
mClassColors[0][0] = r;
mClassColors[0][0] = r;
mClassColors[0][0] = r;
mClassColors[0][0] = r;

But there was no change when I ran my python file.

Even after removing the entire script(detectnet.cpp), the python file worked perfectly (isn’t that amazing).

Please find python file below

Please help @dusty_nv

Hi,

Have you recompiled it after the change?
If not, would you mind to try it?

Thanks.