FAREL — ViT-B/16 pretrained encoders
Pretrained encoders for FAREL: Frequency-Aware Reconstruction for Fine-grained Grapevine Representation Learning (CVPR 2026 Workshops).
Gabriel A. Carneiro, Imanol G. Estepa, Thierry J. Aubry, António Cunha, Joaquim J. Sousa, Bhalaji Nagarajan, Petia Radeva
FAREL is an MAE-style self-supervised pre-training method. It adds a patch-wise frequency importance module that reweights the reconstruction loss toward informative mid-frequency patches. It also adds a redundancy-reduction objective against dimensional collapse.
- Code: https://github.com/gabri14el/FAREL
- Baselines (MAE, I-JEPA, CMAE, MoCo-v3) trained in the same setup:
gabri14el/farel-baselines-vit-b16
Encoders
This repository holds three FAREL ViT-B/16 encoders. They share the architecture and all pre-training hyperparameters, and differ only in the pre-training data and the number of epochs.
| Encoder | Location (subfolder) | Pre-training data | Epochs |
|---|---|---|---|
| FAREL iNat, 800 ep | repository root (none) | iNaturalist, 160K images | 800 |
| FAREL iNat, 1600 ep | inat160k-1600ep | iNaturalist, 160K images (same as root) | 1600 |
| FAREL iNat grapevine 200K, 800 ep | inat-grapevine-200k-800ep | iNaturalist grapevine subset, 200K images | 800 |
The root and inat160k-1600ep encoders use the same iNaturalist data and differ
only in training length. All three are the final checkpoint of their run.
Files
Each location holds the same three files:
| File | Contents |
|---|---|
model.safetensors | Weights only: ckpt['model'] from the training checkpoint (encoder, decoder, frequency module Q, projector), 114.8M parameters. Key names are unchanged. |
config.json | Training arguments of the run (machine-specific paths removed) and epoch. |
training_checkpoint.pth | Full original training checkpoint: model, optimizer, scaler, epoch, args. Use it to resume training. |
Training setup
ViT-B/16, input 224, mask_ratio=0.6, freq_loss_alpha=0.3, freq_bins=5,
learnable band weights, bt_loss_coef=0.1, projector 1024-1024-1024, batch
size 256, base learning rate 1.5e-4. Each encoder's config.json has the full
argument list. The runs used the earlier model name maebt_vit_base_patch16;
this is farel_vit_base_patch16 in the code.
Usage
Download the weights of an encoder. Set subfolder to a value from the table
above, or to None for the root encoder. main_finetune.py of the reference
code reads ckpt['model']:
import torch
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
subfolder = "inat160k-1600ep" # or "inat-grapevine-200k-800ep", or None
state_dict = load_file(hf_hub_download("gabri14el/farel-vit-b16", "model.safetensors",
subfolder=subfolder))
torch.save({"model": state_dict}, "farel.pth")
torchrun --nproc_per_node=4 main_finetune.py \
--model vit_base_patch16 --finetune farel.pth \
--data_path /path/to/dataset --nb_classes <N>
Load the encoder into the plain ViT-B/16 of the reference code. Only the new
classifier (head.*, fc_norm.*) is not in the checkpoint:
import models_vit # from the FAREL repository
model = models_vit.vit_base_patch16(num_classes=N, global_pool=True)
model.load_state_dict(state_dict, strict=False)
The full training_checkpoint.pth stores an argparse.Namespace. Load it with
torch.load(path, map_location="cpu", weights_only=False).
Citation
@InProceedings{Carneiro_2026_CVPR,
author = {Carneiro, Gabriel A. and Estepa, Imanol G. and Aubry, Thierry J. and Cunha, Ant\'onio and Sousa, Joaquim J. and Nagarajan, Bhalaji and Radeva, Petia},
title = {Frequency-Aware Reconstruction for Fine-grained Grapevine Representation Learning},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2026},
pages = {9682-9691}
}
License
CC BY-NC 4.0, following the MAE codebase that FAREL builds on.