Color Detection with Deepstream

• Hardware Platform (Jetson / GPU) Jetson/TX2
• DeepStream Version 5.0-GA
• JetPack Version (valid for Jetson only) JP-4.5
**• DeepStream Version ** DS-5.0
• TensorRT Version 7.X
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ?
• Requirement details

Hi, we would like to detect colors of persons detected by PeopleNet or similar models.

Have you something that could be used to detect color of persons ?

Probably there could be some algorithm based on openCV … or some Deepstream model to be used as an engine so as a [SecondaryGie]

Let’s know,
m.

Hi,

You can retrain a model for your custom usage.
We have a training toolkit called TAO as below:

Thanks.

Sorry, not clear.
I took a look to TAO toolkit but I cannot see part referring to color-detection, but it could be I misunderstood suggestion.

Are you suggesting to use TAO toolkit to retrain a people model with some color dataset, to get colors and persons detected ?
Were can I find a color dataset ?

May you suggest a specific link from TAO or everything else, referring to this retraining operation for color-detection ?

thanks,
M.

Hi @mgalimberti
In opencv you can perform color detection operations by defining the color gradient value.

In deepstream, you can take reference from the deepstream-test2 for color detection.
deepstream-test2 has an example for vehicle color classifier, the config for which are defined in dstest2_sgie1_config.txt.
You can also use the color gradient method in deepstream app, but the color gradient method is very inaccurate and is largely affected by shadow and lighting.

deepatream_test2 was run and got vehicle and color recognized, …
but it is not clear how the application is mapping below colors

/* These are the strings of the labels for the respective models */
    gchar sgie1_classes_str[12][32] = { “black”, “blue”, “brown”, “gold”, “green”,
   “grey”, “maroon”, “orange”, “red”, “silver”, “white”, “yellow”
};

also tried to take a look to metadata include files starting from gstnvdsmeta.h
but not found the part referring color …

So question: in which metadata structure is sgie1 setting color information ?
I would like to extract color information using something like below code
thanks,

	for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
		  l_frame = l_frame->next) 
	{
		NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
		int offset = 0;
		for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
				l_obj = l_obj->next) 
		{
						
			obj_meta = (NvDsObjectMeta *) (l_obj->data);
			g_print("OBJECT_ID ----- %d \n", obj_meta->object_id);
			if (obj_meta->class_id == PGIE_CLASS_ID_VEHICLE) {
				vehicle_count++;
				num_rects++;
		}
		if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
				person_count++;
				num_rects++;
			}
		}
		display_meta = nvds_acquire_display_meta_from_pool(batch_meta);
		NvOSD_TextParams *txt_params  = &display_meta->text_params[0];
		display_meta->num_labels = 1;
		txt_params->display_text = g_malloc0 (MAX_DISPLAY_LEN);
		offset = snprintf(txt_params->display_text, MAX_DISPLAY_LEN, "Person = %d ", person_count);
		offset = snprintf(txt_params->display_text + offset , MAX_DISPLAY_LEN, "Vehicle = %d .... color= %s ", vehicle_count, .....   );

Hi,

Sorry that we don’t have a related custom database.
Once you have found/collect data, TAO can help you to retrain a model for your usecase.

Thanks.