Skip to content

yu-rp/NeuralLineage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Lineage

Detect the ancestors for any well-tuned neural network.

Runpeng Yu and Xinchao Wang

Learning and Vision Lab @ National University of Singapore

Paper (CVPR 2024 Oral) | PDF | Poster | Video

Image

Table of Contents

Updates and TODOs

  • Upload the parent and child models used in the experiment
  • Upload the dataset used for training and evaluating lineage detector

Environment Setup

Our code only requires minimal packages. All the code is implemented using Python 3.8.10 and PyTorch 2.0.0 on an RTX3090 with CUDA 12.0. Using other versions of the required packages should also be fine. All the relied packages are listed in the environment.yaml file. Run the following code, which will creates and activates a virual environment named lineage.

conda env create -f environment.yaml
conda activate lineage

(back to top)

Data Preparation

The data used in the work are all standard torchvision.datasets and are saved in the data folder by default. Dataset are loaded using the get_loader function in the src/utils.py file. The choice of dataset is controled by the attribute dataset of args.

(back to top)

Pre-trained Models

The pre-trained models are stored by default in models folder. The .json files in the archive folder summarize the parent and child models, which will be used in the experiments.

(back to top)

Learning-Free Method and Baselines

The following command is to run the learning-free methods or the baselines.

cd src

python learningfree.py \
        --model network-architecture \ # e.g., FC
        --dataset fine-tuning-dataset \ # e.g., FMNIST
        --pre-train-ckpt-json-p ../arcive/parents.json \
        --pre-train-ckpt-json-c ../arcive/children.json \
        --method name-of-the-method \ # e.g., representation_approxl2, representation_l2
        --batch-size number-of-samples-for-similarity-evaluation \ # e.g., 1024
        --alpha alpha-in-the-paper #e.g., 0.01

(back to top)

Lineage Detector

The step before trianing lineage detector is to prepare the dataset for it. The following code will automatically prepare a dataset for the FC+FMNIST setup.

cd src/lineagedetector

python dataset.py

The following command is to train the lineage detector the logged reuslt will also included the performance evaluation.

cd src

python learningbased.py \
        --batch-size 16 \
        --datasets dataset-name \ # e.g., FC-FMNIST
        --lr 0.01 \
        --epochs 100

(back to top)

About

Code for CVPR 2024 Oral "Neural Lineage"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages