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

update after the paper experiments

parent c87eea8b
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
TARGET_FOLDER=/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/maciek_optimized
# clean the folder
rm -rf $TARGET_FOLDER/*
cp -r /home/nibio/mutable-outside-world/data/austrian_data_after_seg/* $TARGET_FOLDER
#!/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 -r /home/nibio/mutable-outside-world/data/austrian_data_after_seg_sean/* $TARGET_FOLDER
...@@ -6,7 +6,7 @@ cp /home/nibio/mutable-outside-world/data/small_file_pipeline_test/small_file_pi ...@@ -6,7 +6,7 @@ cp /home/nibio/mutable-outside-world/data/small_file_pipeline_test/small_file_pi
# change name of the file to first.laz # change name of the file to first.laz
mv $TARGET_FOLDER/small_file_pipeline_test.las $TARGET_FOLDER/first.las mv $TARGET_FOLDER/small_file_pipeline_test.las $TARGET_FOLDER/first.las
# # make a copy of the file # make a copy of the file
# cp $TARGET_FOLDER/first.las $TARGET_FOLDER/second.las # cp $TARGET_FOLDER/first.las $TARGET_FOLDER/second.las
# # make a copy of the file # # make a copy of the file
......
import os
from collections import Counter
import laspy
def main (folder_path):
# Define the path to the folder containing the LAS files
# folder_path = "/home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/sample_playground"
# Define the class codes you want to count
class_codes = [0, 1, 2, 3, 4]
# Define a dictionary to hold the counts for each class
class_counts = {class_code: 0 for class_code in class_codes}
# Iterate through the files in the folder
for file_name in os.listdir(folder_path):
if file_name.endswith(".las"):
# Open the LAS file using laspy
las_file = laspy.read(os.path.join(folder_path, file_name))
# Count the points in each class and update the class_counts dictionary
point_classes = Counter(las_file.label)
for class_code in class_codes:
class_counts[class_code] += point_classes[class_code]
# Define the names of the classes
names = ["ignore", "terrain", "vegetation", "CWD ", "stem"]
# Print the class counts
print("Class counts:")
for class_code in class_codes:
print(f"Class {names[class_code]}: {class_counts[class_code]}")
# print it in percentages
print("Class counts in percentages:")
for class_code in class_codes:
print(f"Class {names[class_code]}: {class_counts[class_code] / sum(class_counts.values()) * 100:.2f} %")
if __name__ == "__main__":
# use argparse to parse the command line arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--folder_path", help="Path to the folder containing the LAS files")
args = parser.parse_args()
main(args.folder_path)
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
############################ parameters ################################################# ############################ parameters #################################################
# General parameters # General parameters
CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder
CONDA_ENV="pdal-env" # conda environment for running the pipeline CONDA_ENV="pdal-env-1" # conda environment for running the pipeline
# Tiling parameters # Tiling parameters
data_folder="" # path to the folder containing the data data_folder="" # path to the folder containing the data
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
############################ parameters ################################################# ############################ parameters #################################################
# General parameters # General parameters
CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder
CONDA_ENV="pdal-env" # conda environment for running the pipeline CONDA_ENV="pdal-env-1" # conda environment for running the pipeline
# Tiling parameters # Tiling parameters
data_folder="" # path to the folder containing the data data_folder="" # path to the folder containing the data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment