Skip to content
ModelListedExternal
Browse files

GoldNet

Trained checkpoints for GoldFormer and baseline models from the paper:

KindOtherVersionDense Net121 bestUnratedgrade

Model source

Kind
Other
File size
25.8–982 MB
Version
vDense Net121 best
Updated
Nov 5, 2026
Source
Hugging Face

Source description

GoldNet Model Weights

Trained checkpoints for GoldFormer and baseline models from the paper:

GoldFormer: A Texture-Aware Vision Transformer-Based Algorithm for Detecting Near-Identical Images
Z. Raisi, Algorithms (MDPI), 2026, 19(7), 530.
DOI: 10.3390/a19070530. Open access (CC BY 4.0).
Code & dataset: github.com/zobeirraisi/GoldNet

Task

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.

Available Checkpoints (weights/)

Results below are 5-fold stratified cross-validation at matched 224×224 resolution (the paper's primary setting).

FileModelAccuracy (%)F1
GoldFormer_best.pthGoldFormer (CNN + Swin-T + TAAG)95.02 ± 0.750.9502
ViT_B16_best.pthViT-B/1694.31 ± 0.940.9431
Swin_T_best.pthSwin Transformer-Tiny (GoldFormer's backbone)93.65 ± 0.670.9365
ResNet101_best.pthResNet-10192.29 ± 1.010.9228
ResNet50_best.pthResNet-50——
ResNet18_best.pthResNet-18——
DenseNet121_best.pthDenseNet-121——
EfficientNet_B3_best.pthEfficientNet-B3——
EfficientNet_B0_best.pthEfficientNet-B0——
MobileNet_V2_best.pthMobileNet-V2——

GoldFormer is the best single model and beats a soft-voting ensemble (94.92%); it is statistically tied with the strongest individual backbone, ViT-B/16 (paired McNemar p = 0.228), and significantly beats its own Swin-T backbone (p = 0.014), while using about half ViT-B/16's FLOPs (8.6 vs 16.9 GFLOPs) and fewer parameters (54.3M vs 86.6M).

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).

Usage

import torch
from models import build_model   # models.py from the GitHub repo

# Download weights
# bash fetch_weights.sh   (from the GitHub repo)

model = build_model("goldformer")
state = torch.load("weights/GoldFormer_best.pth", map_location="cpu", weights_only=True)
model.load_state_dict(state)   # strict — exact match with the released checkpoint
model.eval()

from torchvision import transforms
from PIL import Image

transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize([0.485, 0.456, 0.406],
                         [0.229, 0.224, 0.225]),
])

img = Image.open("your_image.jpg").convert("RGB")
x = transform(img).unsqueeze(0)

with torch.no_grad():
    logits, gamma = model(x)   # gamma = TAAG gate activations, for interpretability
    prob_authentic = torch.softmax(logits, dim=1)[0, 0].item()
    print(f"P(authentic) = {prob_authentic:.3f}")

Note: All checkpoints, including GoldFormer, use 224×224 input in the published configuration. The models.py class definitions (TextureAwareAttentionGate + GoldFormer) are in the GitHub repo.

Citation

@article{raisi2026goldformer,
  title   = {GoldFormer: A Texture-Aware Vision Transformer-Based Algorithm
             for Detecting Near-Identical Images},
  author  = {Raisi, Zobeir},
  journal = {Algorithms},
  volume  = {19},
  number  = {7},
  pages   = {530},
  year    = {2026},
  doi     = {10.3390/a19070530}
}

License

Model weights: MIT License
Dataset: CC BY 4.0

Sources

1 source
Hugging FacePrimaryVersion 996a0ce7951f46cb01c21c7d982efc4ad0e06d81
huggingface.co/zobeir/GoldNet/tree/996a0ce7951f46cb01c21c7d982efc4ad0e06d81

Verified Nov 5

Download files

Model artifacts

10 artifacts

weights/DenseNet121_best.pth

pth · 80.5 MB · SHA-256 9e8076ae46f8…4676 · Hugging Face

Download file

weights/EfficientNet_B0_best.pth

pth · 46.4 MB · SHA-256 e85fabe09840…999c · Hugging Face

Download file

weights/EfficientNet_B3_best.pth

pth · 123 MB · SHA-256 37ffb8af6ca9…f188 · Hugging Face

Download file

weights/GoldFormer_best.pth

pth · 208 MB · SHA-256 9544e6423144…06bc · Hugging Face

Download file

weights/MobileNet_V2_best.pth

pth · 25.8 MB · SHA-256 434f7a49063e…fb69 · Hugging Face

Download file

weights/ResNet101_best.pth

pth · 487 MB · SHA-256 26a3f55b692f…a0c6 · Hugging Face

Download file

weights/ResNet18_best.pth

pth · 128 MB · SHA-256 76fc3a75a55d…7844 · Hugging Face

Download file

weights/ResNet50_best.pth

pth · 270 MB · SHA-256 a067e498b473…0f32 · Hugging Face

Download file

weights/Swin_T_best.pth

pth · 315 MB · SHA-256 124d46340768…4dfb · Hugging Face

Download file

weights/ViT_B16_best.pth

pth · 982 MB · SHA-256 3a17d1a6d112…be8b · Hugging Face

Download file

Source excerpts

2 excerpts

--- license: mit datasets: - zobeir/GoldNet tags: - image-classification - pytorch - vision-transformer - counterfeit-detection - gold - fine-grained-recognition language: - en --- # GoldNet Model Weights Trained checkpoints for **GoldFormer** and baseline models from the paper: > **GoldFormer: A Texture-Aware Vision Transformer-Based Algorithm for Detecting Near-Identical Images** > Z. Raisi, *Algorithms* (MDPI), 2026, 19(7), 530. > DOI: [10.3390/a19070530](https://doi.org/10.3390/a19070530). Open access (CC BY 4.0). > Code & dataset: [github.com/zobeirraisi/GoldNet](https://github.com/zobeirraisi/GoldNet) ## Task 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. ## Available Checkpoints (`weights/`) Results below are 5-fold stratified cross-validation at matched 224×224 resolution (the paper's primary setting). | File | Model | Accuracy (%) | F1 | |---|---|---|---| | `GoldFormer_best.pth` | GoldFormer (CNN + Swin-T + TAAG) | **95.02 ± 0.75** | **0.9502** | | `ViT_B16_best.pth` | ViT-B/16 | 94.31 ± 0.94 | 0.9431 | | `Swin_T_best.pth` | Swin Transformer-Tiny (GoldFormer's backbone) | 93.65 ± 0.67 | 0.9365 | | `ResNet101_best.pth` | ResNet-101 | 92.29 ± 1.01 | 0.9228 | | `ResNet50_best.pth` | ResNet-50 | — | — | | `ResNet18_best.pth` | ResNet-18 | — | — | | `DenseNet121_best.pth` | DenseNet-121 | — | — | | `EfficientNet_B3_best.pth` | EfficientNet-B3 | — | — | | `EfficientNet_B0_best.pth` | EfficientNet-B0 | — | — | | `MobileNet_V2_best.pth` | MobileNet-V2 | — | — | GoldFormer is the best single model and beats a soft-voting ensemble (94.92%); it is statistically tied with the strongest individual backbone, ViT-B/16 (paired McNemar p = 0.228), and significantly beats its own Swin-T backbone (p = 0.014), while using about half ViT-B/16's FLOPs (8.6 vs 16.9 GFLOPs) and fewer parameters (54.3M vs 86.6M). 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). ## Usage ```python import torch from models import build_model # models.py from the GitHub repo # Download weights # bash fetch_weights.sh (from the GitHub repo) model = build_model("g...

Source context: 0 downloads · 0 likes · Pipeline image-classification · Repo zobeir/GoldNet