question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation concerning the new config files

See original GitHub issue

📚 Documentation Improvements

In short

Concerning: https://detectron2.readthedocs.io/en/latest/tutorials/configs.html Problem: Documentation does not seem to have been updated to reflect the new config files (.py rather than .yaml) Solution: Update the documentation

Problem description

FAIR recently published new Mask R-CNN baselines and this was my first introduction to the new config file that no longer relies on YAML files but on ‘raw’ .py files. I am trying to load the new baselines using the config files mentioned in the MODEL_ZOO (see this table). For example:

from detectron2 import model_zoo
model = model_zoo.get("new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py", trained=True)

This gives

RuntimeError: new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ not available in Model Zoo!

I have installed Detectron2 using the installation instructions. When looking up the documentation on configs, it seems that this has not been updated to reflect the new configs and still solely mentions YAML files.

Proposed solution

It could be that the CONFIG_PATH_TO_URL_SUFFIX dictionary in _ModelZooUrls class still has to be updated and that this is actually a bug (see here), but I find it hard to estimate wheter this is meant behavior (i.e. the new config file should be loaded differently) or a bug due to my limited understanding of the new config files. Either way, I therefore feel like the documentation on readthedocs should be updated to reflect the change from .yaml to .py.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:18
  • Comments:33 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
orbiskcwcommented, Aug 12, 2021

@ppwwyyxx One more question that recently came up while working with the detectron2 repo: What is the best way to extend a config from the model zoo? I expected something like this to work:

# In /path/to/custom_config.py

from detectron2.model_zoo.configs.new_baselines.mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ import  (
    dataloader,
    lr_multiplier,
    model,
    optimizer,
    train,
)

train.max_iter = 10

But if I then try to load the new config with:

LazyConfig.load('/path/to/custom_config.py')

I get:

  File "/home/cas/Documents/repositories/detectron2-model-training/detectron2_model_training/config.py", line 98, in load
    return LazyConfig.load(config_path)
  File "/home/cas/Documents/repositories/detectron2-model-training/.venv/lib/python3.8/site-packages/detectron2/config/lazy.py", line 202, in load
    exec(compile(content, filename, "exec"), module_namespace)
  File "configs/default.py", line 1, in <module>
    from detectron2.model_zoo.configs.new_baselines.mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ import (  # noqa
  File "/home/cas/Documents/repositories/detectron2-model-training/.venv/lib/python3.8/site-packages/detectron2/config/lazy.py", line 145, in new_import
    return old_import(name, globals, locals, fromlist=fromlist, level=level)
  File "/home/cas/Documents/repositories/detectron2-model-training/.venv/lib/python3.8/site-packages/detectron2/model_zoo/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ.py", line 1, in <module>
    from .mask_rcnn_R_50_FPN_100ep_LSJ import (
  File "/home/cas/Documents/repositories/detectron2-model-training/.venv/lib/python3.8/site-packages/detectron2/config/lazy.py", line 145, in new_import
    return old_import(name, globals, locals, fromlist=fromlist, level=level)
  File "/home/cas/Documents/repositories/detectron2-model-training/.venv/lib/python3.8/site-packages/detectron2/model_zoo/configs/new_baselines/mask_rcnn_R_50_FPN_100ep_LSJ.py", line 13, in <module>
    train.init_checkpoint = ""
AttributeError: 'dict' object has no attribute 'init_checkpoint'

Could you confirm whether this is expected behavior or a bug? Could you clarify if it is possible to do this and if so, what the conditions / requirements are?

6reactions
ppwwyyxxcommented, Jul 9, 2021

https://github.com/facebookresearch/detectron2/blob/master/tools/lazyconfig_train_net.py is the training script to use these configs. We’ll add documentation soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RPM, %config, and (noreplace) - University of Cambridge
RPM spec files have a macro, %config, that is used to mark config files so that edits to config files won't get lost...
Read more >
detectron2.config
Load content from the given config file and merge it into self. Parameters. cfg_filename – config filename. allow_unsafe – allow unsafe yaml syntax....
Read more >
Config file processing in Spring Boot 2.4
Now that we've fixed that basic issues with config file processing, we're finally able to think about new features that we want to...
Read more >
EditorConfig settings - Visual Studio (Windows) - Microsoft Learn
Settings in EditorConfig files let you maintain consistent coding styles and settings in a codebase, such as indent style, tab width, end of ......
Read more >
About configuration files - Splunk Documentation
To change settings for a particular configuration file, you must first create a new version of the file in a non-default directory and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found