DPGN: Distribution Propagation Graph Network for Few-shot Learning
This repository is the official implementation of DPGN: Distribution Propagation Graph Network for Few-shot Learning.
Abstract
Most graph-network-based meta-learning approaches model instance-level relation of examples. We extend this idea further to explicitly model the distribution-level relation of one example to all other examples in a 1-vs-N manner. We propose a novel approach named distribution propagation graph network (DPGN) for few-shot learning. It conveys both the distribution-level relations and instance-level relations in each few-shot learning task. To combine the distribution-level relations and instance-level relations for all examples, we construct a dual complete graph network which consists of a point graph and a distribution graph with each node standing for an example. Equipped with dual graph architecture, DPGN propagates label information from labeled examples to unlabeled examples within several update generations. In extensive experiments on few-shot learning benchmarks, DPGN outperforms state-of-the-art results by a large margin in 5% βΌ 12% under supervised settings and 7% βΌ 13% under semi-supervised settings.
Requirements
CUDA Version: 10.1
Python : 3.5.2
To install dependencies:
sudo pip3 install -r requirements.txt
Dataset
For your convenience, you can download the datasets directly from links on the left, or you can make them from scratch following the original splits on the right.
Dataset | Original Split |
---|---|
Mini-ImageNet | Matching Networks |
Tiered-ImageNet | SSL |
CIFAR-FS | R2D2 |
CUB-200-2011 | Closer Look |
The dataset directory should look like this:
βββ dataset
βββ mini-imagenet
βββ mini_imagenet_test.pickle
βββ mini_imagenet_train.pickle
βββ mini_imagenet_val.pickle
βββ tiered-imagenet
βββ class_names.txt
βββ synsets.txt
βββ test_images.npz
βββ test_labels.pkl
βββ train_images.npz
βββ train_labels.pkl
βββ val_images.npz
βββ val_labels.pkl
βββ cifar-fs
βββ cifar_fs_test.pickle
βββ cifar_fs_train.pickle
βββ cifar_fs_val.pickle
βββ cub-200-2011
βββ attributes
βββ bounding_boxes.txt
βββ classes.txt
βββ image
βββ image_class_labels.txt
βββ images
βββ images.txt
βββ parts
βββ README
βββ split
βββ train_test_split.txt
Training
To train the model(s) in the paper, run:
python3 main.py --dataset_root dataset --config config/5way_1shot_resnet12_mini-imagenet.py --num_gpu 1 --mode train
Evaluation
To evaluate the model(s) in the paper, run:
python3 main.py --dataset_root dataset --config config/5way_1shot_resnet12_mini-imagenet.py --num_gpu 1 --mode eval
Pre-trained Models
This Google Drive contains pre-trained model under settings of 5way-1shot and 5way-5shots for mini-ImageNet dataset with ResNet12 backbone.
Results
# Default checkpoints directory is:
./checkpoints
# Default logs directory is:
./logs
Our model achieves the following performance on mini-ImageNet, tiered-ImageNet, CUB-200-2011 and CIFAR-FS (more detailed experimental results are in the paper).
miniImageNet:
Method | Backbone | 5way-1shot | 5way-5shot |
---|---|---|---|
MatchingNet | ConvNet | 43.56Β±0.84 | 55.31Β± 0.73 |
ProtoNet | ConvNet | 49.42Β±0.78 | 68.20Β±0.66 |
RelationNet | ConvNet | 50.44Β±0.82 | 65.32Β±0.70 |
MAML | ConvNet | 48.70Β±1.84 | 55.31Β±0.73 |
GNN | ConvNet | 50.33Β±0.36 | 66.41Β±0.63 |
TPN | ConvNet | 55.51Β±0.86 | 69.86Β±0.65 |
Edge-label | ConvNet | 59.63Β±0.52 | 76.34Β±0.48 |
DPGN | ConvNet | 66.01Β±0.36 | 82.83Β±0.41 |
LEO | WRN | 61.76Β±0.08 | 77.59Β±0.12 |
wDAE | WRN | 61.07Β±0.15 | 76.75Β±0.11 |
DPGN | WRN | 67.24Β±0.51 | 83.72Β±0.44 |
CloserLook | ResNet18 | 51.75Β±0.80 | 74.27Β±0.63 |
CTM | ResNet18 | 62.05Β±0.55 | 78.63Β±0.06 |
DPGN | ResNet18 | 66.63Β±0.51 | 84.07Β±0.42 |
MetaGAN | ResNet12 | 52.71Β±0.64 | 68.63Β±0.67 |
SNAIL | ResNet12 | 55.71Β±0.99 | 68.88Β±0.92 |
TADAM | ResNet12 | 58.50Β±0.30 | 76.70Β±0.30 |
Shot-Free | ResNet12 | 59.04Β±0.43 | 77.64Β±0.39 |
Meta-Transfer | ResNet12 | 61.20Β±1.80 | 75.53Β±0.80 |
FEAT | ResNet12 | 62.96Β±0.02 | 78.49Β±0.02 |
MetaOptNet | ResNet12 | 62.64Β±0.61 | 78.63Β±0.46 |
DPGN | ResNet12 | 67.77Β±0.32 | 84.60Β±0.43 |
tieredImageNet:
Method | backbone | 5way-1shot | 5way-5shot |
---|---|---|---|
MAML | ConvNet | 51.67Β±1.81 | 70.30Β±1.75 |
ProtoNet | ConvNet | 53.34Β±0.89 | 72.69Β±0.74 |
RelationNet | ConvNet | 54.48Β±0.93 | 71.32Β±0.78 |
TPN | ConvNet | 59.91Β±0.94 | 73.30Β±0.75 |
Edge-label | ConvNet | 63.52Β±0.52 | 80.24Β±0.49 |
DPGN | ConvNet | 69.43Β±0.49 | 85.92Β±0.42 |
CTM | ResNet18 | 64.78Β±0.11 | 81.05Β±0.52 |
DPGN | ResNet18 | 70.46Β±0.52 | 86.44Β±0.41 |
TapNet | ResNet12 | 63.08Β±0.15 | 80.26Β±0.12 |
Meta-Transfer | ResNet12 | 65.62Β±1.80 | 80.61Β±0.90 |
MetaOptNet | ResNet12 | 65.81Β±0.74 | 81.75Β±0.53 |
Shot-Free | ResNet12 | 66.87Β±0.43 | 82.64Β±0.39 |
DPGN | ResNet12 | 72.45Β±0.51 | 87.24Β±0.39 |
CUB-200-2011:
Method | backbone | 5way-1shot | 5way-5shot |
---|---|---|---|
ProtoNet | ConvNet | 51.31Β±0.91 | 70.77Β±0.69 |
MAML | ConvNet | 55.92Β±0.95 | 72.09Β±0.76 |
MatchingNet | ConvNet | 61.16Β±0.89 | 72.86Β±0.70 |
RelationNet | ConvNet | 62.45Β±0.98 | 76.11Β±0.69 |
CloserLook | ConvNet | 60.53Β±0.83 | 79.34Β±0.61 |
DN4 | ConvNet | 53.15Β±0.84 | 81.90Β±0.60 |
DPGN | ConvNet | 76.05Β±0.51 | 89.08Β±0.38 |
FEAT | ResNet12 | 68.87Β±0.22 | 82.90Β±0.15 |
DPGN | ResNet12 | 75.71Β±0.47 | 91.48Β±0.33 |
CIFAR-FS:
Method | backbone | 5way-1shot | 5way-5shot |
---|---|---|---|
ProtoNet | ConvNet | 55.5Β±0.7 | 72.0Β±0.6 |
MAML | ConvNet | 58.9Β±1.9 | 71.5Β±1.0 |
RelationNet | ConvNet | 55.0Β±1.0 | 69.3Β±0.8 |
R2D2 | ConvNet | 65.3Β±0.2 | 79.4Β±0.1 |
DPGN | ConvNet | 76.4Β±0.5 | 88.4Β±0.4 |
Shot-Free | ResNet12 | 69.2Β±0.4 | 84.7Β±0.4 |
MetaOptNet | ResNet12 | 72.0Β±0.7 | 84.2Β±0.5 |
DPGN | ResNet12 | 77.9Β±0.5 | 90.2Β±0.4 |