Esempio n. 1
0
 def get_dataset_size(cls, dataset_type):
     dataset_type = dataset_type.lower()
     assert dataset_type in ["train", "validation", "validation-all"]
     while True:
         try:
             cls.CACHED_DATASET_SIZE
         except:
             cls.CACHED_DATASET_SIZE = {}
         try:
             return cls.CACHED_DATASET_SIZE[dataset_type]
         except:
             base_path = file_utilities.path_join(file_utilities.path_join(cls.DATASET_ROOT, cls._SUB_PATHS[6]), dataset_type)
             valid_items = [int(item) for item in os.listdir(base_path) if item.isdigit()]
             assert max(valid_items) == len(valid_items) - 1
             cls.CACHED_DATASET_SIZE[dataset_type] = len(valid_items)
Esempio n. 2
0
    def final_dataset_path(dataset_type, sample_no):
        assert isinstance(sample_no, int)
        dataset_type = dataset_type.lower()
        assert dataset_type in ["train", "validation", "validation-all"]

        final_dataset_root = file_utilities.path_join(DataFusionDataset.DATASET_ROOT, DataFusionDataset._SUB_PATHS[6])
        base_dir = file_utilities.path_join(file_utilities.path_join(final_dataset_root, dataset_type), str(sample_no))

        image_path_tiff = file_utilities.path_join(base_dir, "sample_{}_image.tiff".format(sample_no))
        semantic_label_path_npz = file_utilities.path_join(base_dir, "sample_{}_semantic_label.npz".format(sample_no))
        ndsm_path_npz = file_utilities.path_join(base_dir, "sample_{}_ndsm.npz".format(sample_no))

        image_path_png = file_utilities.path_join(base_dir, "sample_{}_image.png".format(sample_no))
        masked_building_path_png = file_utilities.path_join(base_dir, "sample_{}_masked_building.png".format(sample_no))

        return image_path_tiff, semantic_label_path_npz, ndsm_path_npz, image_path_png, masked_building_path_png
Esempio n. 3
0
 def get_semantic_label_path(img_id):
     gt_dir = DataFusionDataset.get_ground_truth_directory()
     img_fname = img_id + "_CLS.tif"
     abs_path = file_utilities.path_join(gt_dir, img_fname)
     return abs_path
Esempio n. 4
0
 def get_ndsm_path(img_id):
     gt_dir = DataFusionDataset.get_ground_truth_directory()
     img_fname = img_id + "_AGL.tif"
     abs_path = file_utilities.path_join(gt_dir, img_fname)
     return abs_path
Esempio n. 5
0
 def get_ground_truth_directory():
     gt_dir = file_utilities.path_join(DataFusionDataset.DATASET_ROOT, DataFusionDataset._SUB_PATHS[5])
     return gt_dir