Skip to content

[DOC] Document common computer vision patterns#19518

Open
ymrohit wants to merge 1 commit into
pytorch:mainfrom
ymrohit:docathon-8831-cv-patterns
Open

[DOC] Document common computer vision patterns#19518
ymrohit wants to merge 1 commit into
pytorch:mainfrom
ymrohit:docathon-8831-cv-patterns

Conversation

@ymrohit
Copy link
Copy Markdown
Contributor

@ymrohit ymrohit commented May 12, 2026

Fixes #8831

Summary

  • Add an Advanced docs page for working with computer vision models in ExecuTorch.
  • Cover preprocessing placement, resize/crop behavior, dtype conversion, normalization, and NCHW versus NHWC tensor layouts.
  • Add Android Bitmap and iOS UIImage image-to-tensor examples, plus quick guidance for classifier, segmentation, detection, and instance segmentation outputs.
  • Link the page from the Advanced section, Advanced pathway, and Getting Started MobileNet flow.

Test plan

  • git diff --check origin/main..HEAD
  • python -m compileall -q docs/source/conf.py docs/source/custom_directives.py
  • PyTorch export smoke test for the preprocessing wrapper shown in the new page
  • cd docs && MPLCONFIGDIR=/tmp/matplotlib-executorch-8831 PYTHONPATH=../pip-out/lib.linux-x86_64-cpython-312 python -m sphinx -D plot_gallery=0 -b html --keep-going source _build/html source/working-with-cv-models.md source/advanced-topics-section.md source/pathway-advanced.md source/getting-started.md
  • Verified the rendered changed pages contain no local WARNING, ERROR, CRITICAL, system-message, or problematic artifacts

cc @mergennachin @AlannaBurke @byjlw

@ymrohit ymrohit requested a review from mergennachin as a code owner May 12, 2026 18:57
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 12, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 5 Unrelated Failures, 1 Unclassified Failure

As of commit 57a6fb7 with merge base e25369b (image):

NEW FAILURE - The following job has failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

  • periodic (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was 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 May 12, 2026
@github-actions github-actions Bot added docathon-2026 medium Medium Difficulty for issues as part of PyTorch Docathon H1 2026 module: doc Issues related to documentation, both in docs/ and inlined in code module: user experience Issues related to reducing friction for users triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels May 12, 2026
@ymrohit
Copy link
Copy Markdown
Contributor Author

ymrohit commented May 12, 2026

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label May 12, 2026
Copy link
Copy Markdown
Member

@GregoryComer GregoryComer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks really good. I tagged a couple of platform-specific experts on the Android and iOS details. Thanks!


The following Kotlin helper resizes a `Bitmap`, reads RGB pixels, applies ImageNet-style normalization, and packs the result as `NCHW` `float32` data for `Tensor.fromBlob`.

```kotlin
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psiddh @kirklandsign Could you take a look at the Android-specific code here? Thanks!


The following Swift helper draws a `UIImage` into an RGB buffer, normalizes it, and creates a channels-first `Tensor<Float>`.

```swift
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shoumikhin @metascroy Could you take a look at the iOS code here? 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. docathon-2026 medium Medium Difficulty for issues as part of PyTorch Docathon H1 2026 module: doc Issues related to documentation, both in docs/ and inlined in code module: user experience Issues related to reducing friction for users release notes: none Do not include this in the release notes triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document common CV patterns

3 participants