isl-org / Open3D-ML

An extension of Open3D to address 3D Machine Learning tasks
Other
1.85k stars 318 forks source link

FileNotFoundError: File /ml3d/configs/randlanet_semantickitti.yml not found #351

Closed Ed0flower93 closed 3 years ago

Ed0flower93 commented 3 years ago

Hi, I am trying to use open3d and I can open the "reading datasets" correctly. But when I try the "loading config file" I get this error:

Traceback (most recent call last): File "/home/edoardo/Documenti/Open3D_documents/Loading_config_file.py", line 6, in cfg = _ml3d.utils.Config.load_from_file(cfg_file) File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/_ml3d/utils/config.py", line 212, in load_from_file raise FileNotFoundError(f'File {filename} not found') FileNotFoundError: File /ml3d/configs/randlanet_semantickitti.yml not found

I've tried changing the path but I can't figure out where the error is. I hope for your help.

Thanks

sanskar107 commented 3 years ago

@Ed0flower93 the path you've given starts with / (root), which is invalid. Could you recheck the path or post the exact script you are using?

Ed0flower93 commented 3 years ago

Sure, This is my script and I simply change the dataset root. I also try to put the absolute path from the terminal but i got the same error. This is my script:

import open3d.ml as _ml3d import open3d.ml.torch as ml3d # or open3d.ml.tf as ml3d

framework = "torch" # or tf cfg_file = "ml3d/configs/randlanet_semantickitti.yml" cfg = _ml3d.utils.Config.load_from_file(cfg_file)

fetch the classes by the name

Pipeline = _ml3d.utils.get_module("pipeline", cfg.pipeline.name, framework) Model = _ml3d.utils.get_module("model", cfg.model.name, framework) Dataset = _ml3d.utils.get_module("dataset", cfg.dataset.name)

use the arguments in the config file to construct the instances

cfg.dataset['dataset_path'] = "/media/edoardo/LaCie/data_odometry_velodyne" dataset = Dataset(cfg.dataset.pop('dataset_path', None), cfg.dataset) model = Model(cfg.model) pipeline = Pipeline(model, dataset, **cfg.pipeline)

kylevedder commented 3 years ago

Is ml3d/configs/randlanet_semantickitti.yml the correct relative path to that config file? To sanity check it is, you ought to be able to run ls ml3d/configs/randlanet_semantickitti.yml from within the same folder as your script and have it successfully find the file.

I suspect your custom script is sitting inside another folder and ml3d/configs/randlanet_semantickitti.yml is not the correct relative path to that config file.

Ed0flower93 commented 3 years ago

Thank you very much, now it works. I have also another problem with the semantic segmentation script:

import os import open3d._ml3d as _ml3d import open3d.ml3d.torch as ml3d

cfg_file = "ml3d/configs/randlanet_semantickitti.yml" cfg = _ml3d.utils.Config.load_from_file(cfg_file)

model = ml3d.models.RandLANet(cfg.model) cfg.dataset['dataset_path'] = "media/edoardo/LaCie/data_odometry_velodyne" dataset = ml3d.datasets.SemanticKITTI(cfg.dataset.pop('dataset_path', None), cfg.dataset) pipeline = ml3d.pipelines.SemanticSegmentation(model, dataset=dataset, device="gpu", **cfg.pipeline)

The error is the following one:

Traceback (most recent call last): File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/Semantic_segmentation.py", line 10, in dataset = ml3d.datasets.SemanticKITTI(cfg.dataset.pop('dataset_path', None), **cfg.dataset) AttributeError: module 'open3d.ml3d.torch' has no attribute 'datasets'

I already tried to add the dataset foldet to the torch folder but it is still there.

Thanks again for your support

kylevedder commented 3 years ago

It should be import open3d.ml.torch as ml3d.

As a test of this, I was able to run the following script

python -c "import open3d.ml.torch as ml3d; foo = ml3d.datasets.SemanticKITTI; print(foo)"

which printed

<class 'ml3d.datasets.semantickitti.SemanticKITTI'>
Ed0flower93 commented 3 years ago

Thanks a lot for your support, I did the correction and the test was completed correctly as you suggested, but the script show me another error, maybe caused from the datasets:

INFO - 2021-08-12 16:10:51,750 - semantic_segmentation - Loading checkpoint ./logs/randlanet_semantickitti_202009090354utc.pth Traceback (most recent call last): File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/Semantic_segmentation.py", line 25, in test_split = dataset.get_split("test") File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/_ml3d/datasets/semantickitti.py", line 147, in get_split return SemanticKITTISplit(self, split=split) File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/_ml3d/datasets/semantickitti.py", line 262, in init super().init(dataset, split=split) File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/_ml3d/datasets/base_dataset.py", line 124, in init path_list = dataset.get_split_list(split) File "/home/edoardo/.local/lib/python3.6/site-packages/open3d/_ml3d/datasets/semantickitti.py", line 252, in get_split_list [join(pc_path, f) for f in np.sort(os.listdir(pc_path))]) FileNotFoundError: [Errno 2] File o directory non esistente: 'media/edoardo/LaCie/data_odometry_velodyne/dataset/sequences/11/velodyne'

I don't know why on the folder 11 and not in the first folder. I have no idea. Thank you again

kylevedder commented 3 years ago

This is the root cause:

FileNotFoundError: [Errno 2] File o directory non esistente: 'media/edoardo/LaCie/data_odometry_velodyne/dataset/sequences/11/velodyne'

Your path needs to be an absolute path to the /media directory but you don't have the preceding /; it should be /media/edoardo/LaCie/data_odometry_velodyne/dataset/sequences/11/velodyne

Two of the errors you have written about in this thread have stemmed from incorrect relative or absolute file paths. I suggest that you read up on how relative and absolute file paths work so that you don't need to ask other people how to fix these "file not found" issues.

Ed0flower93 commented 3 years ago

You're right, so I'll only bother you for important things. One last thing, is it possible to acquire and create your own datasets with a depth camera such as the intel realsense d435?

Thank you very much

kylevedder commented 3 years ago

Yes, see ml3d/datasets/customdataset.py in this repo for details.