zobeir commited on
Commit
198defb
·
verified ·
1 Parent(s): a8f2db5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - zobeir/GoldNet
5
+ tags:
6
+ - image-classification
7
+ - pytorch
8
+ - vision-transformer
9
+ - counterfeit-detection
10
+ - gold
11
+ - fine-grained-recognition
12
+ language:
13
+ - en
14
+ ---
15
+
16
+ # GoldNet Model Weights
17
+
18
+ Trained checkpoints for **GoldFormer** and baseline models from the paper:
19
+
20
+ > **GoldFormer: A Texture-Aware Vision Transformer-based Algorithm for Detecting Near-Identical Images**
21
+ > Z. Raisi, *Algorithms* (MDPI), under review.
22
+ > Code & dataset: [github.com/zobeirraisi/GoldNet](https://github.com/zobeirraisi/GoldNet)
23
+
24
+ ## Task
25
+
26
+ Binary image classification — **authentic vs. counterfeit gold items** — from ordinary smartphone photographs. The two classes are near-identical to the eye; trained experts reached 89.80% accuracy on a blind subset.
27
+
28
+ ## Available Checkpoints (`weights/`)
29
+
30
+ | File | Model | Accuracy (5-fold CV) |
31
+ |---|---|---|
32
+ | `GoldFormer_best.pth` | GoldFormer (CNN + Swin-T + TAAG) | 94.69 ± 0.79% |
33
+ | `Swin_T_best.pth` | Swin Transformer-Tiny | 94.31 ± 0.78% |
34
+ | `ViT_B16_best.pth` | ViT-B/16 | 94.31 ± 0.94% |
35
+ | `ResNet101_best.pth` | ResNet-101 | 92.29 ± 1.01% |
36
+ | `ResNet50_best.pth` | ResNet-50 | — |
37
+ | `ResNet18_best.pth` | ResNet-18 | — |
38
+ | `DenseNet121_best.pth` | DenseNet-121 | — |
39
+ | `EfficientNet_B3_best.pth` | EfficientNet-B3 | — |
40
+ | `EfficientNet_B0_best.pth` | EfficientNet-B0 | — |
41
+ | `MobileNet_V2_best.pth` | MobileNet-V2 | — |
42
+
43
+ All models trained with 5-fold stratified cross-validation, AdamW, AMP (bfloat16), freeze-then-unfreeze fine-tuning on the GoldNet dataset (2,127 images, 1,044 authentic / 1,083 counterfeit).
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ import torch
49
+ from torchvision import transforms
50
+ from PIL import Image
51
+
52
+ # Download weights
53
+ # bash fetch_weights.sh (from the GitHub repo)
54
+
55
+ # Load a checkpoint
56
+ model = torch.load("weights/GoldFormer_best.pth", weights_only=True)
57
+ model.eval()
58
+
59
+ transform = transforms.Compose([
60
+ transforms.Resize((299, 299)),
61
+ transforms.ToTensor(),
62
+ transforms.Normalize([0.485, 0.456, 0.406],
63
+ [0.229, 0.224, 0.225]),
64
+ ])
65
+
66
+ img = Image.open("your_image.jpg").convert("RGB")
67
+ x = transform(img).unsqueeze(0)
68
+
69
+ with torch.no_grad():
70
+ logits = model(x)
71
+ prob_authentic = torch.softmax(logits, dim=1)[0, 0].item()
72
+ print(f"P(authentic) = {prob_authentic:.3f}")
73
+ ```
74
+
75
+ > **Note:** All baseline models use 224×224 input. GoldFormer uses 299×299.
76
+ > The `models.py` class definitions are in the [GitHub repo](https://github.com/zobeirraisi/GoldNet).
77
+
78
+ ## Citation
79
+
80
+ ```bibtex
81
+ @article{raisi2026goldformer,
82
+ title = {GoldFormer: A Texture-Aware Vision Transformer-based Algorithm
83
+ for Detecting Near-Identical Images},
84
+ author = {Raisi, Zobeir},
85
+ journal = {Algorithms},
86
+ year = {2026},
87
+ note = {Under review}
88
+ }
89
+ ```
90
+
91
+ ## License
92
+
93
+ Model weights: [MIT License](https://github.com/zobeirraisi/GoldNet/blob/main/LICENSE)
94
+ Dataset: [CC BY 4.0](https://github.com/zobeirraisi/GoldNet/blob/main/LICENSE-DATA)