Detectnet Cost function Config

The tlt getting started, does not go into these params in detail - specific information on how they effect model training / performance will be helpful. This is from the cot function config use by detectnet:

The ones in the bold, I am unsure of and the default values given, but I would like to know their usecases exactly so I can have the best accuracy.

target_classes {
name: “cardboard”
class_weight: 1.0
coverage_foreground_weight: 0.0500000007451
objectives {
name: "cov"
initial_weight: 1.0
weight_target: 1.0
objectives {
name: "bbox"
initial_weight: 10.0
weight_target: 10.0

Refer to

1 Like

It does not explain how it affects training or on what concrete heuristics I should even define the value. It is extremely vague and provides no detail to me how I should set the params for my custom dataset:

How should I set class weight based off my custom dataset?
The same thing for initial weight and weight target? Right now it feels I am just using random values without any intelligent context behind those decisions.

The class weight is assigned to the corresponding target class’s cost. It can balance the training dataset for each class. Weights 10, 8, 6 are the same as 5, 4, 3 since the proportion of each class is the same for the two cases.

Some other tips from FAQ.

  • Distribute the dataset class: How do I balance the weight between classes if the dataset has significantly higher samples for one class versus another? To account for imbalance, increase the class_weight for classes with fewer samples. You can also try disabling enable_autoweighting; in this case initial_weight is used to control cov/regression weighting. It is important to keep the number of samples of different classes balanced, which helps improve mAP.

  • In DetectNet_V2, are there any parameters that can help improve AP (average precision) on training small objects? Following parameters can help you improve AP on smaller objects:

  • Increase num_layers of resnet

  • class_weight for small objects

  • Increase the coverage_radius_x and coverage_radius_y parameters of the bbox_rasterizer_config section for the small objects class

  • Decrease minimum_detection_ground_truth_overlap

  • Lower minimum_height to cover more small objects for evaluation.

1 Like