Exemple #1
0
"""

trainingDataset = "DataSets/OCR/characters/cmr_hex.xml"
maxTrainingCycles = 20
testingDataset = "DataSets/OCR/characters/cmr_hex.xml"

import dataset_readers as data
import image_encoders as encoder
from nupic.research.spatial_pooler import SpatialPooler
from vision_testbench import VisionTestBench
from classifiers import exactMatch

if __name__ == "__main__":
    # Get training images and convert them to vectors.
    trainingImages, trainingTags = data.getImagesAndTags(trainingDataset)
    trainingVectors = encoder.imagesToVectors(trainingImages)

    # Instantiate the python spatial pooler
    sp = SpatialPooler(
        inputDimensions=32**2,  # Size of image patch
        columnDimensions=16,  # Number of potential features
        potentialRadius=10000,  # Ensures 100% potential pool
        potentialPct=1,  # Neurons can connect to 100% of input
        globalInhibition=True,
        localAreaDensity=-1,  # Using numActiveColumnsPerInhArea
        #localAreaDensity = 0.02, # one percent of columns active at a time
        #numActiveColumnsPerInhArea = -1, # Using percentage instead
        numActiveColumnsPerInhArea=1,  # Only one feature active at a time
        # All input activity can contribute to feature output
        stimulusThreshold=0,
        synPermInactiveDec=0.3,
Exemple #2
0
trainingDataset = "DataSets/OCR/characters/cmr_hex.xml"
maxTrainingCycles = 20
testingDataset = "DataSets/OCR/characters/cmr_hex.xml"

import dataset_readers as data
import image_encoders as encoder
from nupic.research.spatial_pooler import SpatialPooler
from vision_testbench import VisionTestBench
from classifiers import exactMatch



if __name__ == "__main__":
  # Get training images and convert them to vectors.
  trainingImages, trainingTags = data.getImagesAndTags(trainingDataset)
  trainingVectors = encoder.imagesToVectors(trainingImages)

  # Instantiate the python spatial pooler
  sp = SpatialPooler(
    inputDimensions = 32**2, # Size of image patch
    columnDimensions = 16, # Number of potential features
    potentialRadius = 10000, # Ensures 100% potential pool
    potentialPct = 1, # Neurons can connect to 100% of input
    globalInhibition = True,
    localAreaDensity = -1, # Using numActiveColumnsPerInhArea
    #localAreaDensity = 0.02, # one percent of columns active at a time
    #numActiveColumnsPerInhArea = -1, # Using percentage instead
    numActiveColumnsPerInhArea = 1, # Only one feature active at a time
    # All input activity can contribute to feature output
    stimulusThreshold = 0,
    synPermInactiveDec = 0.3,