Skip to content
Snippets Groups Projects
Commit a3905422 authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

instance segmentation in oracle cloud pipeline flow

parent 4c521019
No related branches found
No related tags found
No related merge requests found
general:
input_folder: 'some_path'
output_folder: 'some_path'
input_folder: './maciek'
output_folder: './maciek_results'
clean_output_folder: true
run_sematic_segmentation: true
run_instance_segmentation: false
run_instance_segmentation: true
label_formats:
label_for_instances_in_gt: 'treeID'
label_for_instances_in_predicted: 'instance_nr'
semantic_segmentation_params:
first: 'some'
sematic_segmentation_script: './run_bash_scripts/sem_seg_sean.sh'
tile_size: 10 # tile size in meters
min_density: 100 # minimum density of points in a tile(used for removing small tiles)
remove_small_tiles: 1 # 1: remove small tiles, 0: not remove small tiles
instance_segmentation_params:
instance_segmentation_script: './run_bash_scripts/tls.sh'
n_tiles: 3
slice_thickness: 0.5
find_stems_height: 1.5
find_stems_thickness: 0.5
graph_maximum_cumulative_gap: 3
add_leaves_voxel_length: 0.5
find_stems_min_points: 50
graph_edge_length: 1.0
add_leaves_edge_length: 1.0
\ No newline at end of file
......@@ -21,7 +21,7 @@ def main(path_to_config_file):
if not os.path.exists(config["general"]["output_folder"]):
os.mkdir(config["general"]["output_folder"])
### sematic segmentation section
### sematic segmentation section ###
if config["general"]["run_sematic_segmentation"]:
logger.info("Running semantic segmentation")
sem_seg_command = config["semantic_segmentation_params"]["sematic_segmentation_script"]
......@@ -44,11 +44,34 @@ def main(path_to_config_file):
logging.info("Running semantic segmentation with the arguments")
RunCommandBash(sem_seg_command, sem_seg_args)()
### instance segmentation section ###
if config["general"]["run_instance_segmentation"]:
logger.info("Running instance segmentation")
else:
logger.info("Not running instance segmentation")
ins_seg_command = config["instance_segmentation_params"]["instance_segmentation_script"]
# print the instance segmentation parameters
for key, value in config["instance_segmentation_params"].items():
logger.info(key + ": " + str(value))
# read all the parameters from the config file for the instance segmentation
ins_seg_args = []
ins_seg_args.extend([
"-d", str(config["general"]["input_folder"]),
"-n", str(config["instance_segmentation_params"]["n_tiles"]),
"-s", str(config["instance_segmentation_params"]["slice_thickness"]),
"-h", str(config["instance_segmentation_params"]["find_stems_height"]),
"-t", str(config["instance_segmentation_params"]["find_stems_thickness"]),
"-g", str(config["instance_segmentation_params"]["graph_maximum_cumulative_gap"]),
"-l", str(config["instance_segmentation_params"]["add_leaves_voxel_length"]),
"-m", str(config["instance_segmentation_params"]["find_stems_min_points"]),
"-o", str(config["instance_segmentation_params"]["graph_edge_length"]),
"-p", str(config["instance_segmentation_params"]["add_leaves_edge_length"])
])
# run the command with the arguments
logging.info("Running instance segmentation with the arguments")
RunCommandBash(ins_seg_command, ins_seg_args)()
# do cleaning up folders
if config["general"]["clean_output_folder"]:
......
......@@ -201,8 +201,6 @@ for segmented_point_cloud_in_ply in $data_folder/results/segmented_point_clouds/
--writers.las.extra_dims=all
done
python nibio_preprocessing/add_ground_to_inst_seg_folders.py --sem_seg_folder sample_playground/results/segmented_point_clouds/ --inst_seg_folder sample_playground/results/instance_segmented_point_clouds/ --output_folder sample_playground/instance_seg_with_ground --verbose
# create the instance segmented point clouds with ground folder
mkdir -p $data_folder/results/instance_segmented_point_clouds_with_ground
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment