Feature Extraction
Transformers
Safetensors
English
fuse_matcher
image-text-matching
flickr8k
cnn
vision-language
custom_code
Eval Results (legacy)
Instructions to use harpertoken/fuse with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harpertoken/fuse with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="harpertoken/fuse", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("harpertoken/fuse", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -46,6 +46,25 @@ print(model.match(image, "a dog runs on the beach", vocab))
|
|
| 46 |
|
| 47 |
`match` takes a 64 by 64 RGB float array in range 0 to 1, a caption string, and the vocabulary mapping, and returns the match probability with the predicted verdict. Training images were resized to 64 by 64 with no augmentation, matching inference exactly. Needs `torch` and `transformers`.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
## Training
|
| 50 |
|
| 51 |
Canonical Flickr8k, 6,000 train images with five captions each (60,000 pairs after 1:1 negative sampling) and 1,000 test images (10,000 pairs). An earlier run silently trained on a partial download; the training script now asserts the full counts before starting. Word vocabulary of 4,433 from train captions with minimum frequency 2. Sixteen epochs, Adam 1e-3, batch 128, seed 0. Per-epoch test accuracy climbed from 0.53 to 0.69 and plateaued there.
|
|
|
|
| 46 |
|
| 47 |
`match` takes a 64 by 64 RGB float array in range 0 to 1, a caption string, and the vocabulary mapping, and returns the match probability with the predicted verdict. Training images were resized to 64 by 64 with no augmentation, matching inference exactly. Needs `torch` and `transformers`.
|
| 48 |
|
| 49 |
+
## Examples
|
| 50 |
+
|
| 51 |
+
```text
|
| 52 |
+
image ββ> image encoder ββ> project ββ> normalize βββ
|
| 53 |
+
ββ> dot x scale ββ> match score
|
| 54 |
+
caption β> text encoder ββ> project ββ> normalize βββ
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
Both sides project to 128 dimensions and L2-normalize before the dot product; there is no concatenation layer. The card first drafted with a concatenate diagram was wrong, and the text above describes the weights as saved.
|
| 58 |
+
|
| 59 |
+
Two pairs from the canonical test set, scored by the published weights. Selection rule: the first test image in file order with its first caption, and the same image with the first caption of the last test image. Image `1056338697_4f7d7ce270.jpg`:
|
| 60 |
+
|
| 61 |
+
| Caption | Score | Verdict |
|
| 62 |
+
|---|---|---|
|
| 63 |
+
| A blond woman in a blue shirt appears to wait for a ride . | 0.819 | match, correct |
|
| 64 |
+
| A man in a pink shirt climbs a rock face | 0.938 | match, wrong |
|
| 65 |
+
|
| 66 |
+
The non-match scores higher than the match and is classified wrong. That is not a chosen failure; it is what the rule produced, and it is consistent with 0.6933 test accuracy. These are two illustrations, not the metric.
|
| 67 |
+
|
| 68 |
## Training
|
| 69 |
|
| 70 |
Canonical Flickr8k, 6,000 train images with five captions each (60,000 pairs after 1:1 negative sampling) and 1,000 test images (10,000 pairs). An earlier run silently trained on a partial download; the training script now asserts the full counts before starting. Word vocabulary of 4,433 from train captions with minimum frequency 2. Sixteen epochs, Adam 1e-3, batch 128, seed 0. Per-epoch test accuracy climbed from 0.53 to 0.69 and plateaued there.
|