{"notes":[{"id":"contrastive-learning/examplar-cnn","category":"contrastive-learning","legacyPath":"contrastive-learning/1406-examplar-cnn","legacySlug":"1406-examplar-cnn","legacyPaths":[],"title":"Exemplar CNN","subtitle":"Finding Invariant Features","author":"Z. Yuan","paperDate":"2014-06-26","publishedOn":"2025-01-22","paperTitle":"Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks","paperUrl":"https://arxiv.org/abs/1406.6909","bibliography":{"title":"Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks","authors":["Alexey Dosovitskiy","Philipp Fischer","Jost Tobias Springenberg","Martin Riedmiller","Thomas Brox"],"url":"https://arxiv.org/abs/1406.6909","pdfUrl":"https://arxiv.org/pdf/1406.6909","codeUrl":null,"preprint":{"id":"1406.6909","submittedOn":"2014-06-26","url":"https://arxiv.org/abs/1406.6909"},"publication":{"venue":"IEEE Transactions on Pattern Analysis and Machine Intelligence","shortVenue":"IEEE TPAMI","year":2016,"kind":"journal","url":"https://doi.org/10.1109/tpami.2015.2496141"},"citation":"@misc{contrastivelearningexamplarcnn2014,\n  title = {{Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks}},\n  author = {Alexey Dosovitskiy and Philipp Fischer and Jost Tobias Springenberg and Martin Riedmiller and Thomas Brox},\n  year = {2014},\n  eprint = {1406.6909},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1406.6909}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/examplar-cnn.9f293122852b.bib"},"thumbnail":{"src":"/content/papers/assets/52a4c5931d81eeedf2a0857944f10ddc3749d7195e81184efa2a80bc736d062d.jpg","width":1080,"height":418},"locale":"en","path":"/content/papers/en/contrastive-learning/examplar-cnn.be54ec33fac2.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"experimental-setup","text":"Experimental Setup","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"ablation---number-of-proxy-categories","text":"Ablation - Number of Proxy Categories","depth":3},{"id":"ablation---number-of-samples","text":"Ablation - Number of Samples","depth":3},{"id":"ablation---type-of-image-augmentation","text":"Ablation - Type of Image Augmentation","depth":3},{"id":"ablation---parameter-configuration","text":"Ablation - Parameter Configuration","depth":3},{"id":"filter-visualization","text":"Filter Visualization","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"ablation---performance-in-image-classification":"ablation---parameter-configuration"},"guide":null,"relatedReading":[{"id":"contrastive-learning/invaspread","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/cpc","relation":"comparison","topic":"How to define a self-supervised prediction task"}]},{"id":"contrastive-learning/invaspread","category":"contrastive-learning","legacyPath":"contrastive-learning/1904-invaspread","legacySlug":"1904-invaspread","legacyPaths":[],"title":"InvaSpread","subtitle":"Traces Under Difficulties","author":"Z. Yuan","paperDate":"2019-04-06","publishedOn":"2025-01-23","paperTitle":"Unsupervised Embedding Learning via Invariant and Spreading Instance Feature","paperUrl":"https://arxiv.org/abs/1904.03436","bibliography":{"title":"Unsupervised Embedding Learning via Invariant and Spreading Instance Feature","authors":["Mang Ye","Xu Zhang","Pong C. Yuen","Shih-Fu Chang"],"url":"https://arxiv.org/abs/1904.03436","pdfUrl":"https://arxiv.org/pdf/1904.03436","codeUrl":null,"preprint":{"id":"1904.03436","submittedOn":"2019-04-06","url":"https://arxiv.org/abs/1904.03436"},"publication":{"venue":"CVPR","year":2019,"kind":"conference","url":"https://arxiv.org/abs/1904.03436"},"citation":"@misc{contrastivelearninginvaspread2019,\n  title = {{Unsupervised Embedding Learning via Invariant and Spreading Instance Feature}},\n  author = {Mang Ye and Xu Zhang and Pong C. Yuen and Shih-Fu Chang},\n  year = {2019},\n  eprint = {1904.03436},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1904.03436}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/invaspread.a46b3f57ac16.bib"},"thumbnail":{"src":"/content/papers/assets/135f248ffa5c98e798e9cd5d75ab7cdb38fda8130eae2511547941d70f316165.jpg","width":1596,"height":524},"locale":"en","path":"/content/papers/en/contrastive-learning/invaspread.294046788c59.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"loss-function","text":"Loss Function","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"experiments-with-unknown-classes","text":"Experiments with Unknown Classes","depth":3},{"id":"ablation-study","text":"Ablation Study","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/examplar-cnn","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/cpc","relation":"comparison","topic":"How to define a self-supervised prediction task"}]},{"id":"contrastive-learning/cpc","category":"contrastive-learning","legacyPath":"contrastive-learning/1807-cpc","legacySlug":"1807-cpc","legacyPaths":[],"title":"CPC","subtitle":"Today shapes tomorrow","author":"Z. Yuan","paperDate":"2018-07-10","publishedOn":"2025-01-16","paperTitle":"Representation Learning with Contrastive Predictive Coding","paperUrl":"https://arxiv.org/abs/1807.03748","bibliography":{"title":"Representation Learning with Contrastive Predictive Coding","authors":["Aaron van den Oord","Yazhe Li","Oriol Vinyals"],"url":"https://arxiv.org/abs/1807.03748","pdfUrl":"https://arxiv.org/pdf/1807.03748","codeUrl":null,"preprint":{"id":"1807.03748","submittedOn":"2018-07-10","url":"https://arxiv.org/abs/1807.03748"},"publication":null,"citation":"@misc{contrastivelearningcpc2018,\n  title = {{Representation Learning with Contrastive Predictive Coding}},\n  author = {Aaron van den Oord and Yazhe Li and Oriol Vinyals},\n  year = {2018},\n  eprint = {1807.03748},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1807.03748}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/cpc.4cc0d1d40232.bib"},"thumbnail":{"src":"/content/papers/assets/a60b1a92f6088b36ddee7c87fed67d1e73769e003c30805f963c6b284d0c3a86.jpg","width":1382,"height":626},"locale":"en","path":"/content/papers/en/contrastive-learning/cpc.915decb4d747.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"infonce","text":"InfoNCE","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"speech-recognition","text":"Speech Recognition","depth":3},{"id":"ablation-experiments","text":"Ablation Experiments","depth":3},{"id":"speaker-identification-visualization","text":"Speaker Identification Visualization","depth":3},{"id":"image-recognition","text":"Image Recognition","depth":3},{"id":"visualization-of-image-features","text":"Visualization of Image Features","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/examplar-cnn","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/invaspread","relation":"comparison","topic":"How to define a self-supervised prediction task"}]}],"text":"While reading the paper, I noticed that many studies reference the ideas from this work, so let's take some time to look at it.\n\nThe concept of the paper is simple, but many experimental results can inspire us with new ideas.\n\n## Defining the Problem\n\nThe advantage of supervised learning is also its drawback: it requires a large amount of labeled data. In some specific application scenarios, such data might be hard to obtain or expensive.\n\nMoreover, if we want to perform transfer learning between different tasks, such as switching from object classification to descriptor matching, the performance of supervised learning might not be ideal.\n\nSince it’s not ideal, a simple idea arises: what if we don’t use data labels?\n\nBut if we don't use data labels, how should we train the model?\n\nThe authors suggest: we need a proxy task.\n\n## Solving the Problem\n\nThe authors propose a training method that does not require manual annotations, called **Exemplar-CNN**.\n\nThe core concept is very simple:\n\n1. **Randomly extract image patches**: To focus more on areas with rich object information, image patches of size $32 \\times 32$ are sampled from unlabeled images with probability proportional to the mean squared image-gradient magnitude within each patch.\n\n\n> [!TIP]\n> \n> This is not the gradient from backpropagation, but the gradient of the image. The authors believe that the gradient in the image can help us find more meaningful patches.\n\n\n2. **Apply various random transformations to the image patches**: Such as translation, scaling, rotation, color adjustment, contrast adjustment, etc., to generate multiple \"deformed versions.\" These transformations encourage the network to learn the corresponding invariances (e.g., rotation invariance, color invariance).\n3. **Form \"proxy categories\" and perform discriminative learning**: Each original image patch and its deformed versions are considered as \"positive samples\" in the same proxy category.\n\nThe system repeats this process across many images, generating many proxy categories, and trains a CNN to distinguish \"which image patches (including all deformed versions) belong to the same proxy category and which belong to other proxy categories.\" This way, the model learns to distinguish different image patches and is encouraged to become less sensitive to \"various deformations of the same image.\"\n\nThe list of transformations used in the paper is as follows:\n\n- **Translation**: Translations in the vertical or horizontal direction, not exceeding 20% of the image patch size.\n- **Scaling**: Rescale the image patch proportionally, with a scale factor between 0.7 and 1.4.\n- **Rotation**: Rotation angle within ±20 degrees.\n- **Contrast 1**: Multiply each pixel’s projection in all principal component directions by a factor between 0.5 and 2 (independent for each principal direction, the same for all pixels in the patch).\n- **Contrast 2**:\n  - Raise the saturation and brightness (S and V components in HSV color space) to a power between 0.25 and 4.\n  - Then multiply by a factor between 0.7 and 1.4, and add an offset between −0.1 and 0.1.\n- **Color**: Apply an offset between −0.1 and 0.1 to the hue (H component in HSV color space).\n\n\n> [!TIP]\n> \n> In the ablation experiments section, the authors verify the effectiveness of these transformations.\n\n\nThe training data after cropping looks like this (using STL-10 as an example):\n\n\n\n![dataset](/content/papers/assets/52a4c5931d81eeedf2a0857944f10ddc3749d7195e81184efa2a80bc736d062d.jpg)\n\n\n\n### Experimental Setup\n\nTo compare **Exemplar-CNN** with previous unsupervised feature learning methods, the authors performed a series of experiments using the following datasets: STL-10, CIFAR-10, Caltech-101, and Caltech-256.\n\nExcept for the dataset-transfer experiment, proxy-class training patches come from STL-10's unlabeled images. For classification evaluation, a linear SVM is then trained using labeled examples from each dataset.\n\nDetails about the datasets, such as the amount of data, number of categories, image sizes, are as follows:\n\n- **Number of categories**:\n  - STL-10 and CIFAR-10: 10 categories.\n  - Caltech-101: 101 categories.\n  - Caltech-256: 256 categories.\n- **Image size processing**:\n  - CIFAR-10: Adjusted from $32 \\times 32$ to $64 \\times 64$.\n  - Caltech-101: Adjusted to $150 \\times 150$.\n  - Caltech-256: Adjusted to $256 \\times 256$.\n\nNext, the authors designed several network architectures as follows:\n\n- **Small network (64c5-64c5-128f)**:\n  - Two convolutional layers (64 filters each).\n  - One fully connected layer (128 units).\n  - Final Softmax layer.\n- **Medium network (64c5-128c5-256c5-512f)**:\n  - Three convolutional layers (64, 128, 256 filters).\n  - One fully connected layer (512 units).\n- **Large network (92c5-256c5-512c5-1024f)**:\n  - Three convolutional layers (92, 256, 512 filters).\n  - One fully connected layer (1024 units).\n- **Convolution and pooling details**:\n  - All convolution filters correspond to $5 \\times 5$ regions of the input.\n  - $2 \\times 2$ max pooling is applied after the first two convolutional layers.\n- **Other techniques**:\n  - Dropout is used in the fully connected layers.\n  - Based on the Caffe implementation, training details are in Appendix B.2.\n\nThe testing method applies the network to images of any size, computes feature maps, and selects the appropriate pooling method based on the dataset:\n\n- STL-10 and CIFAR-10: Quadrant max pooling (4 values per feature map).\n- Caltech-101 and Caltech-256: Three-level spatial pyramid pooling ($1+4+16=21$ values).\n\nFinally, the learned features are frozen and a one-vs-rest linear SVM is trained on labeled examples for classification. The feature pretraining is unsupervised; this downstream evaluation still uses class labels.\n\n## Discussion\n\n### Comparison with Other Methods\n\n\n\n![result](/content/papers/assets/8beeea477c413bdd28ee69403a980d8c4d22550dd6f0024b27e06d4ed7d8249b.jpg)\n\n\n\nThe table above compares the performance of **Exemplar-CNN** with other unsupervised feature learning methods on different datasets.\n\nThe larger **Exemplar-CNN** has the best result among the unsupervised feature-learning methods shown for each dataset. On STL-10, its 74.2% exceeds the table's supervised reference of 70.1%. The supervised results are higher on the other datasets, and the methods use different training conditions.\n\n### Ablation - Number of Proxy Categories\n\n\n\n![num_classes](/content/papers/assets/7160448ec9abe144de27e04fd75a28fc27b1d49b319e3392af59a0beb687ae0c.jpg)\n\n\n\nThe authors first tested the impact of the number of proxy categories on performance.\n\nThe experimental design adjusted the number of proxy categories $N$ from 50 to 32,000 and observed changes in classification accuracy.\n\nIn the figure, STL-10 accuracy rises until roughly 4,000–8,000 surrogate classes, then levels off or declines, while validation error on the surrogate-class task keeps rising. The authors suggest that too many similar or duplicate seed patches become difficult to distinguish and can hurt the usefulness of the learned features.\n\n\n> [!TIP]\n> \n> This experiment did not compare feature normalization, so this curve alone cannot identify why accuracy stops improving.\n\n\n### Ablation - Number of Samples\n\n\n\n![num_samples](/content/papers/assets/2225aee7d0b3dbc4053b3de583132afea8ec0690f17eea71b8df96bb6671eafe.jpg)\n\n\n\nNext, the authors explored the effect of the number of samples per proxy category $K$.\n\nThey adjusted $K$ from 1 to 300 and observed changes in classification accuracy.\n\nSTL-10 accuracy improves with more samples per surrogate class and levels off near 100. The authors take this to mean that about 100 transformed samples suffice to approximate the expected objective in their Equation (3) in this experiment; further samples change the result little here.\n\n### Ablation - Type of Image Augmentation\n\n\n\n![augmentation](/content/papers/assets/d5d7ac3dc0915a68389f73b704ba8ccaa310e27e36dc931d1bfb10d0071b9738.jpg)\n\n\n\nThe authors further explored the effect of different types of image augmentations on performance.\n\nThe experimental design fixed the original \"seed\" samples and adjusted the types of transformations applied to the proxy data, including scaling, rotation, translation, color change, contrast change, and so on.\n\nThe negative values in the figure are the accuracy differences after removing each type of transformation, relative to using all of them. Removing translation, color variation, or contrast variation usually causes a larger drop; scaling and rotation have smaller effects. Sensitivity also differs among the datasets.\n\n### Ablation - Parameter Configuration\n\n\n\n![result](/content/papers/assets/ad5a378e1fe37c38f5f5768e23ad6086d329151f76fa94dbbd04655bc8ecae21.jpg)\n\n\n\nThe table above shows the performance of **Exemplar-CNN** across different datasets.\n\nSome wider or deeper configurations improve accuracy, but a larger network is not always better: the four-convolution-layer `64c5-64c5-64c5-64c5-128f` performs worse than the three-layer `64c5-64c5-64c5-128f`. Increasing surrogate classes from 8,000 to 16,000 for the same architecture also has mixed effects across the evaluation columns.\n\n### Filter Visualization\n\n\n\n![visualization](/content/papers/assets/73db85a33fb1cfd89576321307a73088b60e67d178c1557090005c4a8655be12.jpg)\n\n\n\nThe figure above shows the filters learned by the first layer of the `64c5-64c5-128f` network during training on proxy data from different datasets, arranged as follows:\n\n- **Top**: Proxy data from the STL-10 dataset.\n- **Middle**: Proxy data from the CIFAR-10 dataset.\n- **Bottom**: Proxy data from the Caltech-101 dataset.\n\nThe first-layer filters trained from different datasets vary in their color patches and local texture.\n\nThe authors separately compare training data sources in classification experiments: patches from the target dataset generally work best, but the differences across datasets are small. Those results support feature transfer more directly than the filter display alone.\n\n## Conclusion\n\nThis paper presents an unsupervised feature learning method based on a discriminative objective that does not rely on object category labels. The authors generate proxy labels through data augmentation and define the invariances the network must learn via image transformations.\n\nExperimental results demonstrate that **Exemplar-CNN** significantly improves feature learning for classification accuracy, and the discriminative objective offers advantages over previous unsupervised learning objectives.\n\n\n> [!TIP]\n> \n> Early comparative studies in contrastive learning often cite this paper. Although there are many areas for improvement, it undoubtedly provided valuable insights for subsequent research and is worth a look.\n","imageSizes":{"/content/papers/assets/52a4c5931d81eeedf2a0857944f10ddc3749d7195e81184efa2a80bc736d062d.jpg":{"width":1080,"height":418},"/content/papers/assets/8beeea477c413bdd28ee69403a980d8c4d22550dd6f0024b27e06d4ed7d8249b.jpg":{"width":1738,"height":440},"/content/papers/assets/7160448ec9abe144de27e04fd75a28fc27b1d49b319e3392af59a0beb687ae0c.jpg":{"width":996,"height":688},"/content/papers/assets/2225aee7d0b3dbc4053b3de583132afea8ec0690f17eea71b8df96bb6671eafe.jpg":{"width":916,"height":664},"/content/papers/assets/d5d7ac3dc0915a68389f73b704ba8ccaa310e27e36dc931d1bfb10d0071b9738.jpg":{"width":1044,"height":596},"/content/papers/assets/ad5a378e1fe37c38f5f5768e23ad6086d329151f76fa94dbbd04655bc8ecae21.jpg":{"width":1536,"height":662},"/content/papers/assets/73db85a33fb1cfd89576321307a73088b60e67d178c1557090005c4a8655be12.jpg":{"width":876,"height":708}}}
