ONNX Copernicus Node with depth anything V2

   2861   5   2
User Avatar
Member
20 posts
Joined: April 2018
Offline
Hi, I am getting an error when using the COPs ONNX Inference node. I am trying to convert images to depth maps with depth anything V2 and their onnx files. Here is the link to the Models: https://github.com/fabio-sim/Depth-Anything-ONNX [github.com]

I am getting the error: First dimensions of the model output tensor doesn't divide into 3 channels

here some screenshots. I am not sure what the problem is. Maybe someone can give me a pointer!


Best
Josh

Attachments:
chrome_FUuE0pkUzO.jpg (658.3 KB)
chrome_LbhJeCMdGX.jpg (658.7 KB)

User Avatar
Staff
640 posts
Joined: Aug. 2019
Offline
It should work if you set it like this:
Edited by johnmather - Feb. 10, 2025 14:06:54

Attachments:
onnx1.png (58.7 KB)
onnx2.png (57.6 KB)

User Avatar
Member
20 posts
Joined: April 2018
Offline
hey John,

thanks for the quick reply. I assume I am missing something cause my node throws this error:


Error
The specified output shape must be the same length as the model's output shape length. output index : 0 , specified length : 4 , model shape length : 3


Also, How did you find out what to put in the settings?

Best and Thanks,
Josh

Attachments:
chrome_INmH2R8LfG.png (319.4 KB)
chrome_KTrlM5b9mb.png (188.7 KB)
chrome_LbhJeCMdGX.jpg (658.7 KB)
Recipe_ONNX_AnyhtingDepth_20250210.hdalc (6.9 KB)

User Avatar
Staff
640 posts
Joined: Aug. 2019
Offline
Sorry, the settings above apply to V1, not V2.

To get V2 working, I did the following:

1. Load your source image with a File COP
2. Plug it into a Bright COP with the shift set to -0.45
3. Plug that into an ONNX COP.
4. Load the model file and press "Setup Shapes from Model"
5. Under "Number of Outputs" #1, check the box next to Channel Size and set it to 1
6. Go to the Input & Output tab
7. Check the box next to "Resample Size" and set it to 518x518
8. Under "Number of Outputs" #1, set the Output Tensor Shape to 1 518 518, 1 0 0, 0 0 0.
9. Check the box next to "Channel Size" and set it to 1.
10. Plug this node into an equalize node to view the output.
Edited by johnmather - Feb. 11, 2025 00:04:48
User Avatar
Member
20 posts
Joined: April 2018
Offline
Hey sorry for the late reply,

I got it working but never got around to sending a proper reply. I got it to work with these settings in the end. For me the question still remains of how I would be able to find information on what to set my tensor shapes to etc. I am not familiar with the topic of machine learning at all (I am more of a art artist than tech artist), but I think me and many more people would love to see some content on how to use onnx nodes and models in houdini. It is mega powerful and boradly applicable!

Anyways I hugley appreciate the community here and since ZBrush, Houdini is the only 3D tool that managed to make fall in love with it (ෆ˙ᵕ˙ෆ)♡!

(ෆ˙ᵕ˙ෆ)

Attachments:
houdini_zPVQeE0Rmh.png (106.2 KB)

User Avatar
Member
9 posts
Joined: May 2020
Offline
Hi,

thanks to your posts I've successfully configured AnyDepth v2, merci!
Now I'd like to test Apple Depth Pro [github.com] - supposedly it does perform better especially on details and contours compared to any other depth estimation model.

Unfortunately I keep getting errors in the Onyx COP node. How can one discover the parameters to use in the node?

Here the Onyx files: https://huggingface.co/onnx-community/DepthPro-ONNX/tree/main/onnx [huggingface.co]



Edited by GSO - May 7, 2025 11:46:53

Attachments:
Screenshot_3.png (83.5 KB)
Screenshot_2.png (143.7 KB)
Screenshot_1.png (102.4 KB)

  • Quick Links