RozDavid / UnScene3D

Unsupervised 3D Instance Segmentation
BSD 3-Clause "New" or "Revised" License
28 stars 3 forks source link

AttributeError: module 'models' has no attribute 'Mask3D' #3

Open lpy29 opened 4 weeks ago

lpy29 commented 4 weeks ago

Hello! When I run. scripts/mask3d_DINO_CSC_self_train.sh,I get an error:

Error locating target 'models.Mask3D', set env var HYDRA_FULL_ERROR=1 to see chained exception. full_key: model AttributeError: module 'models' has no attribute 'Mask3D' During handling of the above exception, another exception occurred: ModuleNotFoundError: No module named 'models.Mask3D'

Could you help me fix this error?

RozDavid commented 4 weeks ago

Could you run your script with HYDRA_FULL_ERROR=1 as recommended by the error message? That will help us trace your bug.

lpy29 commented 4 weeks ago

Error executing job with overrides: [] Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 644, in _locate obj = getattr(obj, part) AttributeError: module 'models' has no attribute 'Mask3D'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 650, in _locate obj = import_module(mod) File "/opt/conda/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.Mask3D'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 134, in _resolve_target target = _locate(target) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 656, in _locate ) from exc_import ImportError: Error loading 'models.Mask3D': ModuleNotFoundError("No module named 'models.Mask3D'") Are you sure that 'Mask3D' is importable from module 'models'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "main_instance_segmentation.py", line 118, in main() File "/opt/conda/lib/python3.7/site-packages/hydra/main.py", line 99, in decorated_main config_name=config_name, File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 401, in _run_hydra overrides=overrides, File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 458, in _run_app lambda: hydra.run( File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 461, in overrides=overrides, File "/opt/conda/lib/python3.7/site-packages/hydra/internal/hydra.py", line 132, in run = ret.return_value File "/opt/conda/lib/python3.7/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/opt/conda/lib/python3.7/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "main_instance_segmentation.py", line 112, in main train(cfg) File "/opt/conda/lib/python3.7/site-packages/hydra/main.py", line 83, in decorated_main return task_function(cfg_passthrough) File "main_instance_segmentation.py", line 79, in train cfg, model, loggers = get_parameters(cfg) File "main_instance_segmentation.py", line 58, in get_parameters model = InstanceSegmentation(cfg) File "/home/Unscene3D/trainer/trainer.py", line 60, in init self.model = hydra.utils.instantiate(config.model) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 227, in instantiate config, *args, recursive=recursive, convert=convert, partial=partial File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 333, in instantiate_node target = _resolve_target(node.get(_Keys.TARGET), full_key) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 139, in _resolve_target raise InstantiationException(msg) from e hydra.errors.InstantiationException: Error locating target 'models.Mask3D', set env var HYDRA_FULL_ERROR=1 to see chained exception. full_key: model Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 644, in _locate obj = getattr(obj, part) AttributeError: module 'models' has no attribute 'Mask3D'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 650, in _locate obj = import_module(mod) File "/opt/conda/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.Mask3D'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 134, in _resolve_target target = _locate(target) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 656, in _locate ) from exc_import ImportError: Error loading 'models.Mask3D': ModuleNotFoundError("No module named 'models.Mask3D'") Are you sure that 'Mask3D' is importable from module 'models'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "main_instance_segmentation.py", line 118, in main() File "/opt/conda/lib/python3.7/site-packages/hydra/main.py", line 99, in decorated_main config_name=config_name, File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 401, in _run_hydra overrides=overrides, File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 458, in _run_app lambda: hydra.run( File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/utils.py", line 461, in overrides=overrides, File "/opt/conda/lib/python3.7/site-packages/hydra/internal/hydra.py", line 132, in run = ret.return_value File "/opt/conda/lib/python3.7/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/opt/conda/lib/python3.7/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "main_instance_segmentation.py", line 112, in main train(cfg) File "/opt/conda/lib/python3.7/site-packages/hydra/main.py", line 83, in decorated_main return task_function(cfg_passthrough) File "main_instance_segmentation.py", line 79, in train cfg, model, loggers = get_parameters(cfg) File "main_instance_segmentation.py", line 58, in get_parameters model = InstanceSegmentation(cfg) File "/home/Unscene3D/trainer/trainer.py", line 60, in init self.model = hydra.utils.instantiate(config.model) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 227, in instantiate config, *args, recursive=recursive, convert=convert, partial=partial File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 333, in instantiate_node target = _resolve_target(node.get(_Keys.TARGET), full_key) File "/opt/conda/lib/python3.7/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 139, in _resolve_target raise InstantiationException(msg) from e hydra.errors.InstantiationException: Error locating target 'models.Mask3D', set env var HYDRA_FULL_ERROR=1 to see chained exception. full_key: model

RozDavid commented 3 weeks ago

Hey @lpy29,

you are right, there were indeed incorrect import paths in the code after refactoring. Could you please pull the latest commits and run it again? Additionally, I also added a docker container where reproducing the code could be easier now.

Hope this helps! Cheers, David

lpy29 commented 3 weeks ago

Thank you for your reply!But I I get another error when running run. scripts/mask3d_DINO_CSC_self_train.sh: Traceback (most recent call last): File "main_instance_segmentation.py", line 112, in main train(cfg) File "/opt/conda/lib/python3.7/site-packages/hydra/main.py", line 83, in decorated_main return task_function(cfg_passthrough) File "main_instance_segmentation.py", line 79, in train cfg, model, loggers = get_parameters(cfg) File "main_instance_segmentation.py", line 64, in get_parameters cfg, model = load_checkpoint_with_missing_or_exsessive_keys(cfg, model) File "/home/Unscene3D/utils/utils.py", line 96, in load_checkpoint_with_missing_or_exsessive_keys state_dict = torch.load(cfg.general.checkpoint)["state_dict"] File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 594, in load with _open_file_like(f, 'rb') as opened_file: File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 211, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'data/self_train/DINO_CSC_self_train'. Are the results of DINO_CSC_self_train available?

RozDavid commented 3 weeks ago

you are missing the first stage of training with standard parameters. you'd need to run:

. scripts/unsupervised/train_unscene3d.sh "DINO_CSC_self_train" ""

in your parent folder. Also please dont forget the change the paths in the preprocessed datasets to your local setup.

lpy29 commented 3 weeks ago

I have tried to run:. scripts/unsupervised/train_unscene3d.sh "DINO_CSC_self_train" "",but i got new error: Epoch 0: 0%| | 0/300 [00:00<?, ?it/s]Could not load self training data for scene0582_02 Could not load self training data for scene0114_02 Could not load self training data for scene0035_01 it seems like missing the code that saving these masks as an extension to the original pseudo dataset?

RozDavid commented 2 weeks ago

You are still missing the self training inputs where the model expects to load from the given directories. Please check the available configurations parameters here or start the standard, non-pretraining setup first with:

. scripts/unsupervised/train_unscene3d_dino_csc.sh