Skip to content

Label_map generation error when training on custom dataset #108

Description

@blueionthruster

I am training on a custom dataset with three classes, and I have the dataset file in Grounded-SAM/Detic annotation. When I run the train via bash in the terminal, I get the following error. Can anyone can help me figure out how to fix this error?

Error message:
Traceback (most recent call last): File "/.../Open-GroundingDino/main.py", line 401, in <module> main(args) File "/.../Open-GroundingDino/main.py", line 313, in main train_stats = train_one_epoch( File "/.../Open-GroundingDino/engine.py", line 53, in train_one_epoch loss_dict = criterion(outputs, targets, cap_list, captions) File "/.../miniconda3/envs/gd2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/.../miniconda3/envs/gd2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/.../Open-GroundingDino/models/GroundingDINO/groundingdino.py", line 565, in forward inds = self.matcher(for_match, [targets[j]], label_map_list[j]) File "/.../miniconda3/envs/gd2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File "/.../miniconda3/envs/gd2/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl return forward_call(*args, **kwargs) File "/.../miniconda3/envs/gd2/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/.../Open-GroundingDino/models/GroundingDINO/matcher.py", line 88, in forward new_label_map=label_map[tgt_ids.cpu()] IndexError: index 2 is out of bounds for dimension 0 with size 2

Config file:
batch_size = 1 modelname = "groundingdino" backbone = "swin_B_384_22k" position_embedding = "sine" pe_temperatureH = 20 pe_temperatureW = 20 return_interm_indices = [1, 2, 3] backbone_freeze_keywords = None enc_layers = 6 dec_layers = 6 pre_norm = False dim_feedforward = 2048 hidden_dim = 256 dropout = 0.0 nheads = 8 num_queries = 900 query_dim = 4 num_patterns = 0 num_feature_levels = 4 enc_n_points = 4 dec_n_points = 4 two_stage_type = "standard" two_stage_bbox_embed_share = False two_stage_class_embed_share = False transformer_activation = "relu" dec_pred_bbox_embed_share = True dn_box_noise_scale = 1.0 dn_label_noise_ratio = 0.5 dn_label_coef = 1.0 dn_bbox_coef = 1.0 embed_init_tgt = True dn_labelbook_size = 3 max_text_len = 256 text_encoder_type = "bert-base-uncased" use_text_enhancer = True use_fusion_layer = True use_checkpoint = True use_transformer_ckpt = True use_text_cross_attention = True text_dropout = 0.0 fusion_dropout = 0.0 fusion_droppath = 0.1 sub_sentence_present = True use_coco_eval = False label_list=['a', 'b', 'c'] aux_loss = False clip_max_norm=True save_checkpoint_interval = 1 epochs= 15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions