Detect the ancestors for any well-tuned neural network.
Learning and Vision Lab @ National University of Singapore
Paper (CVPR 2024 Oral) | PDF | Poster | Video
- Updates and TODOs
- Environment Setup
- Data Preparation
- Pre-trained Models
- Learning-Free Method and Baselines
- Lineage Detector
- Upload the parent and child models used in the experiment
- Upload the dataset used for training and evaluating lineage detector
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 lineageThe 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.
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.
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.01The 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.pyThe 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