JiehongLin / SAM-6D

[CVPR2024] Code for "SAM-6D: Segment Anything Model Meets Zero-Shot 6D Object Pose Estimation".
374 stars 32 forks source link

ERROR: Hydra config path #26

Open Lokesh-26 opened 9 months ago

Lokesh-26 commented 9 months ago

Hello, I am getting the following error for the ISM inference script. I have a custom dataset in BOP format. I added the required data in yaml files. Please help me with the error.

/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/bin/python /media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model/run_inference.py 
INFO:pytorch_lightning.utilities.rank_zero:ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None) will duplicate the last checkpoint saved.
INFO:pytorch_lightning.utilities.rank_zero:Using 16bit native Automatic Mixed Precision (AMP)
INFO:pytorch_lightning.utilities.rank_zero:GPU available: True (cuda), used: True
INFO:pytorch_lightning.utilities.rank_zero:TPU available: False, using: 0 TPU cores
INFO:pytorch_lightning.utilities.rank_zero:IPU available: False, using: 0 IPUs
INFO:pytorch_lightning.utilities.rank_zero:HPU available: False, using: 0 HPUs
INFO:lightning_lite.utilities.seed:Global seed set to 2023
INFO:lightning_lite.utilities.seed:Global seed set to 2023
Loading metaData: 100%|██████████| 1/1 [00:00<00:00, 100.28it/s]
Loading metaData: 100%|██████████| 1/1 [00:00<00:00, 81.84it/s]
Finding nearest rendering close to template poses: 0it [00:00, ?it/s]
INFO:lightning_lite.utilities.seed:[rank: 0] Global seed set to 2023
INFO:lightning_lite.utilities.distributed:Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1/2
Traceback (most recent call last):
  File "/media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model/run_inference.py", line 83, in <module>
    run_inference()
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 105, in run
    cfg = self.compose_config(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 594, in compose_config
    cfg = self.config_loader.load_configuration(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/config_loader_impl.py", line 142, in load_configuration
    return self._load_configuration_impl(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/config_loader_impl.py", line 253, in _load_configuration_impl
    defaults_list = create_defaults_list(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 745, in create_defaults_list
    defaults, tree = _create_defaults_list(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 715, in _create_defaults_list
    defaults_tree = _create_defaults_tree(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 356, in _create_defaults_tree
    ret = _create_defaults_tree_impl(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 457, in _create_defaults_tree_impl
    return _expand_virtual_root(repo, root, overrides, skip_missing)
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 280, in _expand_virtual_root
    subtree = _create_defaults_tree_impl(
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 464, in _create_defaults_tree_impl
    config_not_found_error(repo=repo, tree=root)
  File "/media/gouda/3C448DDD448D99F2/anaconda3/envs/sam6d/lib/python3.9/site-packages/hydra/_internal/defaults_list.py", line 799, in config_not_found_error
    raise MissingConfigException(
hydra.errors.MissingConfigException: Cannot find primary config 'config.yaml'. Check that it's in your config search path.

Config search path:
    provider=hydra, path=pkg://hydra.conf
    provider=main, path=file:///media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model
    provider=hydra-colorlog, path=pkg://hydra_plugins.hydra_colorlog.conf
    provider=schema, path=structured://
WuTanKun commented 9 months ago

It seems that the configuration file "config.yaml" can not be found under the path "media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model". All configuration files are managed under the relative path "./SAM-6D/SAM-6D/Instance_Segmentation_Model/configs", and you can check whether you have added your config file correctly.

All configurations are loaded once at the line 9 in run_inference.py @hydra.main(version_base=None, config_path="configs", config_name="run_inference") You didn't encounter any problem here, or you called the same code somewhere else which raised the error.

Lokesh-26 commented 9 months ago

I have the run_inference.yaml in the configs folder. But the script expects a config.yaml file in the "media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model" directory. I duplicated the run_inference.yaml and renamed to config.yaml and placed it one directory behind in "media/gouda/3C448DDD448D99F2/segmentation/SAM-6D/SAM-6D/Instance_Segmentation_Model". It seems to work but I have to move all the files one directory behind.

Can you suggest what can I do here?

SajjadPSavoji commented 2 weeks ago

Did we get to a clear answer for this issue? I am facing the same thing with run_inference.py working with the BOP dataset. When I try to use the templates generated from test split instead of train_pbr, it requires me to add a config file under the ISM repo instead of ISM/configs.

SajjadPSavoji commented 2 weeks ago

all right, I am sharing what resolved the issue for me. Hopefully it can help others as well. I was able to fix this by setting the number of visible GPUs. This was suggested in the ISM readme. It seems like inference does not support multi-GPU at the moment. export CUDA_VISIBLE_DEVICES=0