GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ArashAkbarinia/DeepCSF: Contrast sensitivity function in deep networks!

BranchesTags
Open more actions menu

Latest commit

 

History

181 Commits
181 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Contrast sensitivity function in deep networks

The contrast sensitivity function (CSF) is a fundamental signature of the visual system that has been measured extensively in several species. It is defined by the visibility threshold for sinusoidal gratings at all spatial frequencies. Here, we investigated the CSF in deep neural networks using the same 2AFC contrast detection paradigm as in human psychophysics. Read more at: bioRxiv or Neural Networks

A more generic version of the linear probing method used in this repository and manuscript is available in a pip package called osculari PyPi Status. Use the osculari package GitHub Latest Release) for any other psychophysical experiments you wish to conduct with pretrained deep networks.

Usage

Train the linear classifier contrast discriminator

To train a linear classifier on top of a frozen pretrained network, run the command below:

python ../src/train.py \ 
-aname $MODEL --transfer_weights $MODEL_PATH $LAYER "classification" \
-dname "bw" --data_dir $DATA_DIR -b $BATCH_SIZE \
--experiment_name $EXPERIMENT_NAME -j $J --gpu 0 --output_dir $OUT_DIR \
--target_size 224 --epochs 10 --colour_space "imagenet_rgb" \
--vision_type "trichromat" --train_samples 15000 --val_sample 100 \
--contrast_space "rgb" --classifier "nn"

Arguments:

  • $MODEL is the pretrained network, e.g. resnet50.
  • $MODEL_PATH is the path to the weights of pretrained network, to obtain default weights pass the same name as $MODEL, e.g. resnet50.
  • $LAYER is the layer to cut off the network, e.g. fc.
  • $DATA_DIR the directory to the binary shape dataset, download from here.

Measuring the network/layer CSF

After training the linear classifier, you can measure its CSF with the following command:

python ../src/test.py -aname $MODEL_PATH --contrast_space $CONTRAST_SPACE \
--experiment_name $CONTRAST_SPACE --target_size 224 --output_dir $OUT_DIR \
--colour_space "imagenet_rgb"  --vision_type "trichromat" \
--print_freq 1000 --gpu 0 --classifier "nn" --mask_image "fixed_cycle"

Arguments:

  • $MODEL_PATH the path to saved checkpoint from the training procedure.
  • $CONTRAST_SPACE can be one of these three strings "lum_yog", "rg_yog", "yb_yog" corresponding to luminance, red-green and yellow-blue channels.

Citation

Akbarinia, A., Morgenstern, Y. and Gegenfurtner, K.R., 2023. Contrast sensitivity function in deep networks. Neural Networks, 164, pp.228-244.

About

Contrast sensitivity function in deep networks!

arashakbarinia.github.io/projects/deepcsf/

Topics

contrast-sensitivitydeep-neural-networksinterpreting-cnnspsychophysics

Resources

Readme
GPL-3.0 license
Activity

Stars

8 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.