Tlt spec file - cost function

For Detectnetv2 model retraining, there are several weight parameters specified in the cost_function_config in the spec file. I wish to retrain the pretrained resnet10 model for 5 class classification - person, car, bike, bicycle, truck and I wish to know more about these parameters - namely - class weight, bbox weight etc. so that I may add other classes based on that.

Hi neophyte1,
The cost function for auto_weighting enabled or disabled is not exactly the same.
I’m not sure the cost function can be pasted here since it is for NV internal for the time being.

Hi Morganh, I am not talking about the actual cost function used to train the model itself, but the parameters specified in the spec file

I want to know the meaning of the various parameters as the documentation is vague about them.
namely - class_weight, coverage_foreground_weight, initial_weight, weight_target etc. Since I need to add more classes to the the spec file(as mentioned above), I wish to have more clarity regarding these parameters as to what value should I give for the nee classes.

cost_function_config {
  target_classes {
    name: "car"
    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
    }
  }

Hi neophyte1,
Some meanings for parameters are as below.

initial_weight (float): Initial weight that will be assigned to this objective's cost.
weight_target (float): Target weight that will be assigned to this objective's cost.

class_weight (float): Weight assigned to this target class's cost (all objectives combined).
coverage_foreground_weight (float): Relative weight associated with the cost of cells where there is a foreground instance (i.e. the presence of what this TargetClass represents).Value should be in the range (0,1)
objectives (list): Each item is a cost_function_parameters.Objective instance which contains the cost configuration options for this target class's objectives.

Hi Morganh,
Thanks for the reply. Can you give me some go-to pointer as to how to decide on the weights when adding more classes ?

Another thing would be if I am getting too much false positives for a particular class, will tuning these weights would of any help?

You can refer to https://devtalk.nvidia.com/default/topic/1069397/transfer-learning-toolkit/detectnet-v2-18-layers-for-character-recognition-35-classes-/