From 52264d67ecaf43fa3dd33ad2021c4a61cbccc86c Mon Sep 17 00:00:00 2001 From: Maciej Wielgosz <maciej.wielgosz@nibio.no> Date: Wed, 9 Nov 2022 12:16:15 +0100 Subject: [PATCH] small updates in metrics and helper functions --- .../get_small_data_for_playground.sh | 21 +++++++++++-------- .../get_terrestial_sem_seg_validation.sh | 8 +++++++ ...instance_segmentation_metrics_in_folder.py | 8 ------- nibio_preprocessing/tiling.py | 4 ++-- pipeline_test.py | 2 -- python_wrapper_over_run_sh.py | 0 run_all_command_line.sh | 2 +- 7 files changed, 23 insertions(+), 22 deletions(-) create mode 100755 bash_helper_scripts/get_terrestial_sem_seg_validation.sh delete mode 100644 python_wrapper_over_run_sh.py diff --git a/bash_helper_scripts/get_small_data_for_playground.sh b/bash_helper_scripts/get_small_data_for_playground.sh index a5d4c9e..fe1fd63 100755 --- a/bash_helper_scripts/get_small_data_for_playground.sh +++ b/bash_helper_scripts/get_small_data_for_playground.sh @@ -1,13 +1,16 @@ -SOURCE_FOLDER=/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground -rm -rf $SOURCE_FOLDER/* +TARGET_FOLDER=/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/maciek +rm -rf $TARGET_FOLDER/* -cp /home/nibio/mutable-outside-world/data/small_file_pipeline_test/small_file_pipeline_test.las \ -/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground +cp /home/nibio/mutable-outside-world/data/small_file_pipeline_test/small_file_pipeline_test.las $TARGET_FOLDER # change name of the file to first.laz -mv /home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/small_file_pipeline_test.las \ -/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/first.las +mv $TARGET_FOLDER/small_file_pipeline_test.las $TARGET_FOLDER/first.las -# copy first.laz to second.laz -cp /home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/first.las \ -/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/second.las \ No newline at end of file +# make a copy of the file +cp $TARGET_FOLDER/first.las $TARGET_FOLDER/second.las + +# # make a copy of the file +# cp $TARGET_FOLDER/first.las $TARGET_FOLDER/third.las + +# # make a copy of the file +# cp $TARGET_FOLDER/first.las $TARGET_FOLDER/fourth.las \ No newline at end of file diff --git a/bash_helper_scripts/get_terrestial_sem_seg_validation.sh b/bash_helper_scripts/get_terrestial_sem_seg_validation.sh new file mode 100755 index 0000000..782d436 --- /dev/null +++ b/bash_helper_scripts/get_terrestial_sem_seg_validation.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +TARGET_FOLDER=/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground +# clean the folder +rm -rf $TARGET_FOLDER/* + +cp /home/nibio/mutable-outside-world/data/terestial_data_for_training_sem_seg_model/validation/*.las $TARGET_FOLDER + diff --git a/metrics/instance_segmentation_metrics_in_folder.py b/metrics/instance_segmentation_metrics_in_folder.py index b9e6509..23b6f4e 100644 --- a/metrics/instance_segmentation_metrics_in_folder.py +++ b/metrics/instance_segmentation_metrics_in_folder.py @@ -7,14 +7,10 @@ class InstanceSegmentationMetricsInFolder(): self, gt_las_folder_path, target_las_folder_path, - gt_label_name='gt_label', #TODO: implement the same as in the instance_segmentation_metrics.py - target_label_name='target_label', #TODO: implement the same as in the instance_segmentation_metrics.py verbose=False ): self.gt_las_folder_path = gt_las_folder_path self.target_las_folder_path = target_las_folder_path - self.gt_label_name = gt_label_name - self.target_label_name = target_label_name self.verbose = verbose def main(self): @@ -80,8 +76,6 @@ if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--gt_las_folder_path', type=str, required=True) parser.add_argument('--target_las_folder_path', type=str, required=True) - parser.add_argument('--gt_label_name', type=str, default='gt_label') - parser.add_argument('--target_label_name', type=str, default='target_label') parser.add_argument('--verbose', action='store_true', help="Print information about the process") args = parser.parse_args() @@ -89,8 +83,6 @@ if __name__ == '__main__': instance_segmentation_metrics_in_folder = InstanceSegmentationMetricsInFolder( args.gt_las_folder_path, args.target_las_folder_path, - gt_label_name=args.gt_label_name, - target_label_name=args.target_label_name, verbose=args.verbose ) diff --git a/nibio_preprocessing/tiling.py b/nibio_preprocessing/tiling.py index f854eb6..b9186ef 100644 --- a/nibio_preprocessing/tiling.py +++ b/nibio_preprocessing/tiling.py @@ -1,4 +1,5 @@ import argparse +from joblib import Parallel, delayed import pdal import os, glob import json @@ -84,8 +85,7 @@ class Tiling: files = glob.glob(self.input_folder + "/*.ply") # loop through all the files - for file in tqdm(files): - self.do_tiling_of_single_file(file) + Parallel(n_jobs=(os.cpu_count() - 2))(delayed(self.do_tiling_of_single_file)(file) for file in tqdm(files)) def convert_single_file_from_las_to_ply(self, file): """ diff --git a/pipeline_test.py b/pipeline_test.py index e43b5a2..ec8de94 100644 --- a/pipeline_test.py +++ b/pipeline_test.py @@ -92,8 +92,6 @@ def main(): metric = InstanceSegmentationMetricsInFolder( gt_las_folder_path = '/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/results/input_data', target_las_folder_path = '/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground/results/instance_segmented_point_clouds_with_ground', - gt_label_name='treeID', - target_label_name='treeID', verbose=True ) diff --git a/python_wrapper_over_run_sh.py b/python_wrapper_over_run_sh.py deleted file mode 100644 index e69de29..0000000 diff --git a/run_all_command_line.sh b/run_all_command_line.sh index e70a422..696c516 100755 --- a/run_all_command_line.sh +++ b/run_all_command_line.sh @@ -161,7 +161,7 @@ for d in $data_folder/segmented_point_clouds/tiled/*/; do python fsct/run.py \ --model /home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/fsct/model/model.pth \ --point-cloud $f \ - --batch_size 5 \ + --batch_size 10 \ --odir $d \ --verbose \ # --tile-index $d/tile_index.dat \ -- GitLab