From 5bf6d532f77187fb9deff679225760384342cb28 Mon Sep 17 00:00:00 2001 From: David Novotny Date: Mon, 1 Aug 2022 14:08:19 -0700 Subject: [PATCH] Better error message when dataset root set wrongly in JsonIndexDatasetMapProviderV2 Summary: Reviewed By: bottler Differential Revision: D38314727 fbshipit-source-id: 7178b816a22b06af938a35c5f7bb88404fb1b1c4 --- .../dataset/json_index_dataset_map_provider_v2.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py b/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py index cbd1cf33..882af842 100644 --- a/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py +++ b/pytorch3d/implicitron/dataset/json_index_dataset_map_provider_v2.py @@ -177,6 +177,18 @@ class JsonIndexDatasetMapProviderV2(DatasetMapProviderBase): # pyre-ignore [13] path_manager = self.path_manager_factory.get() + if path_manager is not None: + path_managed_frame_file = path_manager.get_local_path(frame_file) + if not os.path.isfile(path_managed_frame_file): + # The frame_file does not exist. + # Most probably the user has not specified the root folder. + raise ValueError( + f"Looking for frame annotations in {path_managed_frame_file}." + + " Please specify a correct dataset_root folder." + + " Note: By default the root folder is taken from the" + + " CO3DV2_DATASET_ROOT environment variable." + ) + # setup the common dataset arguments common_dataset_kwargs = getattr(self, f"dataset_{self.dataset_class_type}_args") common_dataset_kwargs = {