ANNarchy 5.0.0
  • ANNarchy
  • Installation
  • Tutorial
  • Manual
  • Notebooks
  • Reference

  • ANNarchy
  • Core components
    • Network
    • Population
    • Projection
    • Monitor
    • PopulationView
    • Dendrite
  • Neuron and Synapse models
    • Neuron
    • Synapse
    • Parameter
    • Variable
    • Creating
    • Pruning
    • Constant
  • Neuron models
    • LeakyIntegrator
    • Izhikevich
    • IF_curr_exp
    • IF_cond_exp
    • IF_curr_alpha
    • IF_cond_alpha
    • HH_cond_exp
    • EIF_cond_alpha_isfa_ista
    • EIF_cond_exp_isfa_ista
  • Synapse models
    • Hebb
    • Oja
    • IBCM
    • STP
    • STDP
  • Inputs
    • InputArray
    • TimedArray
    • PoissonPopulation
    • TimedPoissonPopulation
    • SpikeSourceArray
    • HomogeneousCorrelatedSpikeTrains
    • CurrentInjection
    • DecodingProjection
    • ImagePopulation
    • VideoPopulation
  • Random Distributions
    • Uniform
    • DiscreteUniform
    • Normal
    • LogNormal
    • Exponential
    • Gamma
    • Binomial
  • Functions
    • add_function
    • functions
  • Callbacks
    • every
  • Utilities
    • report
    • timeit
    • sparse_random_matrix
    • sparse_delays_from_weights
    • magic_network
  • Convolution
    • Convolution
    • Pooling
    • Transpose
    • Copy
  • BOLD monitoring
    • BoldMonitor
    • BoldModel
    • balloon_RN
    • balloon_RL
    • balloon_CN
    • balloon_CL
    • balloon_maith2021
    • balloon_two_inputs
  • Tensorboard logging
    • Logger
  • ANN-to-SNN conversion
    • ANNtoSNNConverter
  • DEPRECATED Top-level API
    • setup
    • compile
    • clear
    • reset
    • set_seed
    • get_population
    • get_projection
    • populations
    • projections
    • monitors
    • simulate
    • simulate_until
    • step
    • enable_learning
    • disable_learning
    • get_time
    • set_time
    • get_current_step
    • set_current_step
    • dt
    • save
    • load
    • save_parameters
    • load_parameters
    • callbacks_enabled
    • disable_callbacks
    • enable_callbacks
    • clear_all_callbacks

On this page

  • ImagePopulation
    • Parameters
    • Methods
      • set_image

ImagePopulation

ImagePopulation(self, geometry, name=None, copied=False, net_id=0)

Rate-coded Population allowing to represent images (png, jpg…) as the firing rate of a population (each neuron represents one pixel).

This extension requires the Python Image Library (pip install Pillow).

The extensions has to be explicitly imported:

import ANNarchy as ann
from ANNarchy.extensions.image import ImagePopulation

net = ann.Network()
pop = net.create(ImagePopulation(geometry=(480, 640)))
pop.set_image('image.jpg')

About the geometry:

  • If the geometry is 2D, it corresponds to the (height, width) of the image. Only the luminance of the pixels will be represented (grayscale image).
  • If the geometry is 3D, the third dimension can be either 1 (grayscale) or 3 (color).

If the third dimension is 3, each will correspond to the RGB values of the pixels.

Warning: due to the indexing system of Numpy, a 640*480 image should be fed into a (480, 640) or (480, 640, 3) population.

Parameters

Name Type Description Default
geometry tuple population geometry as tuple. It must correspond to the image size and be fixed through the whole simulation. required
name str unique name of the population (optional). None

Methods

Name Description
set_image Sets an image (.png, .jpg or whatever is supported by PIL) into the firing rate of the population.

set_image

set_image(filename)

Sets an image (.png, .jpg or whatever is supported by PIL) into the firing rate of the population.

If the image has a different size from the population, it will be resized.

Parameters

Name Type Description Default
filename str name of the image file. required
DecodingProjection
VideoPopulation
 

Copyright Julien Vitay, Helge Ülo Dinkelbach, Fred Hamker