Mono Depth Prediction
BiWAKO.MiDAS
MonoDepth prediction model.
Model
This is a pretrained MiDASv1 model. Currently available models are: - mono_depth_small - mono_depth_large
Attributes:
Name | Type | Description |
---|---|---|
model_path |
str |
Path to model file. If automatic download is triggered, this path is used to save the model. |
session |
onnxruntime.InferenceSession |
Inference session. |
input_name |
str |
Input node name. |
output_name |
str |
Output node name. |
input_shape |
tuple |
Input shape. |
h |
int |
Alias of input_shape[2]. |
w |
int |
Alias of input_shape[3]. |
__init__(self, model='mono_depth_small', show_exp=False)
special
Initialize model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
str |
Model name or path to the downloaded onnx file. Defaults to "mono_depth_small". Onnx file is downloaded automatically. |
'mono_depth_small' |
show_exp |
bool |
True to display expected input size. Defaults to False. |
False |
Examples:
predict(self, img)
Predict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
Union[str, np.ndarray] |
image path or numpy array in cv2 format |
required |
Returns:
Type | Description |
---|---|
np.ndarray |
predicted depthmap |
render(self, prediction, query)
Return the resized depth map in cv2 foramt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prediction |
np.ndarray |
predicted depthmap |
required |
query |
Union[str, np.ndarray] |
query image path or numpy array in cv2 format used for resizing. |
required |
Returns:
Type | Description |
---|---|
np.ndarray |
Resized depthmap |