Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

AttributeError: Attribute 'ignore_label' does not exist in the metadata of dataset 'ade20k_sem_seg_train'. #17

Closed
Keiku opened this issue Aug 8, 2021 · 7 comments

Comments

@Keiku
Copy link

Keiku commented Aug 8, 2021

I ran the following command.

./train_net.py \
  --config-file configs/ade20k-150/maskformer_R50_bs16_160k.yaml \
  --num-gpus 1 SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0001

Then I got the following error. What should I do?

Traceback (most recent call last):
  File "train_net.py", line 264, in <module>
    launch(
  File "/home/keiichi.kuroyanagi/.pyenv/versions/3.8.6-mask-former/lib/python3.8/site-packages/detectron2/engine/launch.py", line 62, in launch
    main_func(*args)
  File "train_net.py", line 256, in main
    trainer = Trainer(cfg)
  File "/home/keiichi.kuroyanagi/.pyenv/versions/3.8.6-mask-former/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 312, in __init__
    data_loader = self.build_train_loader(cfg)
  File "train_net.py", line 107, in build_train_loader
    mapper = MaskFormerSemanticDatasetMapper(cfg, True)
  File "/home/keiichi.kuroyanagi/.pyenv/versions/3.8.6-mask-former/lib/python3.8/site-packages/detectron2/config/config.py", line 181, in wrapped
    explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
  File "/home/keiichi.kuroyanagi/.pyenv/versions/3.8.6-mask-former/lib/python3.8/site-packages/detectron2/config/config.py", line 238, in _get_args_from_config
    ret = from_config_func(*args, **kwargs)
  File "/mnt/sdb1/lost+found/clones/Study-MaskFormer/mask_former/data/dataset_mappers/mask_former_semantic_dataset_mapper.py", line 87, in from_config
    ignore_label = meta.ignore_label
  File "/home/keiichi.kuroyanagi/.pyenv/versions/3.8.6-mask-former/lib/python3.8/site-packages/detectron2/data/catalog.py", line 126, in __getattr__
    raise AttributeError(
AttributeError: Attribute 'ignore_label' does not exist in the metadata of dataset 'ade20k_sem_seg_train'. Available keys are dict_keys(['name', 'stuff_classes', 'image_root', 'sem_seg_root', 'evaluator_type', 'stuff_colors']).
⋊> ~/l/c/Study-MaskFormer on develop 
@bowenc0221
Copy link
Contributor

Please update your Detectron2 version to >= 0.4.0

@Keiku
Copy link
Author

Keiku commented Aug 8, 2021

The version of detectron2 seems to be fine. Is there anything else wrong?

⋊> ~/l/c/Study-MaskFormer on develop ⨯ pip list | grep detectron2                                                                                                  15:45:36
detectron2              0.4+cu102
⋊> ~/l/c/Study-MaskFormer on develop ⨯ 

@bowenc0221
Copy link
Contributor

Could you check detectron2/data/datasets/builtin.py and see if this line exists? If not, you may need to use a newer version of detectron2.

@Keiku
Copy link
Author

Keiku commented Aug 9, 2021

I made the following changes for the time being, but I haven't reached a fundamental solution. I will think about this issue for a while.

        ignore_label = 65535
        # ignore_label = meta.ignore_label

@bowenc0221
Copy link
Contributor

ignore_label may be different for different dataset, for ADE20K-150, it is 255 instead of 65535.

@Keiku
Copy link
Author

Keiku commented Aug 10, 2021

Surely. I set 255 and it worked. I will confirm the ADE20K-150 dataset properly. I will think about the issue of Metadata Catalog separately. For the time being, close it. Thank you for your polite response.

@Keiku Keiku closed this as completed Aug 10, 2021
@Keiku
Copy link
Author

Keiku commented Aug 10, 2021

@bowenc0221 I understand the cause of the problem. It seems that ignore_label = 255 has been added from version 0.4.1. It worked fine with 0.4.1. I will use 0.4.1 or later.

facebookresearch/detectron2@ef096d1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants