diff --git a/Dockerfile b/Dockerfile index db1c725c93352d57321147d97b55b2de9675a50e..a3b9d198b96ff3876aad7ca188c91d45c6e489fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,10 @@ COPY . /app WORKDIR /app -ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper.py"] +# ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper.py"] + +ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper_local.py"] + diff --git a/check_list.info b/check_list.info new file mode 100644 index 0000000000000000000000000000000000000000..c4d464f6cfe99e138374bf2d2226cafe658642bd --- /dev/null +++ b/check_list.info @@ -0,0 +1,4 @@ +Dockerfile - set correct oracle wrapper +build.sh +run_oracle_wrapper.py or run_oracle_wrapper_local.py -> set paths +config.yaml -> pick segmentation or instance segmentation \ No newline at end of file diff --git a/config/config.yaml b/config/config.yaml index f3ef2f2afaae46db6c76c6fd952c5761cb4e7c85..3e9b2e88d4b3150b627bec7c4a3ae0fb4e9ce5e5 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -3,7 +3,7 @@ general: output_folder: 'local_output_folder' clean_output_folder: false run_sematic_segmentation: true - run_instance_segmentation: true + run_instance_segmentation: false label_formats: label_for_instances_in_gt: 'treeID' label_for_instances_in_predicted: 'instance_nr' diff --git a/d_run.sh b/d_run.sh index 4feaeb67b9d6675d437e0a5b264600e97b6eaa83..e7ee4266ea9833947f5ee0cb5c8dda4a2881c2ca 100644 --- a/d_run.sh +++ b/d_run.sh @@ -4,6 +4,10 @@ docker image rm nibio/pc-geoslam-oracle ./build.sh echo "Running the container" # docker run --gpus all --name test_oracle nibio/pc-geoslam-oracle -docker run -it --gpus all --name test_oracle nibio/pc-geoslam-oracle +docker run -it --gpus all \ + --name test_oracle \ + --mount type=bind,source=/home/nibio/mutable-outside-world/code/oracle_deploy/instance_segmentation_classic/local_folder_out/las_files,target=/app/local_folder_out/las_files \ + nibio/pc-geoslam-oracle + diff --git a/run_oracle_wrapper_local.py b/run_oracle_wrapper_local.py new file mode 100644 index 0000000000000000000000000000000000000000..180160c274ea2a9c2cf82f85f370efa8d67839c9 --- /dev/null +++ b/run_oracle_wrapper_local.py @@ -0,0 +1,61 @@ +# This is the the file to be run on the oracle cloud + +import oci +import argparse +import os +import io +import shutil +import yaml + +from run import main + +def run_oracle_wrapper(path_to_config_file): + + # read the config file from config folder + with open(path_to_config_file) as f: + config_flow_params = yaml.load(f, Loader=yaml.FullLoader) + + # read system environment variables + # input_location = os.environ['OBJ_INPUT_LOCATION'] + # output_location = os.environ['OBJ_OUTPUT_LOCATION'] + + # remap the input and output locations + # input_location = input_location.replace("@axqlz2potslu", "").replace("oci://", "/mnt/") + # output_location = output_location.replace("@axqlz2potslu", "").replace("oci://", "/mnt/") + + input_location = "local_folder_in/las_files/" + output_location = "local_folder_out/las_files/" + + # copy files from input_location to the input folder + shutil.copytree(input_location, config_flow_params['general']['input_folder']) + + # run the main function + main(path_to_config_file) + + # instance segmentation is set to true + if config_flow_params['general']['run_instance_segmentation']: + path_to_the_output_folder = os.path.join(config_flow_params['general']['output_folder'], 'instance_segmented_point_clouds_with_ground') + else: + path_to_the_output_folder = config_flow_params['general']['output_folder'] + + # zip the files in path_to_the_output_folder + zip_file_name = 'results' + shutil.make_archive(zip_file_name, 'zip', path_to_the_output_folder) # this will be done in the current folder + shutil.copy('results.zip', path_to_the_output_folder) + + # copy the zip file and other files to the output location + for filename in os.listdir(path_to_the_output_folder): + src_file = os.path.join(path_to_the_output_folder, filename) + dst_file = os.path.join(output_location, filename) + shutil.copy(src_file, dst_file) + +if __name__ == '__main__': + # use argparse to get the path to the config file + parser = argparse.ArgumentParser() + parser.add_argument("--path_to_config_file", type=str, default="./config/config.yaml") + args = parser.parse_args() + + # run the main function + print('Running the main function in run_oracle_wrapper.py') + run_oracle_wrapper(args.path_to_config_file) +