Evaluating AlexNet features at various depths

Overview

Linear Separability Evaluation

This repo provides the scripts to test a learned AlexNet's feature representation performance at the five different convolutional levels -- in parallel. The training lasts 36 epochs and should be finished in <1.5days.

Usage

$python eval_linear_probes.py

usage: eval_linear_probes.py [-h] [--data DATA] [--ckpt-dir DIR] [--device d]
                             [--modelpath MODELPATH] [--workers N]
                             [--epochs N] [--batch-size N]
                             [--learning-rate FLOAT] [--tencrops] [--evaluate]
                             [--img-size IMG_SIZE] [--crop-size CROP_SIZE]
                             [--imagenet-path IMAGENET_PATH]

AlexNet standard linear separability tests

optional arguments:
  -h, --help            show this help message and exit
  --data DATA           Dataset Imagenet or Places (default: Imagenet)
  --ckpt-dir DIR        path to checkpoints (default: ./test)
  --device d            GPU device
  --modelpath MODELPATH
                        path to model
  --workers N           number of data loading workers (default: 6)
  --epochs N            number of epochs (default: 36)
  --batch-size N        batch size (default: 192)
  --learning-rate FLOAT
                        initial learning rate (default: 0.01)
  --tencrops            flag to not use tencrops (default: on)
  --evaluate            flag to evaluate only (default: off)
  --img-size IMG_SIZE   imagesize (default: 256)
  --crop-size CROP_SIZE
                        cropsize for CNN (default: 224)
  --imagenet-path IMAGENET_PATH
                        path to imagenet folder, where train and val are
                        located

Settings

The settings follow the caffe code provided in Zhang et al., with optional tencrops enabled. Average pooling can be used, but max-pooling is faster and overall more common so it is used here.

Reference

If you use this code, please consider citing the following paper:

Yuki M. Asano, Christian Rupprecht and Andrea Vedaldi. "A critical analysis of self-supervision, or what we can learn from a single image." Proc. ICLR (2020)

@inproceedings{asano2020a,
  title={A critical analysis of self-supervision, or what we can learn from a single image},
  author={Asano, Yuki M. and Rupprecht, Christian and Vedaldi, Andrea},
  booktitle={International Conference on Learning Representations (ICLR)},
  year={2020},
}
You might also like...
Official repository for the ICLR 2021 paper Evaluating the Disentanglement of Deep Generative Models with Manifold Topology

Official repository for the ICLR 2021 paper Evaluating the Disentanglement of Deep Generative Models with Manifold Topology Sharon Zhou, Eric Zelikman

Repository for XLM-T, a framework for evaluating multilingual language models on Twitter data

This is the XLM-T repository, which includes data, code and pre-trained multilingual language models for Twitter. XLM-T - A Multilingual Language Mode

Resources for the
Resources for the "Evaluating the Factual Consistency of Abstractive Text Summarization" paper

Evaluating the Factual Consistency of Abstractive Text Summarization Authors: Wojciech Kryściński, Bryan McCann, Caiming Xiong, and Richard Socher Int

Evaluating different engineering tricks that make RL work

Reinforcement Learning Tricks, Index This repository contains the code for the paper "Distilling Reinforcement Learning Tricks for Video Games". Short

BARTScore: Evaluating Generated Text as Text Generation
BARTScore: Evaluating Generated Text as Text Generation

This is the Repo for the paper: BARTScore: Evaluating Generated Text as Text Generation Updates 2021.06.28 Release online evaluation Demo 2021.06.25 R

A collection of metrics for evaluating timbre dissimilarity using the TorchMetrics API
A collection of metrics for evaluating timbre dissimilarity using the TorchMetrics API

Timbre Dissimilarity Metrics A collection of metrics for evaluating timbre dissimilarity using the TorchMetrics API Installation pip install -e . Usag

🤖 A Python library for learning and evaluating knowledge graph embeddings
🤖 A Python library for learning and evaluating knowledge graph embeddings

