1Shanghai Jiao Tong University, 2National University of Singapore
This is the official implementation of the paper Few-Shot Implicit Function Generation via Equivariance (CVPR 2025 HIGHLIGHT).
Implicit Neural Representations (INRs) have emerged as a powerful framework for representing continuous signals. However, generating diverse INR weights remains challenging due to limited training data. We introduce Few-shot Im- Implicit Function Generation, a new problem setup that aims to generate diverse yet functionally consistent INR weights from only a few examples. This is challenging because even for the same signal, the optimal INRs can vary significantly depending on their initializations. To tackle this, we propose EQUIGEN, a framework that can generate new INRs from limited data. The core idea is that functionally similar networks can be transformed into one another through weight permutations, forming an equivariance group. By projecting these weights into an equivariant latent space, we enable diverse generation within these groups, even with few examples. EQUIGEN implements this through an equivariant encoder trained via contrastive learning and smooth augmentation, an equivariance-guided diffusion process, and controlled perturbations in the equivariant subspace. Experiments on 2D image and 3D shape INR datasets demonstrate that our approach effectively generates diverse INR weights while preserving their functional properties in few-shot scenarios.
Illustration of the Few-shot Implicit Function Generation setting with 3D INR data examples. The goal is to generate diverse INR weights from limited target samples. Source samples(top) show previously observed INRs of diverse shape categories. In practice, only limited target samples (bottom left) are available for training. The framework aims to learn a generator that can produce diverse generated samples (right) despite the limited training data. This setting addresses the practical scenario where only a few examples of new shapes are available for training.
The project consists of three main stages:
- Pretraining: Training an equivariant encoder using
pretrain.py - Training/Fine-tuning: Diffusion model training guided by the pretrained encoder, implemented in
train.py. Few-shot fine-tuning is also performed in this stage, controlled by theis_fewshotconfiguration parameter. - Generation: Generating new implicit functions using
generate.py
- Contrastive learning based equivariant encoder for implicit function weights.
- Smooth augmentation for better feature learning
- Equivariance-guided diffusion with explicit equivariance regularization
- Controlled equivariant subspace pertur- bation for diverse generation
pretrain.py# Equivariant encoder pre-trainingtrain.py# Main training and few-shot fine-tuning, guided by the pretrained encodergenerate.py# Generation of implicit functionsmodels/conditional_diffusion.py# Conditional diffusion model implementationfeature_extractor.py# equivariant encoder implementationtransformer.py# denoising diffusion transformer implementation
utils/info_cse_loss.py# Loss function for the equivariant encoderhelpers.py# Helper functionssmooth_augmentation.py# Smooth augmentation for the weight spaceema.py# ema modelnn/#equivariant model implementation
data/__init__.pyinr_dataset.py# Dataset for implicit neural representations
configs/default.yaml# Default configuration filedataset_config.yaml# Dataset configuration file
dataset/compute_mnist_statistics.py# Compute statistics for the MNIST datasetgenerate_mnist_data_splits.py# Generate the dataset splits
To run the project, use the following command:
- Install the dependencies:
pip install -r requirements.txt-
The MNIST-INRs data is available for public, everyone can download it from here. Please download the data and place it in, e.g.
dataset/mnist-inrsfolder. -
Create the data split using:
python generate_data_splits.py --data-path dataset/mnist-inrsThis will create a json file dataset/mnist_splits.json.
- Compute the dataset (INRs) statistics using:
python compute_statistics.py --data-path dataset/mnist_splits.jsonThis will create dataset/statistics.pth object.
- Run the pre-training:
python pretrain.py --data_path dataset/mnist_splits.json --n_epochs 500 --batch_size 512 --seed 42 --wandb
- Run the training:
accelerate launch train.py
Configurations can be changed in configs/default.yaml and together with the dataset configuration in configs/dataset_config.yaml.
- Run the generation:
accelerate launch generate.py --test_name test_name
To evaluate the model, use the following command for the LPIPS score:
python evaluate_lpips.py --folder1 path/to/folder/with/images
For the FID score, please follow the official pytorch-fid implementation.
- MNIST-INR Support
- CIFAR-10-INR Support
- ShapeNet-INR Support
- ...
EQUIGEN can generate diverse and high-quality 3D shapes from few-shot examples. Below are examples for airplanes, cars, and chairs.
Input few-shot airplane samples (left) and diverse generated airplane INRs (right) by EQUIGEN.
Few-shot input samples and generated INRs for car and chair categories.
This project is build upon several previous works, including Neumeta, DWSNet, HyperDiffusion, and several commonly used repos including Diffusers, Accelerator and so on. Show our deepest respect for them.
@InProceedings{Huang_2025_CVPR,
author = {Huang, Suizhi and Yang, Xingyi and Lu, Hongtao and Wang, Xinchao},
title = {Few-shot Implicit Function Generation via Equivariance},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2025},
}




