All Projects → kjunelee → Metaoptnet

kjunelee / Metaoptnet

Licence: apache-2.0
Meta-Learning with Differentiable Convex Optimization (CVPR 2019 Oral)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Metaoptnet

LibFewShot
LibFewShot: A Comprehensive Library for Few-shot Learning.
Stars: ✭ 629 (+52.67%)
Mutual labels:  image-classification, meta-learning
Multidigitmnist
Combine multiple MNIST digits to create datasets with 100/1000 classes for few-shot learning/meta-learning
Stars: ✭ 48 (-88.35%)
Mutual labels:  meta-learning, image-classification
Darts
Differentiable architecture search for convolutional and recurrent networks
Stars: ✭ 3,463 (+740.53%)
Mutual labels:  image-classification
Rmdl
RMDL: Random Multimodel Deep Learning for Classification
Stars: ✭ 375 (-8.98%)
Mutual labels:  image-classification
Rectlabel Support
RectLabel - An image annotation tool to label images for bounding box object detection and segmentation.
Stars: ✭ 338 (-17.96%)
Mutual labels:  image-classification
Lightnet
🌓 Bringing pjreddie's DarkNet out of the shadows #yolo
Stars: ✭ 322 (-21.84%)
Mutual labels:  image-classification
Sianet
An easy to use C# deep learning library with CUDA/OpenCL support
Stars: ✭ 353 (-14.32%)
Mutual labels:  image-classification
Flutter programs
Experiments with Mobile
Stars: ✭ 308 (-25.24%)
Mutual labels:  image-classification
Computer Vision
Programming Assignments and Lectures for Stanford's CS 231: Convolutional Neural Networks for Visual Recognition
Stars: ✭ 408 (-0.97%)
Mutual labels:  image-classification
Rexnet
Official Pytorch implementation of ReXNet (Rank eXpansion Network) with pretrained models
Stars: ✭ 319 (-22.57%)
Mutual labels:  image-classification
Basic cnns tensorflow2
A tensorflow2 implementation of some basic CNNs(MobileNetV1/V2/V3, EfficientNet, ResNeXt, InceptionV4, InceptionResNetV1/V2, SENet, SqueezeNet, DenseNet, ShuffleNetV2, ResNet).
Stars: ✭ 374 (-9.22%)
Mutual labels:  image-classification
Face recognition
🍎 My own face recognition with deep neural networks.
Stars: ✭ 328 (-20.39%)
Mutual labels:  image-classification
Medpy
Medical image processing in Python
Stars: ✭ 321 (-22.09%)
Mutual labels:  image-classification
Multitask Learning
Awesome Multitask Learning Resources
Stars: ✭ 361 (-12.38%)
Mutual labels:  meta-learning
Assembled Cnn
Tensorflow implementation of "Compounding the Performance Improvements of Assembled Techniques in a Convolutional Neural Network"
Stars: ✭ 319 (-22.57%)
Mutual labels:  image-classification
Activation Visualization Histogram
Compare SELUs (scaled exponential linear units) with other activations on MNIST, CIFAR10, etc.
Stars: ✭ 377 (-8.5%)
Mutual labels:  image-classification
Neural Pipeline
Neural networks training pipeline based on PyTorch
Stars: ✭ 315 (-23.54%)
Mutual labels:  image-classification
Artificio
Deep Learning Computer Vision Algorithms for Real-World Use
Stars: ✭ 326 (-20.87%)
Mutual labels:  image-classification
Brevitas
Brevitas: quantization-aware training in PyTorch
Stars: ✭ 343 (-16.75%)
Mutual labels:  image-classification
Bottleneck Transformer Pytorch
Implementation of Bottleneck Transformer in Pytorch
Stars: ✭ 408 (-0.97%)
Mutual labels:  image-classification

Meta-Learning with Differentiable Convex Optimization

This repository contains the code for the paper:
Meta-Learning with Differentiable Convex Optimization
Kwonjoon Lee, Subhransu Maji, Avinash Ravichandran, Stefano Soatto
CVPR 2019 (Oral)

Abstract

