Tao toolkit training yolov4 model, YoloV3Datasetconfig has no field named "class_weighting_config" error

Please provide the following information when requesting support.

• Hardware (T4/V100/Xavier/Nano/etc)
• Network Type (Detectnet_v2/Faster_rcnn/Yolo_v4/LPRnet/Mask_rcnn/Classification/etc)
• TLT Version (Please run “tlt info --verbose” and share “docker_tag” here)
• Training spec file(If have, please share here)
• How to reproduce the issue ? (This is for errors. Please share the command line and the detailed log here.)

RTX3090 , ubuntu18.04 ,tao info! :
format_version 2.0
toolkit_version 3.22.05
published_date 05/25/2022

i tried to train yolov4 model as followed with the instructions of tao toolkit, however, when i made the config of class_weighting_config in training spec .*txt format, the spec zip file is downloaded from the website of toolkit as well, the training log popped the errors like :

Message type “YOLOv3DatasetConfig” has no field named “class_weighting_config”, it is so weird, i am sure that i referred to the correct spec file which is located on the yolov4 folder…

here is i read from website

Class Weighting Config
YOLOV4 supports class-level weighting on the loss function during training. The following is an example of the class weighting configuration (class_weighting_config) to set weights for two classes.

class_weighting_config {
class_weighting{
key: “person”
value: 1.0
}
class_weighting{
key: “bus”
value: 5.0
}
}

any news?

Can you share the spec file?

random_seed: 42
yolov4_config {
big_anchor_shape: “[(114.94, 60.67), (159.06, 114.59), (297.59, 176.38)]”
mid_anchor_shape: “[(42.99, 31.91), (79.57, 31.75), (56.80, 56.93)]”
small_anchor_shape: “[(15.60, 13.88), (30.25, 20.25), (20.67, 49.63)]”
box_matching_iou: 0.25
matching_neutral_box_iou: 0.5
arch: “resnet”
nlayers: 18
arch_conv_blocks: 2
loss_loc_weight: 1.0
loss_neg_obj_weights: 1.0
loss_class_weights: 1.0
label_smoothing: 0.0
big_grid_xy_extend: 0.05
mid_grid_xy_extend: 0.1
small_grid_xy_extend: 0.2
freeze_bn: false
#freeze_blocks: 0
force_relu: false
}
training_config {
visualizer {
enabled: False
num_images: 3
}
batch_size_per_gpu: 8
num_epochs:40
enable_qat: false
checkpoint_interval: 5
learning_rate {
soft_start_cosine_annealing_schedule {
min_learning_rate: 1e-7
max_learning_rate: 1e-4
soft_start: 0.3
}
}
regularizer {
type: L1
weight: 3e-5
}
optimizer {
adam {
epsilon: 1e-7
beta1: 0.9
beta2: 0.999
amsgrad: false
}
}
pretrain_model_path: “/workspace/tao-experiments/yolo_v4/pretrained_resnet18/pretrained_object_detection_vresnet18/yolov4_resnet18_epoch_080.tlt”
model_ema: true
}
eval_config {
average_precision_mode: SAMPLE
batch_size: 8
matching_iou_threshold: 0.5
}
nms_config {
confidence_threshold: 0.001
clustering_iou_threshold: 0.5
top_k: 200
}
augmentation_config {
hue: 0.1
saturation: 1.5
exposure:1.5
vertical_flip:0
horizontal_flip: 0.5
jitter: 0.3
output_width: 1248
output_height: 384
output_channel: 3
randomize_input_shape_period: 0
mosaic_prob: 0.5
mosaic_min_ratio:0.2
}
dataset_config {
data_sources: {
label_directory_path: “/workspace/tao-experiments/data/training/label_2”
image_directory_path: “/workspace/tao-experiments/data/training/image_2”
}
include_difficult_in_training: true

image_extension: “jpg”
target_class_mapping {
key: “car”
value: “car”
}
target_class_mapping {
key: “pedestrian”
value: “person”
}
target_class_mapping {
key: “person”
value: “person”
}
target_class_mapping {
key: “bicycle”
value: “bicycle”
}
target_class_mapping {
key: “cyclist”
value: “bicycle”
}
target_class_mapping {
key: “van”
value: “car”
}
target_class_mapping {
key: “person_sitting”
value: “person”
}
target_class_mapping {
key: “bus”
value: “bus”
}
target_class_mapping {
key: “truck”
value: “truck”
}
class_weighting_config
{
class_weighting{
key: “bicycle”
value: 1.2
}
class_weighting{
key: “person”
value: 1.2
}
}

validation_data_sources: {
label_directory_path: “/workspace/tao-experiments/data/val/label”
image_directory_path: “/workspace/tao-experiments/data/val/image”
}
}

Please move the class_weighting_config out of dataset_config.

It should not be inside dataset_config.

Hello, Thanks for your reply, however, where should I put the class_weighting_config? in which config file?

i noticed that the class_weighting_config is introduced here YOLOv4 — TAO Toolkit 3.22.05 documentation

Class Weighting Config
YOLOV4 supports class-level weighting on the loss function during training. The following is an example of the class weighting configuration (class_weighting_config) to set weights for two classes.

class_weighting_config {
class_weighting{
key: “person”
value: 1.0
}
class_weighting{
key: “bus”
value: 5.0
}
}
The parameters in class_weighting_config are defined as follows:

class_weighting: This parameter maps the class name to the corresponding class weight on the loss function. The class weight value should be greater than 0. If a class weight is not explictly set in the config, a default value of 1.0 will be assigned implictly.

Thanks, i get it, hah, just move it out of dataset_config action scope

Yes, move it out of dataset_config.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.