Image Encoder¶
-
class
pyogmaneo.ImageEncoder¶
The ImageEncoder is a pre-encoder used to convert images to CSDRs.
-
(float32) ImageEncoder._alpha Learning rate
-
(float32) ImageEncoder._gamma SOM falloff
-
ImageEncoder.__init__(self, cs, prog, hiddenSize, visibleLayerDescs)¶ Initialize an image encoder of given structure.
Parameters: - cs – (ComputeSystem) compute system to use
- prog – (ComputeProgram) compute program containing the necessary kernels (e.g. from neoKernels.cl)
- hiddenSize – (Int3) size of the output (hidden) layer
- visibleLayerDescs – ([ImVisibleLayerDesc]) list of ImVisibleLayerDesc describing each input (visible) layer
-
ImageEncoder.__init__(self, cs, prog, name) Initialize an image encoder given a save file.
Parameters: - cs – (ComputeSystem) compute system to use
- prog – (ComputeProgram) compute program containing the necessary kernels (e.g. from neoKernels.cl)
- name – (string) save file name
-
ImageEncoder.step(self, cs, visibleActivations, learnEnabled=True)¶ Perform a simulation step of the hierarchy. This will produce new predictions or actions if those are being used.
Parameters: - cs – (ComputeSystem) compute system to use
- visibleActivations – ([FloatBuffer]) list of input float buffers representing the image of the dimensions described in the initialization
- learnEnabled – (boolean) whether or not to enable learning (if False, will only perform inference). Defaults to True
-
ImageEncoder.save(self, cs, name)¶ Save the image encoder to a file.
Parameters: - cs – (ComputeSystem) compute system to use
- name – (string) save file name
-
ImageEncoder.getNumVisibleLayers(self)¶ Return the number of visible (input) layers the image encoder has. Will be equal to len(visibleLayerDescs) provided during initialization
Return type: (int32) number of layers
-
ImageEncoder.getVisibleLayerDesc(self, index)¶ Retrieve the ImVisibleLayerDesc used to initialize the image encoder at a certain index
Parameters: index – (int32) index of the input (visible) layer Return type: (ImVisibleLayerDesc) the descriptor