Utils package

Package containing various util files.

Utils.dry_spot_detection_leoben

  • Enter a path wich shall be scanned in the code.
  • Run it and keep the stdout.
  • Use the following snippets to get out the runs with atypical behaviour:
cat dryspots.txt | grep '\[\]' | grep -x '.\{220,600\}' > dryspots_filtered.txt

cat dryspots_filtered.txt | cut -c 30-59 > blacklist.txt
Utils.dry_spot_detection_leoben.create_triangle_mesh(file_path)
Utils.dry_spot_detection_leoben.dry_spot_analysis(file_path, triang: matplotlib.tri.triangulation.Triangulation, Xi: numpy.ndarray, Yi: numpy.ndarray, xi: numpy.ndarray, yi: numpy.ndarray, change_meta_file=False, save_flowfront_img=False, output_dir_imgs=None, silent=False, detect_useless=False)
Parameters:
  • save_flowfront_img – if true, saves all intermediate image representations to the output_dir_imgs
  • silent (bool) – mute debug output
  • detect_useless (bool) – frames that are 100% filled are not usefull for training. This function can mark these frames as useless and add them to the metadata file
  • change_meta_file (bool) – if true, writes dryspots and useless frames into the meta file
  • yi – see create_triangle_mesh
  • xi – see create_triangle_mesh
  • Yi – see create_triangle_mesh
  • Xi – see create_triangle_mesh
  • triang – see create_triangle_mesh
  • output_dir_imgs – A output folder if the images should be saved
  • file_path (Path) – a erfh5 file which is checked for dryspots
Returns:

the starting points of time windows with dryspots spot_list_e (list): endpoints of time windows wiht dryspots. spotlist_s[2] - spotlist_e[2] would be

the third dryspot window

deltas_prob (list): contains big jumps in probability of dryspot during a run

Return type:

spot_list_s (list)

Utils.dry_spot_detection_leoben.main()
Utils.dry_spot_detection_leoben.multiprocess_wrapper(triang, Xi, Yi, xi, yi, curr_path, i)

Utils.eval_utils

The SINGULARITY_DOCKER_PASSWORD is inserted automatically now. Make sure to insert the current docker container: Current state of the art: pytorch_19.10

Utils.eval_utils.calc_ccc_global(path)
Utils.eval_utils.calc_ccc_mean(path)
Utils.eval_utils.eval_preparation(save_path)

Saves the current repository code and generates a SLURM script to evaluate a trained model more easily.

Parameters:
  • save_path – directory the trained model is stored in
  • abs_file_path – absolute file path to the evaluation script to use for testing
Utils.eval_utils.run_ccc_calculations()
Utils.eval_utils.run_eval_w_binary_classificator(output_dir, modeltrainer, chkp_p: pathlib.Path)

Utils.img_utils

Utils.img_utils.create_np_image(target_shape=(143, 111), norm_coords=None, data=None)
Utils.img_utils.flip_array_diag(arr)

Utils.logging_cfg

Utils.logging_cfg.apply_logging_config(save_path, eval=False)

Utils.natural_sorting

Utils.natural_sorting.natural_sort_key(s, _nsre=re.compile('([0-9]+)'))

Utils.training_utils

class Utils.training_utils.CheckpointingStrategy

Bases: enum.Enum

Enum for specifying which checkpoints are stored during training. Best: Only the checkpoint with model’s best performance is stored. All: All checkpoints are stored.

All = 2
Best = 1
Utils.training_utils.apply_blacklists(_data_source_paths)
Utils.training_utils.count_parameters(model)
Utils.training_utils.read_cmd_params()
Utils.training_utils.transform_to_tensor_and_cache(i, separate_set_list, num=0, s_path=None)

Utils.useless_frame_detection

Utils.useless_frame_detection.mark_useless_frames(root_dir)
Utils.useless_frame_detection.mark_useless_frames_in_file(file)