nv-nguyen/gigapose

Getting an error while running test.py

Opened this issue · 1 comments

Hi !

Can you please help me set up the environment , as I wanted to test the gigapose algorithm for BOP challenge 2024. I followed the instructions for the data set and did set up the environment accordingly. However, when I am trying to test the algorithm using test.py :

python test.py test_dataset_name=hope run_id=$NAME_RUN test_setting=detection

I am getting some errors to load the dataset correctly :

[2024-06-26 12:08:10,711][__main__][INFO] - Initializing logger, callbacks and trainer
[2024-06-26 12:08:10,714][__main__][INFO] - Tensorboard logger initialized at ./gigaPose_datasets/results/large_/gigapose
ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None) will duplicate the last checkpoint saved.
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
[2024-06-26 12:08:10,779][__main__][INFO] - Trainer initialized!
Using cache found in /home/jcl-mj/.cache/torch/hub/facebookresearch_dinov2_main
[2024-06-26 12:08:12,627][dinov2][INFO] - using MLP layer as FFN
[2024-06-26 12:08:16,294][src.models.network.ae_net][INFO] - Initialize AENet done!
[2024-06-26 12:08:16,436][src.models.network.ist_net][INFO] - Init for Regressor with done!
[2024-06-26 12:08:16,500][src.models.network.ist_net][INFO] - Init weights for ISTNet done!
[2024-06-26 12:08:16,500][src.models.network.ist_net][INFO] - Init for ISTNet done!
[2024-06-26 12:08:16,503][src.models.gigaPose][INFO] - Initialize GigaPose done!
[2024-06-26 12:08:16,503][__main__][INFO] - Model initialized!
[2024-06-26 12:08:16,565][src.dataloader.test][INFO] - Split: test for lmo!
Error executing job with overrides: ['test_dataset_name=lmo', 'run_id=', 'test_setting=localization']
Error in call to target 'src.dataloader.test.GigaPoseTestSet':
TypeError('Cannot convert numpy.ndarray to numpy.ndarray')
full_key: data.test.dataloader

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I also tried setting the environment variable HYDRA_FULL_ERROR=1 , but then i am getting this error :

python test.py test_dataset_name=lmo run_id=$NAME_RUN test_setting=localization
[2024-06-26 12:08:10,711][__main__][INFO] - Initializing logger, callbacks and trainer
[2024-06-26 12:08:10,714][__main__][INFO] - Tensorboard logger initialized at ./gigaPose_datasets/results/large_/gigapose
ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None) will duplicate the last checkpoint saved.
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
[2024-06-26 12:08:10,779][__main__][INFO] - Trainer initialized!
Using cache found in /home/jcl-mj/.cache/torch/hub/facebookresearch_dinov2_main
[2024-06-26 12:08:12,627][dinov2][INFO] - using MLP layer as FFN
[2024-06-26 12:08:16,294][src.models.network.ae_net][INFO] - Initialize AENet done!
[2024-06-26 12:08:16,436][src.models.network.ist_net][INFO] - Init for Regressor with done!
[2024-06-26 12:08:16,500][src.models.network.ist_net][INFO] - Init weights for ISTNet done!
[2024-06-26 12:08:16,500][src.models.network.ist_net][INFO] - Init for ISTNet done!
[2024-06-26 12:08:16,503][src.models.gigaPose][INFO] - Initialize GigaPose done!
[2024-06-26 12:08:16,503][__main__][INFO] - Model initialized!
[2024-06-26 12:08:16,565][src.dataloader.test][INFO] - Split: test for lmo!
Error executing job with overrides: ['test_dataset_name=lmo', 'run_id=', 'test_setting=localization']
Error in call to target 'src.dataloader.test.GigaPoseTestSet':
TypeError('Cannot convert numpy.ndarray to numpy.ndarray')
full_key: data.test.dataloader

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
(gigapose_new) jcl-mj@jcl-mj:~/gigapose_newenv/gigapose$ export HYDRA_FULL_ERROR=1
(gigapose_new) jcl-mj@jcl-mj:~/gigapose_newenv/gigapose$ python test.py test_dataset_name=lmo run_id=$NAME_RUN test_setting=localization
[2024-06-26 12:09:33,580][__main__][INFO] - Initializing logger, callbacks and trainer
[2024-06-26 12:09:33,583][__main__][INFO] - Tensorboard logger initialized at ./gigaPose_datasets/results/large_/gigapose
ModelCheckpoint(save_last=True, save_top_k=-1, monitor=None) will duplicate the last checkpoint saved.
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
[2024-06-26 12:09:33,629][__main__][INFO] - Trainer initialized!
Using cache found in /home/jcl-mj/.cache/torch/hub/facebookresearch_dinov2_main
[2024-06-26 12:09:35,377][dinov2][INFO] - using MLP layer as FFN
[2024-06-26 12:09:39,100][src.models.network.ae_net][INFO] - Initialize AENet done!
[2024-06-26 12:09:39,237][src.models.network.ist_net][INFO] - Init for Regressor with done!
[2024-06-26 12:09:39,299][src.models.network.ist_net][INFO] - Init weights for ISTNet done!
[2024-06-26 12:09:39,300][src.models.network.ist_net][INFO] - Init for ISTNet done!
[2024-06-26 12:09:39,303][src.models.gigaPose][INFO] - Initialize GigaPose done!
[2024-06-26 12:09:39,303][__main__][INFO] - Model initialized!
[2024-06-26 12:09:39,360][src.dataloader.test][INFO] - Split: test for lmo!
Error executing job with overrides: ['test_dataset_name=lmo', 'run_id=', 'test_setting=localization']
Traceback (most recent call last):
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
  File "/home/jcl-mj/gigapose_newenv/gigapose/src/dataloader/test.py", line 72, in __init__
    web_dataset = WebSceneDataset(webdataset_dir / split, depth_scale=depth_scale)
  File "/home/jcl-mj/gigapose_newenv/gigapose/src/custom_megapose/web_scene_dataset.py", line 131, in __init__
    frame_index = self.load_frame_index()
  File "/home/jcl-mj/gigapose_newenv/gigapose/src/custom_megapose/web_scene_dataset.py", line 149, in load_frame_index
    frame_index = pd.DataFrame({"key": keys, "shard_fname": shard_fnames})
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/pandas/core/frame.py", line 778, in __init__
    mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/pandas/core/internals/construction.py", line 480, in dict_to_mgr
    columns = Index(keys) if keys else default_index(0)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 565, in __new__
    arr = sanitize_array(data, None, dtype=dtype, copy=copy)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/pandas/core/construction.py", line 654, in sanitize_array
    subarr = maybe_convert_platform(data)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/pandas/core/dtypes/cast.py", line 139, in maybe_convert_platform
    arr = lib.maybe_convert_objects(arr)
  File "lib.pyx", line 2538, in pandas._libs.lib.maybe_convert_objects
TypeError: Cannot convert numpy.ndarray to numpy.ndarray


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

Traceback (most recent call last):
  File "/home/jcl-mj/gigapose_newenv/gigapose/test.py", line 87, in <module>
    run_test()
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/home/jcl-mj/gigapose_newenv/gigapose/test.py", line 54, in run_test
    test_dataset = instantiate(cfg.data.test.dataloader)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 226, in instantiate
    return instantiate_node(
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
  File "/home/jcl-mj/anaconda3/envs/gigapose_new/lib/python3.9/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'src.dataloader.test.GigaPoseTestSet':
TypeError('Cannot convert numpy.ndarray to numpy.ndarray')
full_key: data.test.dataloader

Had the same, seems to be a version problem of numpy or pandas.
Sloved by

conda install numpy
conda install pandas