Resource retrieval
Get the pre-trained net:
NetModel parameters
This model consists of a family of individual nets, each identified by a specific parameter combination. Inspect the available parameters:
Pick a non-default net by specifying the parameters:
Pick a non-default uninitialized net:
Basic usage
Define a test image:
Obtain the depth map of an image:
Show the depth map:
Visualize a 3D model
Get an image:
Obtain the depth map:
Visualize a 3D model using the depth map:
Adapt to any size
The net resizes the input image to 256x256 pixels and produces a depth map of the same size:
The recommended way to obtain a depth map with the same dimensions of the input image is to resample the depth map after the net evaluation. Get an image:
Obtain the depth map and resize it to match the original image dimensions:
Now modify the net, changing the image size in the NetEncoder. The new net natively produces a depth map of the original image's size:
Obtain the depth map from the new net and visualize it:
Compare the results. Notice that the depth map obtained by resizing the net output (top-right corner, depthMap1) more accurately predicts the depth of the roof lamp and the carpet but is less accurate at predicting the depth of the background furniture:
The first pipeline is also faster:
Net information
Inspect the number of parameters of all arrays in the net:
Obtain the total number of parameters:
Obtain the layer type counts:
Display the summary graphic:
Export to ONNX
Export the net to the ONNX format:
Get the size of the ONNX file:
The size is similar to the byte count of the resource object:
Check some metadata of the ONNX model:
Import the model back into Wolfram Language. However, the NetEncoder and NetDecoder will be absent because they are not supported by ONNX: