diff --git a/myria3d/pctl/dataset/utils.py b/myria3d/pctl/dataset/utils.py index e2ee89ed..6b2e5960 100644 --- a/myria3d/pctl/dataset/utils.py +++ b/myria3d/pctl/dataset/utils.py @@ -30,9 +30,7 @@ def find_file_in_dir(data_dir: str, basename: str) -> str: return files[0] -def get_mosaic_of_centers( - tile_width: Number, subtile_width: Number, subtile_overlap: Number = 0 -): +def get_mosaic_of_centers(tile_width: Number, subtile_width: Number, subtile_overlap: Number = 0): if subtile_overlap < 0: raise ValueError("datamodule.subtile_overlap must be positive.") @@ -62,9 +60,7 @@ def pdal_read_las_array(las_path: str): def pdal_read_las_array_as_float32(las_path: str): """Read LAS as a a named array, casted to floats.""" arr = pdal_read_las_array(las_path) - all_floats = np.dtype( - {"names": arr.dtype.names, "formats": ["f4"] * len(arr.dtype.names)} - ) + all_floats = np.dtype({"names": arr.dtype.names, "formats": ["f4"] * len(arr.dtype.names)}) return arr.astype(all_floats) @@ -125,13 +121,9 @@ def split_cloud_into_samples( """ points = pdal_read_las_array_as_float32(las_path) - pos = np.asarray( - [points["X"], points["Y"], points["Z"]], dtype=np.float32 - ).transpose() + pos = np.asarray([points["X"], points["Y"], points["Z"]], dtype=np.float32).transpose() kd_tree = cKDTree(pos[:, :2] - pos[:, :2].min(axis=0)) - XYs = get_mosaic_of_centers( - tile_width, subtile_width, subtile_overlap=subtile_overlap - ) + XYs = get_mosaic_of_centers(tile_width, subtile_width, subtile_overlap=subtile_overlap) for center in XYs: radius = subtile_width // 2 # Square receptive field. minkowski_p = np.inf @@ -160,9 +152,7 @@ def get_las_paths_by_split_dict( for phase in ["train", "val", "test"]: basenames = split_df[split_df.split == phase].basename.tolist() # Reminder: an explicit data structure with ./val, ./train, ./test subfolder is required. - las_paths_by_split_dict[phase] = [ - str(Path(data_dir) / phase / b) for b in basenames - ] + las_paths_by_split_dict[phase] = [str(Path(data_dir) / phase / b) for b in basenames] if not las_paths_by_split_dict: raise FileNotFoundError(