This folder provides a monocular depth estimation sample using ailia SDK. The scene is DepthEstimation/DepthEstimationSample.unity, driven by DepthEstimation/AiliaDepthEstimatorsSample.cs.
- MiDaS
- Purpose: Predict dense relative depth from a single RGB image.
- Source:
./AiliaDepthEstimatorsSample.cs - Script behavior: Downloads
midas.onnx(+.onnx.prototxt), opens it viaAiliaModel, and feeds a preprocessed camera/frame image. Uses a compute shader (optional) or CPU to prepare ImageNet‑style normalized input. Postprocess scales and normalizes output to a grayscale depth map and renders it to aRawImage.
midas.onnx(+midas.onnx.prototxt) — downloaded toApplication.temporaryCachePathviaAiliaDownload.
- Create and open the model:
var model = new AiliaModel();model.OpenFile(pathToPrototxt, pathToOnnx);
- Input preparation:
- Resize your image to the model input shape from
model.GetInputShape(). - Normalize as in
InputDataProcessingCPU/InputDataProcessingPSP(ImageNet mean/std, channel‑first when required).
- Resize your image to the model input shape from
- Run inference and visualize:
model.Predict(output, input);- Map output to 0–255 and draw to a texture (see
LabelPaintMidas).
- Sample controller:
./AiliaDepthEstimatorsSample.cs