harpertoken commited on
Commit
d349074
Β·
verified Β·
1 Parent(s): cea9f80

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +19 -0
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.