Skip to content

Qualcomm AI Engine Direct - Add depth_anything_v2_small to oss_scripts#18657

Open
zhaoxul-qti wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/zhaoxul/add_depth_anything_v2_small_to_oss_scripts
Open

Qualcomm AI Engine Direct - Add depth_anything_v2_small to oss_scripts#18657
zhaoxul-qti wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/zhaoxul/add_depth_anything_v2_small_to_oss_scripts

Conversation

@zhaoxul-qti
Copy link
Copy Markdown

Summary

  • Enable depth_anything_v2_small model (https://github.com/DepthAnything/Depth-Anything-V2) on HTP and integrates the script into oss_scripts/.
  • Provide --dump_example_output flag to dump the example image and export depth‑estimation images from both source model and QNN outputs.
  • Add unit tests to cover the added model.

Notes

  • SQNR is used for matrix evaluation as it provides a more intuitive comparison for our use case compared to AbsRel or RMSE referenced in the paper.
  • The model accepts input images of arbitrary resolutions. For evaluation, we use ImageNet samples, rather than the dataset cited in the original publication.

Constraints

  • The model is currently unsupported on GPU backend due to the unsupported cubic mode of Resize op.
  • GPU support will be enabled once constant folding is introduced, allowing the cubic Resize op to be eliminated.

Test plan

  • Test with random images from ImageNet:
    python examples/qualcomm/oss_scripts/depthanything_v2_small.py -a $ARTIFACT -d $IMAGENET_FOLDER_PATH -b build-android/ -H $HOST_NAME -s $DEVICE_ID -m $SOC_ID --seed 1126

  • Test with the example image and export the post-processed source model output and QNN output into depth-estimation images:
    python examples/qualcomm/oss_scripts/depthanything_v2_small.py -a $ARTIFACT -d $IMAGENET_FOLDER_PATH -b build-android/ -H $HOST_NAME -s $DEVICE_ID -m $SOC_ID --dump_example_output

Results

Example Image:
source

Source Model Output (with depth-estimation post-processing):
golden_depth

QNN-HTP Output (with depth-estimation post-processing):
prediction_depth

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 1, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18657

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 2 Unrelated Failures

As of commit 78460b3 with merge base c39a0ff (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Summary
- Enable **depth_anything_v2_small** model (https://github.com/DepthAnything/Depth-Anything-V2) on HTP and integrates the script into `oss_scripts/`.
- Provide `--dump_example_output` flag to dump the example image and export depth‑estimation images from both source model and QNN outputs.
- Add unit tests to cover the added model.

Test plan
- Test with random images from ImageNet:
`python examples/qualcomm/oss_scripts/depthanything_v2_small.py -a $ARTIFACT -d $IMAGENET_FOLDER_PATH -b build-android/ -H $HOST_NAME -s $DEVICE_ID -m $SOC_ID --seed 1126`
- Test with the example image and export the post-processed source model output and QNN output into depth-estimation images:
`python examples/qualcomm/oss_scripts/depthanything_v2_small.py -a $ARTIFACT -d $IMAGENET_FOLDER_PATH -b build-android/ -H $HOST_NAME -s $DEVICE_ID -m $SOC_ID --dump_example_output`
@zhaoxul-qti zhaoxul-qti force-pushed the dev1/zhaoxul/add_depth_anything_v2_small_to_oss_scripts branch from 54b4a61 to 78460b3 Compare April 1, 2026 22:26
@zhaoxul-qti
Copy link
Copy Markdown
Author

Hi @cccclai, @abhinaykukkadapu,

This PR is to add the model depth_anything_v2_small to qualcomm/oss_scripts. Would you mind helping to take a look?

Thanks,
Lambert

@abhinaykukkadapu
Copy link
Copy Markdown
Contributor

@zhaoxul-qti looks great, thanks for adding the support.

@zhaoxul-qti
Copy link
Copy Markdown
Author

Hi @abhinaykukkadapu,
Thanks for reviewing this PR.
It looks like the lintrunner failure is not caused by this PR. Could you take another look and help with the merge?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants