Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion infer.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def get_pending_indices(dataset, output_dir):


def save_prediction_atomic(save_to, depth_pred):
"""Save without exposing a partially written final NPY file."""
"""
Save a depth prediction to the destination without exposing a partially written file.

Parameters:
save_to: Final path for the prediction file.
depth_pred: Prediction array to save.
"""
temporary_path = f"{save_to}.tmp"
with open(temporary_path, "wb") as temporary_file:
np.save(temporary_file, depth_pred)
Expand Down Expand Up @@ -204,6 +210,12 @@ def save_prediction_atomic(save_to, depth_pred):
seed_all(seed)

def check_directory(directory):
"""
Prompt for confirmation before continuing when the specified directory already exists.

Parameters:
directory (str): Path to the directory whose existence requires confirmation.
"""
if os.path.exists(directory):
response = (
input(
Expand Down