Skip to content

feat: Image embeddings#397

Merged
pweglik merged 7 commits intomainfrom
@pw/image-embeddings
Jun 25, 2025
Merged

feat: Image embeddings#397
pweglik merged 7 commits intomainfrom
@pw/image-embeddings

Conversation

@pweglik
Copy link
Copy Markdown
Contributor

@pweglik pweglik commented Jun 13, 2025

Description

Introducing image embeddings feature.
TODO:
benchmarks
Everything else is good to review.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improves or adds clarity to existing documentation)

Tested on

  • iOS
  • Android

Related issues

#353

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@pweglik pweglik requested review from JakubGonera and chmjkb June 13, 2025 10:27
@pweglik pweglik marked this pull request as draft June 13, 2025 10:27
@pweglik pweglik self-assigned this Jun 13, 2025
Comment thread packages/react-native-executorch/src/utils/ResourceFetcher.ts
Comment thread packages/react-native-executorch/src/types/common.ts Outdated
@pweglik pweglik force-pushed the @pw/image-embeddings branch from 69456e3 to 2157bec Compare June 13, 2025 14:26
@pweglik pweglik force-pushed the @pw/image-embeddings branch from aacc266 to 4cbe3a2 Compare June 24, 2025 11:03
@pweglik pweglik marked this pull request as ready for review June 24, 2025 11:10
@chmjkb chmjkb removed the request for review from JakubGonera June 24, 2025 11:19
Comment thread packages/react-native-executorch/src/constants/modelUrls.ts Outdated
**`modelSource`**
A string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page.

**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the model if you load it for the first time) after running the hook.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i copied it over from other pages. I'd leave it like that - I think we actually mean it. Model loading (which mean downloading a lot of data)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes, but it might be misleading what data we mean

Comment thread docs/docs/computer-vision/useImageEmbeddings.md Outdated
Comment thread docs/docs/computer-vision/useImageEmbeddings.md Outdated

// Running the model
const embedding = await ImageEmbeddingsModule.forward(
'https://url-to-image.jpg'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in general i don't like things that would compile without error here, I saw too many peoples just copying it and then being upset about the url not working. Just a thought tho

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's good point, but on the other hand it shows that any existing URL works - '...' doesn't transfer this knowledge

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was thinking something more like ... which just wouldn't run at all and point to this as an error in code syntax itself


## Loading the model

To load the model, use the `load` method. It accepts the `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise, which can resolve to an error or void.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To load the model, use the `load` method. It accepts the `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise, which can resolve to an error or void.
To load the model, use the `load` method. It accepts `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise which can resolve to an error or void.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again - it should be fixed in several pages. I think we should utilize .mdx more

@pweglik pweglik requested a review from mkopcins June 24, 2025 14:07
@pweglik pweglik merged commit 2204e1f into main Jun 25, 2025
3 checks passed
@pweglik pweglik deleted the @pw/image-embeddings branch June 25, 2025 07:56
mkopcins pushed a commit that referenced this pull request Oct 15, 2025
## Description

Introducing image embeddings feature.
TODO:
benchmarks
Everything else is good to review.

### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Documentation update (improves or adds clarity to existing
documentation)

### Tested on

- [x] iOS
- [x] Android

### Related issues

#353 

### Checklist

- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [ ] My changes generate no new warnings

### Additional notes

<!-- Include any additional information, assumptions, or context that
reviewers might need to understand this PR. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants