Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'Unable to open object (component not found)' #394

Open
cshang412 opened this issue May 18, 2024 · 1 comment
Open

KeyError: 'Unable to open object (component not found)' #394

cshang412 opened this issue May 18, 2024 · 1 comment

Comments

@cshang412
Copy link

image

[2024/05/18 11:06:02 hloc WARNING] The database already exists, deleting it.
[2024/05/18 11:06:02 hloc INFO] Creating an empty database...
[2024/05/18 11:06:02 hloc INFO] Importing images into the database...
[2024/05/18 11:06:14 hloc INFO] Importing features into the database...
  0%|                                                                                                                                                             | 0/130 [00:00<?, ?it/s]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[7], line 1
----> 1 model = reconstruction.main(sfm_dir, images, sfm_pairs, feature_path, match_path)

File [~/ai/wp/chenshang_ws/hloc_ws/Hierarchical-Localization/hloc/reconstruction.py:130](http://111.229.101.159:64002/lab/tree/hloc_ws/Hierarchical-Localization/hloc_ws/Hierarchical-Localization/hloc/reconstruction.py#line=129), in main(sfm_dir, image_dir, pairs, features, matches, camera_mode, verbose, skip_geometric_verification, min_match_score, image_list, image_options, mapper_options)
    128 import_images(image_dir, database, camera_mode, image_list, image_options)
    129 image_ids = get_image_ids(database)
--> 130 import_features(image_ids, database, features)
    131 import_matches(
    132     image_ids,
    133     database,
   (...)
    137     skip_geometric_verification,
    138 )
    139 if not skip_geometric_verification:

File [~/ai/wp/chenshang_ws/hloc_ws/Hierarchical-Localization/hloc/triangulation.py:71](http://111.229.101.159:64002/lab/tree/hloc_ws/Hierarchical-Localization/hloc_ws/Hierarchical-Localization/hloc/triangulation.py#line=70), in import_features(image_ids, database_path, features_path)
     68 db = COLMAPDatabase.connect(database_path)
     70 for image_name, image_id in tqdm(image_ids.items()):
---> 71     keypoints = get_keypoints(features_path, image_name)
     72     keypoints += 0.5  # COLMAP origin
     73     db.add_keypoints(image_id, keypoints)

File [~/ai/wp/chenshang_ws/hloc_ws/Hierarchical-Localization/hloc/utils/io.py:40](http://111.229.101.159:64002/lab/tree/hloc_ws/Hierarchical-Localization/hloc_ws/Hierarchical-Localization/hloc/utils/io.py#line=39), in get_keypoints(path, name, return_uncertainty)
     36 def get_keypoints(
     37     path: Path, name: str, return_uncertainty: bool = False
     38 ) -> np.ndarray:
     39     with h5py.File(str(path), "r", libver="latest") as hfile:
---> 40         dset = hfile[name]["keypoints"]
     41         p = dset.__array__()
     42         uncertainty = dset.attrs.get("uncertainty")

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File [~/anaconda3/envs/hloc/lib/python3.8/site-packages/h5py/_hl/group.py:288](http://111.229.101.159:64002/home/easyits/anaconda3/envs/hloc/lib/python3.8/site-packages/h5py/_hl/group.py#line=287), in Group.__getitem__(self, name)
    286         raise ValueError("Invalid HDF5 object reference")
    287 else:
--> 288     oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
    290 otype = h5i.get_type(oid)
    291 if otype == h5i.GROUP:

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File h5py/h5o.pyx:190, in h5py.h5o.open()

KeyError: 'Unable to open object (component not found)'
@xushangnjlh
Copy link

some of images' local feature has not extracted, maybe your image dir does not cover all the images the sfm needed. I have also encountered this when I messed up with my dataset's image dir.

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

No branches or pull requests

2 participants