Ejemplo n.º 1
0
def setupEOgmaNeo():
    global _system, _hierarchy, _inputImage, _inputValue

    print("Initializing EOgmaNeo::ComputeSystem")
    _system = eogmaneo.ComputeSystem(4)

    print("Initializing EOgmaNeo::Hierarchy")
    lds = eogmaneo.StdVecLayerDesc()
    numLayers = 6
    layerSize = 36
    for l in range(0, numLayers):
        ld = eogmaneo.LayerDesc()
        ld._width = layerSize
        ld._height = layerSize
        ld._forwardRadius = 9
        ld._backwardRadius = 9
        ld._ticksPerUpdate = 2
        ld._temporalHorizon = 2
        ld._alpha = 0.1
        ld._beta = 0.1
        ld._gamma = 0.01
        lds.push_back(ld)
        #layerSize = 16

    _hierarchy = eogmaneo.Hierarchy()
    _hierarchy.create([(hiddenWidth, hiddenHeight),
                       (steerChunkSize, steerChunkSize)],
                      [lineChunkSize, steerChunkSize], [False, True], lds, 41)

    _inputValue = eogmaneo.StdVeci(1 * 1)
Ejemplo n.º 2
0
camera = picamera.PiCamera()

camera.resolution = (camWidth, camHeight)
camera.framerate = 24

#camera.start_preview()

time.sleep(2)

######################

ser = serial.Serial(
    '/dev/serial/by-id/usb-Arduino_Srl_Arduino_Uno_556393038343514082D0-if00',
    115200)

esystem = eogmaneo.ComputeSystem(4)

ld = 6 * [eogmaneo.LayerDesc()]

for l in range(0, len(ld)):
    ld[l]._width = 36
    ld[l]._height = 36
    ld[l]._chunkSize = 6

    if l == 0:
        ld[l]._forwardRadius = 9
        ld[l]._backwardRadius = 9
    else:
        ld[l]._forwardRadius = 9
        ld[l]._backwardRadius = 9
Ejemplo n.º 3
0
HIDDEN_HEIGHT = 32
CHUNK_SIZE = 4
RADIUS = 9

print("Building the EOgmaNeo hierarchy and pre-encoder...\n")

# After training an ImageEncoder will output unique sparse chunked representations
# that can be input into an EOgmaNeo hierarchy. Consequently it can take predicted
# sparse chunked representations output from the hierarchy and reconstruct an
# image it has learned.
preEncoder = eogmaneo.ImageEncoder()
preEncoder.create(IMAGE_WIDTH, IMAGE_HEIGHT, HIDDEN_WIDTH, HIDDEN_HEIGHT,
                  CHUNK_SIZE, int(16), 123)

# Make sure EOgmaNeo uses all CPU cores available
cs = eogmaneo.ComputeSystem(multiprocessing.cpu_count())

# Construct parameter descriptions for all hierarchy encoder-decoder layers
lds = []

for i in range(NUM_LAYERS):
    ld = eogmaneo.LayerDesc()

    ld._width = HIDDEN_WIDTH
    ld._height = HIDDEN_HEIGHT
    ld._chunkSize = CHUNK_SIZE
    ld._radius = RADIUS
    ld._ticksPerUpdate = 2
    ld._temporalHorizon = 2

    ld._alpha = 0.1
Ejemplo n.º 4
0
# ----------------------------------------------------------------------------
#  EOgmaNeo
#  Copyright(c) 2017-2018 Ogma Intelligent Systems Corp. All rights reserved.
#
#  This copy of EOgmaNeo is licensed to you under the terms described
#  in the EOGMANEO_LICENSE.md file included in this distribution.
# ----------------------------------------------------------------------------

# -*- coding: utf-8 -*-

import numpy as np
import eogmaneo
import matplotlib.pyplot as plt

cs = eogmaneo.ComputeSystem(8)

columnSize = 64

bounds = (-1.0, 1.0)  # Range of value

lds = []

for i in range(9):
    ld = eogmaneo.LayerDesc()

    ld._width = 5
    ld._height = 5
    ld._columnSize = 32
    ld._forwardRadius = ld._backwardRadius = 2
    ld._lateralRadius = 2
    ld._ticksPerUpdate = 2