Skip to content

Official Implementation of "Few-shot Implicit Function Generation via Equivariance" (CVPR 2025 Highlight)

Notifications You must be signed in to change notification settings

JeanDiable/EquiGen

Repository files navigation

Few-shot Implicit Function Generation via Equivariance

1Shanghai Jiao Tong University, 2National University of Singapore

Website arXiv

This is the official implementation of the paper Few-Shot Implicit Function Generation via Equivariance (CVPR 2025 HIGHLIGHT).

✨ Abstract

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.

💡Motivation

Setting

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.

🔭 Overview

Overview

The project consists of three main stages:

  1. Pretraining: Training an equivariant encoder using pretrain.py
  2. 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 the is_fewshot configuration parameter.
  3. Generation: Generating new implicit functions using generate.py

🔧 Key Features

  • 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

🏗️ Project Structure

  • pretrain.py # Equivariant encoder pre-training
  • train.py # Main training and few-shot fine-tuning, guided by the pretrained encoder
  • generate.py # Generation of implicit functions
  • models/
    • conditional_diffusion.py # Conditional diffusion model implementation
    • feature_extractor.py # equivariant encoder implementation
    • transformer.py # denoising diffusion transformer implementation
  • utils/
    • info_cse_loss.py # Loss function for the equivariant encoder
    • helpers.py # Helper functions
    • smooth_augmentation.py # Smooth augmentation for the weight space
    • ema.py # ema model
    • nn/ #equivariant model implementation
  • data/
    • __init__.py
    • inr_dataset.py # Dataset for implicit neural representations
  • configs/
    • default.yaml # Default configuration file
    • dataset_config.yaml # Dataset configuration file
  • dataset/
    • compute_mnist_statistics.py # Compute statistics for the MNIST dataset
    • generate_mnist_data_splits.py # Generate the dataset splits

🚀 Usage

To run the project, use the following command:

  1. Install the dependencies:
pip install -r requirements.txt
  1. 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-inrs folder.

  2. Create the data split using:

python generate_data_splits.py --data-path dataset/mnist-inrs

This will create a json file dataset/mnist_splits.json.

  1. Compute the dataset (INRs) statistics using:
python compute_statistics.py --data-path dataset/mnist_splits.json

This will create dataset/statistics.pth object.

  1. Run the pre-training:
python pretrain.py --data_path dataset/mnist_splits.json --n_epochs 500 --batch_size 512 --seed 42 --wandb
  1. 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.

  1. Run the generation:
accelerate launch generate.py --test_name test_name

Evaluation

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.

🗓 Plan

  • MNIST-INR Support
  • CIFAR-10-INR Support
  • ShapeNet-INR Support
  • ...

🌟Results on 3D Shapes (ShapeNet-INRs)

EQUIGEN can generate diverse and high-quality 3D shapes from few-shot examples. Below are examples for airplanes, cars, and chairs.

Airplanes

Generated Airplane examples using EQUIGEN

Input few-shot airplane samples (left) and diverse generated airplane INRs (right) by EQUIGEN.

Cars and Chairs

Generated Chair and Car examples using EQUIGEN

Few-shot input samples and generated INRs for car and chair categories.


🌟Diffusion Process Samples

diffusion sample 1 diffusion sample 2 diffusion sample 3

Acknowledgement

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.

📖 Citation

@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},
}

About

Official Implementation of "Few-shot Implicit Function Generation via Equivariance" (CVPR 2025 Highlight)

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages