Edinburgh Research Explorer

ImaGen: Generic library for 0D, 1D and 2D pattern distributions

Research output: Contribution to conferencePoster

Original languageEnglish
Publication statusPublished - 2012
EventSciPy2012: Scientific Computing with Python - Texas, Austin, United States
Duration: 16 Jul 201221 Jul 2012

Conference

ConferenceSciPy2012: Scientific Computing with Python
CountryUnited States
CityAustin
Period16/07/1221/07/12

Abstract

Simulations and other scientific applications require streams of numeric scalar or array values to determine initial conditions or external inputs. In the Topographica brain simulation software project, the ImaGen library was developed as a general means of supplying such data so that subsequent code can ignore the details of how the data was generated. Unless constrained by external data such as bitmap images, the patterns are all resolution-independent, and can be rendered at any desired size and level of detail. A typical use in Topographica is to generate visual input patterns for a computational model of the visual system. In this case, the patterns can either be read from image databases or movies, or generated algorithmically using a library of artificial stimuli that can be positioned, scaled, rotated, and combined arbitrarily and flexibly over time. The same library is used for specifying auditory input patterns, neural-network weight patterns, and in general any 2D, 1D, or 0D (scalar) numerical pattern series. In each case, other code simply calls the pattern-generating object whenever it needs a new pattern, allowing any existing or user-defined pattern to be used for a given purpose. ImaGen thus provides generality and flexibility without adding complexity at the point of use. Using the Param library (see separate presentation at SciPy 2012), every aspect of the patterns can be controlled flexibly to provide a customizable stream of inputs on demand. For instance, an ImaGen pattern.Line object could specify some of its Parameters as numbers, with others drawn from specified distributions, to provide a never-ending stream of patterns that vary according to the given distributions: from imagen import pattern,numbergen import pylab a=pattern.Line(xdensity=60,ydensity=60,size=0.3,orientation=0.2, x=numbergen.NormalRandom(mu=0.5,sigma=0.2), y=numbergen.UniformRandom(lbound=-0.5,ubound=0.5,seed=34)) pylab.imshow(a()) pylab.imshow(a()) Patterns can be combined easily to construct any arbitrarily complex series of patterns dynamically: b=pattern.Composite(generators=[a,pattern.random.UniformRandom()], operator=numpy.multiply) These capabilities make ImaGen very useful for any visual system modeling project, but also for other neural network and machine-learning systems, and in general for any scientific application needing dynamic and arbitrarily complex yet controllable streams of 0D, 1D, or 2D input patterns. The core rendering functionality of ImaGen is similar to evaluating a NumPy function using numpy.meshgrid, but with a consistent object-based interface using a library of patterns. Some of the image-rendering functionality is similar to that of the GD and Agg libraries, but the focus of ImaGen is on generating NumPy arrays directly rather than RGB color images (though color images are also supported as three 2D NumPy arrays). ImaGen is also a pure Python module with few external dependencies (just NumPy and Param), rather than a wrapper for C code, and is thus more easily integrated into other packages. ImaGen is freely available under a BSD license from: http://ioam.github.com/imagen/

Event

SciPy2012: Scientific Computing with Python

16/07/1221/07/12

Austin, United States

Event: Conference

ID: 18088072