PyKEEN PyKEEN (Python KnowlEdge EmbeddiNgs) is a Python package designed to train and evaluate knowledge graph embedding models (incorporating multi-m

Code Repo for the ACL21 paper
Code Repo for the ACL21 paper "Common Sense Beyond English: Evaluating and Improving Multilingual LMs for Commonsense Reasoning"

Common Sense Beyond English: Evaluating and Improving Multilingual LMs for Commonsense Reasoning This is the Github repository of our paper, "Common S

Benchmark for evaluating open-ended generation
Benchmark for evaluating open-ended generation

OpenMEVA Contributed by Jian Guan, Zhexin Zhang. Thank Jiaxin Wen for DeBugging. OpenMEVA is a benchmark for evaluating open-ended story generation me

Comments
  • cant start training

    cant start training

    Traceback (most recent call last): File "eval_linear_probes.py", line 295, in model = model_with_probes(model_path=args.modelpath) File "eval_linear_probes.py", line 88, in model_with_probes state_dict = torch.load(model_path)['state_dict'] File "/home/ameenali/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 584, in load with _open_file_like(f, 'rb') as opened_file: File "/home/ameenali/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 234, in _open_file_like return _open_file(name_or_buffer, mode) File "/home/ameenali/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 215, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '.ckpt400.pth' where can i find the checkpoint file?

    opened by AmeenAli 1
  • Some questions about model structure.

    Some questions about model structure.

    Hi, I have some questions about codes.

    I see you integrate AlexNet with probes together. I wonder if I freeze trained AlexNet and use forward_hook to obtain immediate features, then train probes on these features, whether this design can produce the same effect with not changing BN layers?

    opened by JGyoung33 0
  • General Questions

    General Questions

    Hello I have a few questions regarding the code,

    1. In a previous issue I asked about a checkpoint file and you asked me to use the one from https://github.com/yukimasano/self-label/ for example, my question is what is the training being done in the eval_linear_probes.py? if I train using this script and evaluate later will I get the same numbers as in your paper? if not how can I re-produce thanks best
    opened by AmeenAli 2
Owner
Yuki M. Asano
I'm an Computer Vision researcher at the University of Amsterdam. Did my PhD at the Visual Geometry Group in Oxford.
Yuki M. Asano
Base pretrained models and datasets in pytorch (MNIST, SVHN, CIFAR10, CIFAR100, STL10, AlexNet, VGG16, VGG19, ResNet, Inception, SqueezeNet)

This is a playground for pytorch beginners, which contains predefined models on popular dataset. Currently we support mnist, svhn cifar10, cifar100 st

Aaron Chen 2.4k Dec 28, 2022
A PyTorch Image-Classification With AlexNet And ResNet50.

PyTorch 图像分类 依赖库的下载与安装 在终端中执行 pip install -r -requirements.txt 完成项目依赖库的安装 使用方式 数据集的准备 STL10 数据集 下载:STL-10 Dataset 存储位置:将下载后的数据集中 train_X.bin,train_y.b

FYH 4 Feb 22, 2022
NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

null 5 Nov 3, 2022
This project is based on RIFE and aims to make RIFE more practical for users by adding various features and design new models

This project is based on RIFE and aims to make RIFE more practical for users by adding various features and design new models. Because improving the PSNR index is not compatible with subjective effects, we hope this part of work and our academic research are independent of each other.

hzwer 190 Jan 8, 2023
A simple but complete full-attention transformer with a set of promising experimental features from various papers

x-transformers A concise but fully-featured transformer, complete with a set of promising experimental features from various papers. Install $ pip ins

Phil Wang 2.3k Jan 3, 2023
improvement of CLIP features over the traditional resnet features on the visual question answering, image captioning, navigation and visual entailment tasks.

CLIP-ViL In our paper "How Much Can CLIP Benefit Vision-and-Language Tasks?", we show the improvement of CLIP features over the traditional resnet fea

null 310 Dec 28, 2022
Static Features Classifier - A static features classifier for Point-Could clusters using an Attention-RNN model

Static Features Classifier This is a static features classifier for Point-Could

ABDALKARIM MOHTASIB 1 Jan 25, 2022
High-level library to help with training and evaluating neural networks in PyTorch flexibly and transparently.

TL;DR Ignite is a high-level library to help with training and evaluating neural networks in PyTorch flexibly and transparently. Click on the image to

null 4.2k Jan 1, 2023
UNION: An Unreferenced Metric for Evaluating Open-ended Story Generation

UNION Automatic Evaluation Metric described in the paper UNION: An UNreferenced MetrIc for Evaluating Open-eNded Story Generation (EMNLP 2020). Please

null 50 Dec 30, 2022
A library for preparing, training, and evaluating scalable deep learning hybrid recommender systems using PyTorch.

collie_recs Collie is a library for preparing, training, and evaluating implicit deep learning hybrid recommender systems, named after the Border Coll

ShopRunner 97 Jan 3, 2023