modosaic.depth.validators.impl.imagebind¶
modosaic.depth.validators.impl.imagebind ¶
ImageBindValidator ¶
ImageBindValidator(generation_model)
Bases: DepthValidator[float]
Validate depth-image consistency with ImageBind embeddings.
Initialize the validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generation_model
|
DepthGenerationModel
|
Depth model used to generate the depth map. The value informs metric-vs-relative depth normalization. |
required |
Source code in modosaic/depth/validators/impl/imagebind.py
39 40 41 42 43 44 45 46 47 48 | |
depth_np_to_imagebind_depth ¶
depth_np_to_imagebind_depth(depth, assume_metric=None, prefer_disparity=True, use_log_for_metric=True, p_lo=1.0, p_hi=99.0, eps=1e-06)
Convert a depth map to ImageBind depth input format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth
|
ndarray
|
Generated depth map. |
required |
assume_metric
|
bool | None
|
Whether to treat values as metric depth. If omitted, a heuristic is used. |
None
|
prefer_disparity
|
bool
|
Whether metric depth should be converted to inverse-depth style values. |
True
|
use_log_for_metric
|
bool
|
Whether metric depth should be log-compressed
when |
True
|
p_lo
|
float
|
Lower percentile for robust normalization. |
1.0
|
p_hi
|
float
|
Upper percentile for robust normalization. |
99.0
|
eps
|
float
|
Numerical stability constant. |
1e-06
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Torch tensor ready for ImageBind depth input. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the depth map has no finite values. |
Source code in modosaic/depth/validators/impl/imagebind.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
validate ¶
validate(record, generated)
Score agreement between the source image and generated depth map.
Source code in modosaic/depth/validators/impl/imagebind.py
54 55 56 57 58 59 60 61 62 63 64 65 66 | |