Imbatmann commited on
Commit
e01053f
·
verified ·
1 Parent(s): 824b159

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +52 -0
README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Banknote Embedder
2
+
3
+ Fine-tuned visual embedding model for Nepali banknotes.
4
+
5
+ It maps an input banknote image to a 512-d normalized embedding vector.
6
+ You can compare two notes using cosine similarity:
7
+ - higher score -> more similar
8
+ - lower score -> less similar
9
+
10
+ ## Model Files
11
+
12
+ - `banknote_embedder_finetuned.pth`: training state_dict
13
+ - `banknote_embedder_fp16.safetensors`: compressed inference weights (recommended)
14
+ - `banknote_embedder_int8_dynamic.pth`: dynamic int8 export for supported CPU backends
15
+
16
+ ## Quantize / Export
17
+
18
+ Generate compressed artifacts from your fine-tuned weights:
19
+
20
+ ```bash
21
+ python quantize_model.py --input-model banknote_embedder_finetuned.pth --skip-int8
22
+ ```
23
+
24
+ Outputs:
25
+ - `banknote_embedder_fp16.safetensors`
26
+
27
+ Optional (if your CPU backend supports it):
28
+
29
+ ```bash
30
+ python quantize_model.py --input-model banknote_embedder_finetuned.pth
31
+ ```
32
+
33
+ Additional output:
34
+ - `banknote_embedder_int8_dynamic.pth`
35
+
36
+ ## Quick Test
37
+
38
+ Run similarity test:
39
+
40
+ ```bash
41
+ python test.py --weights banknote_embedder_fp16.safetensors --img1 notes/20.jpg --img2 notes/20.jpg --img3 notes/22.jpg
42
+ ```
43
+
44
+ Expected behavior:
45
+ - `img1 vs img2` should be high (often close to `1.0` for identical image)
46
+ - `img1 vs img3` should be lower
47
+
48
+ ## Usage Notes
49
+
50
+ - Input preprocessing uses ImageNet normalization and `224x224` resize.
51
+ - Embeddings are L2-normalized in the model forward pass.
52
+ - `xFormers is not available` warnings are expected and non-fatal.