MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / load_and_prepare_confidence

Function load_and_prepare_confidence

train.py:63–85  ·  view source on GitHub ↗

Loads, normalizes, inverts, and scales confidence values to obtain learning rate modifiers. Args: confidence_path (str): Path to the .npy confidence file. device (str): Device to load the tensor onto. scale (tuple): Desired range for the learning rate modifiers.

(confidence_path, device='cuda', scale=(0.1, 1.0))

Source from the content-addressed store, hash-verified

61
62
63def load_and_prepare_confidence(confidence_path, device='cuda', scale=(0.1, 1.0)):
64 """
65 Loads, normalizes, inverts, and scales confidence values to obtain learning rate modifiers.
66
67 Args:
68 confidence_path (str): Path to the .npy confidence file.
69 device (str): Device to load the tensor onto.
70 scale (tuple): Desired range for the learning rate modifiers.
71
72 Returns:
73 torch.Tensor: Learning rate modifiers.
74 """
75 # Load and normalize
76 confidence_np = np.load(confidence_path)
77 confidence_tensor = torch.from_numpy(confidence_np).float().to(device)
78 normalized_confidence = torch.sigmoid(confidence_tensor)
79
80 # Invert confidence and scale to desired range
81 inverted_confidence = 1.0 - normalized_confidence
82 min_scale, max_scale = scale
83 lr_modifiers = inverted_confidence * (max_scale - min_scale) + min_scale
84
85 return lr_modifiers
86
87
88def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoint_iterations, checkpoint, debug_from):

Callers 1

trainingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected