Home

Awesome

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.

<p align='center'> <img src='figure/dpgn.png' width="800px"> </p>

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.

DatasetOriginal Split
Mini-ImageNetMatching Networks
Tiered-ImageNetSSL
CIFAR-FSR2D2
CUB-200-2011Closer 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

<!--[**best_checkpoints**](best_checkpoints) directory contains pre-trained model under settings of 5way-1shot and 5way-5shots for mini-ImageNet dataset with ResNet12 backbone.-->

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:

MethodBackbone5way-1shot5way-5shot
MatchingNetConvNet43.56±0.8455.31± 0.73
ProtoNetConvNet49.42±0.7868.20±0.66
RelationNetConvNet50.44±0.8265.32±0.70
MAMLConvNet48.70±1.8455.31±0.73
GNNConvNet50.33±0.3666.41±0.63
TPNConvNet55.51±0.8669.86±0.65
Edge-labelConvNet59.63±0.5276.34±0.48
DPGNConvNet66.01±0.3682.83±0.41
LEOWRN61.76±0.0877.59±0.12
wDAEWRN61.07±0.1576.75±0.11
DPGNWRN67.24±0.5183.72±0.44
CloserLookResNet1851.75±0.8074.27±0.63
CTMResNet1862.05±0.5578.63±0.06
DPGNResNet1866.63±0.5184.07±0.42
MetaGANResNet1252.71±0.6468.63±0.67
SNAILResNet1255.71±0.9968.88±0.92
TADAMResNet1258.50±0.3076.70±0.30
Shot-FreeResNet1259.04±0.4377.64±0.39
Meta-TransferResNet1261.20±1.8075.53±0.80
FEATResNet1262.96±0.0278.49±0.02
MetaOptNetResNet1262.64±0.6178.63±0.46
DPGNResNet1267.77±0.3284.60±0.43

tieredImageNet:

Methodbackbone5way-1shot5way-5shot
MAMLConvNet51.67±1.8170.30±1.75
ProtoNetConvNet53.34±0.8972.69±0.74
RelationNetConvNet54.48±0.9371.32±0.78
TPNConvNet59.91±0.9473.30±0.75
Edge-labelConvNet63.52±0.5280.24±0.49
DPGNConvNet69.43±0.4985.92±0.42
CTMResNet1864.78±0.1181.05±0.52
DPGNResNet1870.46±0.5286.44±0.41
TapNetResNet1263.08±0.1580.26±0.12
Meta-TransferResNet1265.62±1.8080.61±0.90
MetaOptNetResNet1265.81±0.7481.75±0.53
Shot-FreeResNet1266.87±0.4382.64±0.39
DPGNResNet1272.45±0.5187.24±0.39

CUB-200-2011:

Methodbackbone5way-1shot5way-5shot
ProtoNetConvNet51.31±0.9170.77±0.69
MAMLConvNet55.92±0.9572.09±0.76
MatchingNetConvNet61.16±0.8972.86±0.70
RelationNetConvNet62.45±0.9876.11±0.69
CloserLookConvNet60.53±0.8379.34±0.61
DN4ConvNet53.15±0.8481.90±0.60
DPGNConvNet76.05±0.5189.08±0.38
FEATResNet1268.87±0.2282.90±0.15
DPGNResNet1275.71±0.4791.48±0.33

CIFAR-FS:

Methodbackbone5way-1shot5way-5shot
ProtoNetConvNet55.5±0.772.0±0.6
MAMLConvNet58.9±1.971.5±1.0
RelationNetConvNet55.0±1.069.3±0.8
R2D2ConvNet65.3±0.279.4±0.1
DPGNConvNet76.4±0.588.4±0.4
Shot-FreeResNet1269.2±0.484.7±0.4
MetaOptNetResNet1272.0±0.784.2±0.5
DPGNResNet1277.9±0.590.2±0.4