All models

DeepEMD

A few-shot image classifier that compares images by an Earth Mover's Distance between their regions.

Image classification · 1,899 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (8 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
12.4M
Operations
1,899
Framework
PyTorch
Recurrent
No
Published
CVPR 2020
Authors
Chi Zhang, Yujun Cai, Guosheng Lin, Chunhua Shen
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15914
Graph hash
8e79ceb06e1cf9e3b81ec99556d4308c75653d7776196b7452cc7939b84d0619
Skeleton hash
4ddadde7bafd0b87cefd90ab4c6a8bbaa3a3a7ddedca124270d159d2ed66817b
Architecture hash
bbc0591a2c9e3865999e7c725c5a8da7690a4619d6e5f380e3e21a83660c3711
Diagram SHA-256
e9f94b6447c3d3e1926d29a997c5b6fe3050ad332b99546814aac12b4a83a5c4
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

DeepEMD is a few-shot image classifier: given a handful of labeled example images per class, it decides which class a new query image belongs to by matching regions of the two images. It uses the Earth Mover's Distance (EMD) as the metric, computing a structural distance between dense image representations. The EMD finds the matching flows between image parts with the minimum matching cost, and that cost becomes the image distance used for classification.

A cross-reference mechanism sets the weight of each region by comparing it with the global statistics of the other image, so regions relevant to both images count more than cluttered background. Based on the implicit function theorem, the EMD can sit inside the network as a layer and be trained end to end. This model is the DeepEMD-FCN variant, in which a fully convolutional network produces a feature map whose local feature vectors are the nodes being matched.

The released results use a ResNet-12 backbone, and on miniImageNet the authors report 66.50 for DeepEMD-FCN in the 1-shot 5-way setting. The code offers two solvers for the linear program inside the EMD layer, OpenCV and QPTH; OpenCV is faster but omits the gradients through the constraints.

Key idea. DeepEMD showed that few-shot images can be classified by an Earth Mover's Distance between weighted image regions, made differentiable so it trains end to end.

  • deepemd
  • deepemd-fcn
  • earth mover's distance
  • few-shot learning
  • few-shot image classification
  • optimal matching
  • miniimagenet

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{zhang2023deepemddifferentiableearthmovers,
      title={DeepEMD: Differentiable Earth Mover's Distance for Few-Shot Learning}, 
      author={Chi Zhang and Yujun Cai and Guosheng Lin and Chunhua Shen},
      year={2023},
      eprint={2003.06777},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2003.06777}, 
}