Imageomics / Imageomics/pybioclip
Consider adding a flag for user to configure normalization with the `embed` command
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 67
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Embeddings currently come out at [raw magnitude](https://github.com/Imageomics/pybioclip/blob/5f13513e00d9740deddc157ebb0172e787568dbb/src/bioclip/__main__.py#L102).
This is probably a reasonable default, preserving any information in the norm in the (maybe unexpected) case that the norm isn't purely noise ...
Although in training and inference, L2 norm is applied for cosine similarity. Having `pybioclip` optionally give normalized embeddings would most accurately present outputs in the geometry BioCLIP intends.
While normalization is simple post hoc, it might not be an obvious step.
Proposing the option of a flag for something like the following to configure [`normalize=True/False`](https://github.com/Imageomics/pybioclip/blob/5f13513e00d9740deddc157ebb0172e787568dbb/src/bioclip/__main__.py#L102):
```
bioclip embed --normalize=True Ursus-arctos.jpeg # sets normalize=True
bioclip embed --normalize=False Ursus-arctos.jpeg # sets normalize=False
bioclip embed Ursus-arctos.jpeg # default behavior, sets normalize=False
```
(or perhaps a simple boolean `--normalize` where present is `True`, absent is `False`)
Along with a brief CLI description and perhaps an exposition in docs.
Strongest case for keeping the default behavior of `normalize=False` I think is to avoid a breaking change.
This was motivated by an error `Floating point exception (core dumped)` during UMAP on raw embeddings, which might be due to numerically instability with large magnitude embeddings.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/bioclip/__main__.py at the referenced embed command and inspect how its arguments are handled. Confirm the intended flag behavior and help text, then verify that the option can request normalized embeddings while the existing default remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, machine-learning
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100