zju3dv / OnePose_Plus_Plus

Code for "OnePose++: Keypoint-Free One-Shot Object Pose Estimation without CAD Models" NeurIPS 2022
Apache License 2.0
379 stars 46 forks source link

Inference on demo_cam -- FileNotFoundError: [Errno 2] No such file or directory: '/home/mona/OnePose_Plus_Plus/data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam/anno/anno_3d_average.npz' #36

Closed monajalal closed 1 year ago

monajalal commented 1 year ago

I followed the instructions for running the demo app on your object demo_cam, however, I get this error:

(base) mona@ard-gpu-01:~/OnePose_Plus_Plus$ REPO_ROOT=/home/mona/OnePose_Plus_Plus
(base) mona@ard-gpu-01:~/OnePose_Plus_Plus$ OBJ_NAME=demo_cam
(base) mona@ard-gpu-01:~/OnePose_Plus_Plus$ cd $REPO_ROOT
(base) mona@ard-gpu-01:~/OnePose_Plus_Plus$ conda activate oneposeplus
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ bash scripts/demo_pipeline.sh $OBJ_NAME
Current work dir: /home/mona/OnePose_Plus_Plus
-------------------
Parse scanned data:
-------------------
=> Processing annotate sequence:  demo_cam-annotate
100%|████████████████████████████████████████████████████████████████████████████████| 725/725 [00:00<00:00, 2977.30it/s]
=> Processing test sequence:  demo_cam-test
--------------------------------------------------------------
Run Keypoint-Free SfM to reconstruct object point cloud for pose estimation:
--------------------------------------------------------------
/home/mona/OnePose_Plus_Plus/run.py:398: UserWarning: 
The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
  @hydra.main(config_path="configs/", config_name="config.yaml")
/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/hydra/_internal/defaults_list.py:251: UserWarning: In 'config.yaml': Defaults list is missing `_self_`. See https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/default_composition_order for more information
  warnings.warn(msg, UserWarning)
/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
  ret = run_job(
2023-06-15 10:55:50.183 | INFO     | __main__:sfm_worker:92 - Worker: 0 will process: ['demo'], total: 1 objects
  0%|                                                                                              | 0/1 [00:00<?, ?it/s]2023-06-15 10:55:50.184 | INFO     | __main__:sfm_worker:97 - Processing /home/mona/OnePose_Plus_Plus/data/demo/demo_cam demo_cam-annotate.
2023-06-15 10:55:52.127 | INFO     | __main__:sfm_core:193 - Keypoint-Free SfM coarse reconstruction begin...
2023-06-15 10:55:53,689 INFO worker.py:1636 -- Started a local Ray instance.
                                                                                                                        (match_worker_ray_wrapper pid=787867) Global seed set to 666                                      | 0/725 [00:00<?, ?it/s]
Matching image pairs...: 100%|█████████████████████████████████████████████████████████| 725/725 [01:20<00:00,  9.01it/s]
2023-06-15 10:57:14.501 | INFO     | src.KeypointFreeSfM.coarse_match.coarse_match:detector_free_coarse_matching:90 - Matcher finish!
2023-06-15 10:57:14.580 | INFO     | src.KeypointFreeSfM.coarse_match.coarse_match:detector_free_coarse_matching:93 - Raw matches cached: /home/mona/OnePose_Plus_Plus/data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam/raw_matches.h5
Combine points 2D...: 100%|████████████████████████████████████████████████████████████| 145/145 [00:03<00:00, 37.73it/s]
2023-06-15 10:57:19.643 | INFO     | src.KeypointFreeSfM.coarse_match.coarse_match:detector_free_coarse_matching:108 - Combine keypoints finish!
Updating matches...: 100%|████████████████████████████████████████████████████████████| 725/725 [00:03<00:00, 188.06it/s]
Post-processing points 2D...: 100%|██████████████████████████████████████████████████| 145/145 [00:00<00:00, 1117.15it/s]
[2023-06-15 10:57:30,716][root][INFO] - Generate empty model...█████████████▋        | 121/145 [00:00<00:00, 1207.71it/s]
[2023-06-15 10:57:31,343][root][INFO] - Writing the COLMAP model to /home/mona/OnePose_Plus_Plus/data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam/sfm_empty
[2023-06-15 10:57:31,349][root][INFO] - Finishing writing model.
[2023-06-15 10:57:31,482][root][INFO] - Importing features into the database...
100%|████████████████████████████████████████████████████████████████████████████████| 145/145 [00:00<00:00, 4018.73it/s]
[2023-06-15 10:57:31,536][root][INFO] - Importing matches into the database...                   | 0/145 [00:00<?, ?it/s]
                                                                                                                        /home/mona/OnePose_Plus_Plus/src/sfm_utils/triangulation.py:141: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  valid = np.ones((matches.shape[0],), dtype=np.bool) # all True
  0%|                                                                                            | 0/725 [00:00<?, ?it/s]
  0%|                                                                                              | 0/1 [01:41<?, ?it/s]
Error executing job with overrides: ['+preprocess=sfm_demo', 'dataset.data_dir=[/home/mona/OnePose_Plus_Plus/data/demo/demo_cam demo_cam-annotate]', 'dataset.outputs_dir=/home/mona/OnePose_Plus_Plus/data/demo/sfm_model']
Traceback (most recent call last):
  File "/home/mona/OnePose_Plus_Plus/run.py", line 400, in main
    globals()[cfg.type](cfg)
  File "/home/mona/OnePose_Plus_Plus/run.py", line 65, in sfm
    sfm_worker(data_dirs, cfg)
  File "/home/mona/OnePose_Plus_Plus/run.py", line 129, in sfm_worker
    sfm_core(cfg, img_lists, outputs_dir_root, obj_name)
  File "/home/mona/OnePose_Plus_Plus/run.py", line 247, in sfm_core
    triangulation.main(
  File "/home/mona/OnePose_Plus_Plus/src/sfm_utils/triangulation.py", line 231, in main
    import_matches(image_ids, database, pairs, matches, features, match_model,
  File "/home/mona/OnePose_Plus_Plus/src/sfm_utils/triangulation.py", line 141, in import_matches
    valid = np.ones((matches.shape[0],), dtype=np.bool) # all True
  File "/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
(match_worker_ray_wrapper pid=787934) Global seed set to 666 [repeated 3x across cluster] (Ray deduplicates logs by default. Set RAY_DEDUP_LOGS=0 to disable log deduplication, or see https://docs.ray.io/en/master/ray-observability/ray-logging.html#log-deduplication for more options.)
-----------------------------------
Run inference and output demo video:
-----------------------------------
/home/mona/OnePose_Plus_Plus/demo.py:168: UserWarning: 
The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
  @hydra.main(config_path="configs/", config_name="config.yaml")
/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/hydra/_internal/defaults_list.py:251: UserWarning: In 'config.yaml': Defaults list is missing `_self_`. See https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/default_composition_order for more information
  warnings.warn(msg, UserWarning)
/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
  ret = run_job(
  0%|                                                                                              | 0/1 [00:00<?, ?it/s]2023-06-15 10:57:39.050 | INFO     | __main__:inference:165 - Eval /home/mona/OnePose_Plus_Plus/data/demo/demo_cam/demo_cam-test
2023-06-15 10:57:39.054 | INFO     | src.datasets.OnePosePlus_inference_dataset:__init__:38 - Will process:330 images 
  0%|                                                                                              | 0/1 [00:00<?, ?it/s]
Error executing job with overrides: ['+experiment=inference_demo', 'data_base_dir=/home/mona/OnePose_Plus_Plus/data/demo/demo_cam demo_cam-test', 'sfm_base_dir=/home/mona/OnePose_Plus_Plus/data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam']
Traceback (most recent call last):
  File "/home/mona/OnePose_Plus_Plus/demo.py", line 170, in main
    globals()[cfg.type](cfg)
  File "/home/mona/OnePose_Plus_Plus/demo.py", line 166, in inference
    inference_core(cfg, data_root, seq_dir, sfm_model_dir)
  File "/home/mona/OnePose_Plus_Plus/demo.py", line 69, in inference_core
    dataset = OnePosePlusInferenceDataset(
  File "/home/mona/OnePose_Plus_Plus/src/datasets/OnePosePlus_inference_dataset.py", line 53, in __init__
    ) = self.read_anno3d(
  File "/home/mona/OnePose_Plus_Plus/src/datasets/OnePosePlus_inference_dataset.py", line 113, in read_anno3d
    avg_data = np.load(avg_anno3d_file)
  File "/home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy/lib/npyio.py", line 405, in load
    fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/home/mona/OnePose_Plus_Plus/data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam/anno/anno_3d_average.npz'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ 

Here are the files I have:

(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ find . -name "anno_3d_average.npz"
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ find . -name "demo_cam"
./data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam
./data/demo/demo_cam
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ ls data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam
total 660M
drwxrwxr-x 3 mona mona 4.0K Jun 15 10:55 ..
-rw-rw-r-- 1 mona mona 114K Jun 15 10:55 pairs-covis10.txt
-rw-rw-r-- 1 mona mona  13M Jun 15 10:57 raw_matches.h5
-rw-rw-r-- 1 mona mona 623M Jun 15 10:57 feats-loftr.h5
-rw-rw-r-- 1 mona mona  26M Jun 15 10:57 matches-loftr.h5
drwxrwxr-x 2 mona mona 4.0K Jun 15 10:57 sfm_empty
drwxrwxr-x 4 mona mona 4.0K Jun 15 10:57 .
drwxrwxr-x 3 mona mona 4.0K Jun 15 10:57 sfm_ws
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ tree data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam
data/demo/sfm_model/outputs_softmax_loftr_loftr/demo_cam
├── feats-loftr.h5
├── matches-loftr.h5
├── pairs-covis10.txt
├── raw_matches.h5
├── sfm_empty
│   ├── cameras.bin
│   ├── images.bin
│   └── points3D.bin
└── sfm_ws
    ├── database.db
    └── model

3 directories, 8 files
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ tree data/demo/demo_cam/
data/demo/demo_cam/
├── box3d_corners.txt
├── demo_cam-annotate
│   ├── ARposes.txt
│   ├── bbox
│   │   ├── 0.txt
│   │   ├── 100.txt
│   │   ├── 101.txt
│   │   ├── 102.txt

Could you please suggest how to fix?

(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ ls data/demo/demo_cam/
total 28K
-rw-r--r--  1 mona mona 6.1K Jun 14 15:54 .DS_Store
drwxr-xr-x  4 mona mona 4.0K Jun 14 15:54 .
drwxrwxr-x  4 mona mona 4.0K Jun 14 16:26 ..
-rw-rw-r--  1 mona mona  612 Jun 15 10:54 box3d_corners.txt
drwxr-xr-x 11 mona mona 4.0K Jun 15 10:55 demo_cam-annotate
drwxr-xr-x  7 mona mona 4.0K Jun 15 10:57 demo_cam-test
monajalal commented 1 year ago

add this line use_local_ray=False \ after +preprocess="sfm_demo" \ in scripts/demo_pipeline.sh

monajalal commented 1 year ago

also a known issue with numpy 1.24.3 so you gotta switch to 1.23.1

(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ pip show numpy
Name: numpy
Version: 1.24.3
Summary: Fundamental package for array computing in Python
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD-3-Clause
Location: /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages
Requires: 
Required-by: astropy, contourpy, fvcore, h5py, imageio, matplotlib, nvdiffrast, nvdu, open3d, opencv-python, pandas, plyfile, pyamg, pyerfa, PyMCubes, pyquaternion, pyrr, pytorch-lightning, PyWavelets, ray, raytracing, scikit-image, scikit-learn, scipy, tensorboard, tensorboardX, tifffile, torchmetrics, torchtext, torchvision, trimesh, wis3d
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ pip uninstall numpy 
Found existing installation: numpy 1.24.3
Uninstalling numpy-1.24.3:
  Would remove:
    /home/mona/anaconda3/envs/oneposeplus/bin/f2py
    /home/mona/anaconda3/envs/oneposeplus/bin/f2py3
    /home/mona/anaconda3/envs/oneposeplus/bin/f2py3.10
    /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy-1.24.3.dist-info/*
    /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy.libs/libgfortran-040039e1.so.5.0.0
    /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-15028c96.3.21.so
    /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy.libs/libquadmath-96973f99.so.0.0.0
    /home/mona/anaconda3/envs/oneposeplus/lib/python3.10/site-packages/numpy/*
Proceed (Y/n)? y
  Successfully uninstalled numpy-1.24.3
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ numpy==1.23.1
(oneposeplus) mona@ard-gpu-01:~/OnePose_Plus_Plus$ pip install numpy==1.23.1
Collecting numpy==1.23.1
  Downloading numpy-1.23.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.0/17.0 MB 29.5 MB/s eta 0:00:00
Installing collected packages: numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
open3d 0.16.0 requires nbformat==5.5.0, but you have nbformat 5.9.0 which is incompatible.
Successfully installed numpy-1.23.1