VOneNet: CNNs with a Primary Visual Cortex Front-End

Related tags

Deep Learningvonenet
Overview

VOneNet: CNNs with a Primary Visual Cortex Front-End

A family of biologically-inspired Convolutional Neural Networks (CNNs). VOneNets have the following features:

  • Fixed-weight neural network model of the primate primary visual cortex (V1) as the front-end.
  • Robust to image perturbations
  • Brain-mapped
  • Flexible: can be adapted to different back-end architectures

read more...

Available Models

(Click on model names to download the weights of ImageNet-trained models. Alternatively, you can use the function get_model in the vonenet package to download the weights.)

Name Description
VOneResNet50 Our best performing VOneNet with a ResNet50 back-end
VOneCORnet-S VOneNet with a recurrent neural network back-end based on the CORnet-S
VOneAlexNet VOneNet with a back-end based on AlexNet

Quick Start

VOneNets was trained with images normalized with mean=[0.5,0.5,0.5] and std=[0.5,0.5,0.5]

More information coming soon...

Longer Motivation

Current state-of-the-art object recognition models are largely based on convolutional neural network (CNN) architectures, which are loosely inspired by the primate visual system. However, these CNNs can be fooled by imperceptibly small, explicitly crafted perturbations, and struggle to recognize objects in corrupted images that are easily recognized by humans. Recently, we observed that CNN models with a neural hidden layer that better matches primate primary visual cortex (V1) are also more robust to adversarial attacks. Inspired by this observation, we developed VOneNets, a new class of hybrid CNN vision models. Each VOneNet contains a fixed weight neural network front-end that simulates primate V1, called the VOneBlock, followed by a neural network back-end adapted from current CNN vision models. The VOneBlock is based on a classical neuroscientific model of V1: the linear-nonlinear-Poisson model, consisting of a biologically-constrained Gabor filter bank, simple and complex cell nonlinearities, and a V1 neuronal stochasticity generator. After training, VOneNets retain high ImageNet performance, but each is substantially more robust, outperforming the base CNNs and state-of-the-art methods by 18% and 3%, respectively, on a conglomerate benchmark of perturbations comprised of white box adversarial attacks and common image corruptions. Additionally, all components of the VOneBlock work in synergy to improve robustness. Read more: Dapello*, Marques*, et al. (biorxiv, 2020)

Requirements

  • Python 3.6+
  • PyTorch 0.4.1+
  • numpy
  • pandas
  • tqdm
  • scipy

Citation

Dapello, J., Marques, T., Schrimpf, M., Geiger, F., Cox, D.D., DiCarlo, J.J. (2020) Simulating a Primary Visual Cortex at the Front of CNNs Improves Robustness to Image Perturbations. biorxiv. doi.org/10.1101/2020.06.16.154542

License

GNU GPL 3+

FAQ

Soon...

Setup and Run

  1. You need to clone it in your local repository $ git clone https://github.com/dicarlolab/vonenet.git

  2. And when you setup its codes, you must need 'val' directory. so here is link. this link is from Korean's blog I refered as below https://seongkyun.github.io/others/2019/03/06/imagenet_dn/

    ** Download link**
    

https://academictorrents.com/collection/imagenet-2012

Once you download that large tar files, you must unzip that files -- all instructions below are refered above link, I only translate it

Unzip training dataset

$ mkdir train && mb ILSVRC2012_img_train.tar train/ && cd train $ tar -xvf ILSVRC2012_img_train.tar $ rm -f ILSVRC2012_img_train.tar (If you want to remove zipped file(tar)) $ find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xvf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done $ cd ..

Unzip validation dataset

$ mkdir val && mv ILSVRC2012_img_val.tar val/ && cd val && tar -xvf ILSVRC2012_img_val.tar $ wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh | bash

when it's finished, you can see train directory, val directory that 'val' directory is needed when setting up

Caution!!!!

after all execution above, must remove directory or file not having name n0000 -> there will be fault in training -> ex) 'ILSVRC2012_img_train' in train directory, 'ILSVRC2012_img_val.tar' in val directory

  1. if you've done getting data, then we can setting up go to local repository which into you cloned and open terminal (you must check your versions of python, pytorch, cudatoolkit if okay then,) $ python3 setup.py install $ python3 run.py --in_path {directory including above dataset, 'val' directory must be in!}

If you see any GPU related problem especially 'GPU is not available' although you already got

$ python3 run.py --in_path {directory including above dataset, 'val' directory must be in!} --ngpus 0

ngpus is 1 as default. if you don't care running on CPU you do so