Many meta-learning approaches for few-shot learning rely on simple base learners such as nearest-neighbor classifiers. However, even in the few-shot regime, discriminatively trained linear predictors can offer better generalization. We propose to use these predictors as base learners to learn representations for few-shot learning and show they offer better tradeoffs between feature size and performance across a range of few-shot recognition benchmarks. Our objective is to learn feature embeddings that generalize well under a linear classification rule for novel categories. To efficiently solve the objective, we exploit two properties of linear classifiers: implicit differentiation of the optimality conditions of the convex problem and the dual formulation of the optimization problem. This allows us to use high-dimensional embeddings with improved generalization at a modest increase in computational overhead. Our approach, named MetaOptNet, achieves state-of-the-art performance on miniImageNet, tieredImageNet, CIFAR-FS and FC100 few-shot learning benchmarks.

Citation

If you use this code for your research, please cite our paper:

@inproceedings{lee2019meta,
  title={Meta-Learning with Differentiable Convex Optimization},
  author={Kwonjoon Lee and Subhransu Maji and Avinash Ravichandran and Stefano Soatto},
  booktitle={CVPR},
  year={2019}
}

Dependencies

Usage

Installation

  1. Clone this repository:

    git clone https://github.com/kjunelee/MetaOptNet.git
    cd MetaOptNet
    
  2. Download and decompress dataset files: miniImageNet (courtesy of Spyros Gidaris), tieredImageNet, FC100, CIFAR-FS

  3. For each dataset loader, specify the path to the directory. For example, in MetaOptNet/data/mini_imagenet.py line 30:

    _MINI_IMAGENET_DATASET_DIR = 'path/to/miniImageNet'
    

Meta-training

  1. To train MetaOptNet-SVM on 5-way miniImageNet benchmark:
    python train.py --gpu 0,1,2,3 --save-path "./experiments/miniImageNet_MetaOptNet_SVM" --train-shot 15 \
    --head SVM --network ResNet --dataset miniImageNet --eps 0.1
    
    As shown in Figure 2, of our paper, we can meta-train the embedding once with a high shot for all meta-testing shots. We don't need to meta-train with all possible meta-test shots unlike in Prototypical Networks.
  2. You can experiment with varying base learners by changing '--head' argument to ProtoNet or Ridge. Also, you can change the backbone architecture to vanilla 4-layer conv net by setting '--network' argument to ProtoNet. For other arguments, please see MetaOptNet/train.py from lines 85 to 114.
  3. To train MetaOptNet-SVM on 5-way tieredImageNet benchmark:
    python train.py --gpu 0,1,2,3 --save-path "./experiments/tieredImageNet_MetaOptNet_SVM" --train-shot 10 \
    --head SVM --network ResNet --dataset tieredImageNet
    
  4. To train MetaOptNet-RR on 5-way CIFAR-FS benchmark:
    python train.py --gpu 0 --save-path "./experiments/CIFAR_FS_MetaOptNet_RR" --train-shot 5 \
    --head Ridge --network ResNet --dataset CIFAR_FS
    
  5. To train MetaOptNet-RR on 5-way FC100 benchmark:
    python train.py --gpu 0 --save-path "./experiments/FC100_MetaOptNet_RR" --train-shot 15 \
    --head Ridge --network ResNet --dataset FC100
    

Meta-testing

  1. To test MetaOptNet-SVM on 5-way miniImageNet 1-shot benchmark:
python test.py --gpu 0,1,2,3 --load ./experiments/miniImageNet_MetaOptNet_SVM/best_model.pth --episode 1000 \
--way 5 --shot 1 --query 15 --head SVM --network ResNet --dataset miniImageNet
  1. Similarly, to test MetaOptNet-SVM on 5-way miniImageNet 5-shot benchmark:
python test.py --gpu 0,1,2,3 --load ./experiments/miniImageNet_MetaOptNet_SVM/best_model.pth --episode 1000 \
--way 5 --shot 5 --query 15 --head SVM --network ResNet --dataset miniImageNet

Acknowledgments

This code is based on the implementations of Prototypical Networks, Dynamic Few-Shot Visual Learning without Forgetting, and DropBlock.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].