Comments
  • GPU requirements

    GPU requirements

    Hi! Thank you so much for releasing the code!

    If I wanted to train the VOneResNet50 on a NVIDIA GeForce RTX 2070 how long should I expect it to take? I'm new to training neural networks this big and am working on a small project for a course, so it would be good to have an estimate.

    Thank you so much!

    Maria Inês

    opened by mariainescravo 4
  • k_exc parameter

    k_exc parameter

    Hi,

    Thanks for releasing your code! Quick question- what is the significance of the k_exc parameter used in the V1 block?

    https://github.com/dicarlolab/vonenet/blob/master/vonenet/modules.py#L91

    Norman

    opened by normster 4
  • Robust Accuracy results not matching

    Robust Accuracy results not matching

    Firstly, thank you for open sourcing the code for your paper. It has been really helpful !!

    I had a small query regarding the robust evaluation of models. I tried to evaluate the pretrained VoneResNet50 model with standard PGD with EOT and I get the following results:

    robust accuracy (top1):0.3666
    robust accuracy (top5):0.635
    

    My PGD parameters were as follows :

    iterations : 64
    norm : L inifity
    epsilon: 0.0009803921569 (= 1/1020)
    eot_iterations : 8
    Library: advertorch 
    

    I used the code in this PR and also checked with another library

    It seems like the top-5 accuracy is closer to the accuracy mentioned in the paper. I'm confused since the paper mentions that the accuracy is always top-1?

    opened by code-Assasin 3
  • Can you provide the trained VOneNet model file onto google drive?

    Can you provide the trained VOneNet model file onto google drive?

    Can you provide the trained VOneNet model file onto google drive so that I can download for my experiments. CIFAR-10, CIFAR-100, ImageNet datasets, do you have the trained model file??

    opened by machanic 2
  • Update README.md

    Update README.md

    There are problems in line 17, 18, 19 README.md. Because When I finished download, system tells me this is wrong extension.

    and add setup and run instructions. please check it and if there some error, please correct it

    opened by comeeasy 1
  • explaining neural variances

    explaining neural variances

    Thank you for the code for the V1Block. Interesting work!

    I was wondering how you exactly compared regular convolutional features and the ones from VOneNet to explain the Neural Variances.

    Since the paper stresses that this model is SoTA in explaining these, I would be really glad if you can include the code for that too / or if you could point me to existing repositories that do that (if you are aware of any), that'd be great too!

    Thanks again!

    opened by vinbhaskara 1
  • fix: added missing argument for restoring model training

    fix: added missing argument for restoring model training

    For restoring the model training, the code already provided the logic but forgot to add the argument to the parser. Now it is able to restore the model training providing the epoch number and the path containing those files.

    opened by ALLIESXO 0
  • How to test the top-scoring Brain Score model - vonenet-resnet50-non-stochastic?

    How to test the top-scoring Brain Score model - vonenet-resnet50-non-stochastic?

    Hi, I am trying to understand what's the correct way to test (using the pretrained model trained on ImageNet) the voneresnet-50-non_stochastic model that is currently scoring two on Brain Score.

    I want the model to be pretrained on ImageNet. When loading the model through net = vonenet.get_model(model_arch='resnet50', pretrained=True) a state_dict file that already contains the noise_level, noise_scale and noise_mode parameter gets loaded (in vonenet/__init__.py line 38. Do the pretrained model performance depends on these values to be fixed at 'neuronal', 0.35 and 0.07? Or can set one of these to 0 (which one?) and just keep using the same pretrained model for testing?

    Thanks, Valerio

    opened by ValerioB88 0
  • Alignment of quadrutre pairs (q0 and q1) in terms of input channels?

    Alignment of quadrutre pairs (q0 and q1) in terms of input channels?

    Hi Tiago and Joel, this is a very cool project.

    The initialize method of the GFB class doesn't set the random seed of randint:

        def initialize(self, sf, theta, sigx, sigy, phase):
            random_channel = torch.randint(0, self.in_channels, (self.out_channels,))
    

    Doesn't this cause the filters of simple_conv_q0 and simple_conv_q1 to be misaligned in terms of input channels?

    opened by Tal-Golan 1
  • add example of adversarial evaluation

    add example of adversarial evaluation

    check out my attack example and let me know what you think.

    I made it entirely self contained in adv_evaluate.py, and I added an example to the README.md

    opened by dapello 0
Owner
The DiCarlo Lab at MIT
Working to discover the neuronal algorithms underlying visual object recognition
The DiCarlo Lab at MIT
Implementation of CVPR 2020 Dual Super-Resolution Learning for Semantic Segmentation

Dual super-resolution learning for semantic segmentation 2021-01-02 Subpixel Update Happy new year! The 2020-12-29 update of SISR with subpixel conv p

Sam 79 Nov 24, 2022
Official PyTorch implementation of BlobGAN: Spatially Disentangled Scene Representations

BlobGAN: Spatially Disentangled Scene Representations Official PyTorch Implementation Paper | Project Page | Video | Interactive Demo BlobGAN.mp4 This

148 Dec 29, 2022
NAACL'2021: Factual Probing Is [MASK]: Learning vs. Learning to Recall

OptiPrompt This is the PyTorch implementation of the paper Factual Probing Is [MASK]: Learning vs. Learning to Recall. We propose OptiPrompt, a simple

Princeton Natural Language Processing 150 Dec 20, 2022
Simple-Neural-Network From Scratch in Python

Simple-Neural-Network From Scratch in Python This is a simple Neural Network created without any Machine Learning Libraries. The only dependencies are

Aum Shah 1 Dec 28, 2021
No-reference Image Quality Assessment(NIQA) Algorithms (BRISQUE, NIQE, PIQE, RankIQA, MetaIQA)

No-Reference Image Quality Assessment Algorithms No-reference Image Quality Assessment(NIQA) is a task of evaluating an image without a reference imag

Dae-Young Song 26 Jan 04, 2023
Text and code for the forthcoming second edition of Think Bayes, by Allen Downey.

Think Bayes 2 by Allen B. Downey The HTML version of this book is here. Think Bayes is an introduction to Bayesian statistics using computational meth

Allen Downey 1.5k Jan 08, 2023
Just Go with the Flow: Self-Supervised Scene Flow Estimation

Just Go with the Flow: Self-Supervised Scene Flow Estimation Code release for the paper Just Go with the Flow: Self-Supervised Scene Flow Estimation,

Himangi Mittal 50 Nov 22, 2022
SCI-AIDE : High-fidelity Few-shot Histopathology Image Synthesis for Rare Cancer Diagnosis

SCI-AIDE : High-fidelity Few-shot Histopathology Image Synthesis for Rare Cancer Diagnosis Pretrained Models In this work, we created synthetic tissue

Emirhan Kurtuluş 1 Feb 07, 2022
LightNet++: Boosted Light-weighted Networks for Real-time Semantic Segmentation

LightNet++ !!!New Repo.!!! ⇒ EfficientNet.PyTorch: Concise, Modular, Human-friendly PyTorch implementation of EfficientNet with Pre-trained Weights !!

linksense 237 Jan 05, 2023
Repository for the semantic WMI loss

Installation: pip install -e . Installing DL2: First clone DL2 in a separate directory and install it using the following commands: git clone https:/

Nick Hoernle 4 Sep 15, 2022
Cervix ROI Segmentation Using U-NET

Cervix ROI Segmentation Using U-NET Overview This code illustrate how to segment the ROI in cervical images using U-NET. The ROI here meant to include

Scotty Kwok 35 Sep 14, 2022
A python package simulating the quasi-2D pseudospin-1/2 Gross-Pitaevskii equation with NVIDIA GPU acceleration.

A python package simulating the quasi-2D pseudospin-1/2 Gross-Pitaevskii equation with NVIDIA GPU acceleration. Introduction spinor-gpe is high-level,

2 Sep 20, 2022
Code of Puregaze: Purifying gaze feature for generalizable gaze estimation, AAAI 2022.

PureGaze: Purifying Gaze Feature for Generalizable Gaze Estimation Description Our work is accpeted by AAAI 2022. Picture: We propose a domain-general

39 Dec 05, 2022
Image Matching Evaluation

Image Matching Evaluation (IME) IME provides to test any feature matching algorithm on datasets containing ground-truth homographies. Also, one can re

32 Nov 17, 2022
QuanTaichi evaluation suite

QuanTaichi: A Compiler for Quantized Simulations (SIGGRAPH 2021) Yuanming Hu, Jiafeng Liu, Xuanda Yang, Mingkuan Xu, Ye Kuang, Weiwei Xu, Qiang Dai, W

Taichi Developers 120 Jan 04, 2023
Normalization Calibration (NorCal) for Long-Tailed Object Detection and Instance Segmentation

NorCal Normalization Calibration (NorCal) for Long-Tailed Object Detection and Instance Segmentation On Model Calibration for Long-Tailed Object Detec

Tai-Yu (Daniel) Pan 24 Dec 25, 2022
Dense Deep Unfolding Network with 3D-CNN Prior for Snapshot Compressive Imaging, ICCV2021 [PyTorch Code]

Dense Deep Unfolding Network with 3D-CNN Prior for Snapshot Compressive Imaging, ICCV2021 [PyTorch Code]

Jian Zhang 20 Oct 24, 2022
MSG-Transformer: Exchanging Local Spatial Information by Manipulating Messenger Tokens

MSG-Transformer Official implementation of the paper MSG-Transformer: Exchanging Local Spatial Information by Manipulating Messenger Tokens, by Jiemin

Hust Visual Learning Team 68 Nov 16, 2022
Tensors and Dynamic neural networks in Python with strong GPU acceleration

PyTorch is a Python package that provides two high-level features: Tensor computation (like NumPy) with strong GPU acceleration Deep neural networks b

61.4k Jan 04, 2023
Simple data balancing baselines for worst-group-accuracy benchmarks.

BalancingGroups Code to replicate the experimental results from Simple data balancing baselines achieve competitive worst-group-accuracy. Replicating

Meta Research 29 Dec 02, 2022