Package model

Examples of model.Retina


        ResetModelParameters.reset(PERMANENCE_INCREASE, PERMANENCE_DECREASE,
                MINIMAL_CONNECTED_PERMANENCE, INITIAL_PERMANENCE,
                PERCENT_ACTIVE_SYNAPSES_THRESHOLD,
                EXPONENTIAL_MOVING_AVERAGE_AlPHA, MINIMUM_COLUMN_FIRING_RATE);

        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 4,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);
        TemporalPooler temporalPooler = new TemporalPooler(spatialPooler,
                (int) newSynapseCount);
        temporalPooler.setLearningState(true);

        retina.seeBMPImage("2.bmp");

        int totalNumberOfSequenceSegments = 0;
        int totalNumberOfLearningNeurons = 0;
        for (int i = 0; i < (int) numberOfIterations; i++) {
            spatialPooler.performPooling();
View Full Code Here


     */
    public static double printToFileSDRScoreFor1RetinaTo1RegionModelFor1Digit(
            double percentMinimumOverlapScore, double desiredLocalActivity,
            double desiredPercentageOfActiveColumns,
            String locationOfFileWithFileNameToSaveScore) throws IOException {
        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 1,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        retina.seeBMPImage("2.bmp");

        spatialPooler.performPooling(); // 11 active columns
        Set<ColumnPosition> columnActivityAfterSeeingImage2 = spatialPooler
                .getActiveColumnPositions();
        // = (6,5)(6, 3)(6, 2)(5, 3)(3, 5)(2, 2)(1, 3)(1, 2)(2, 5)(1, 5)(4, 4)
View Full Code Here

        MnistManager mnistManager = new MnistManager(
                "./images/digits/MNIST/t10k-images.idx3-ubyte",
                "./images/digits/MNIST/t10k-labels.idx1-ubyte");

        // all images in MNIST dataset are 28 x 28 pixels
        Retina retina = new Retina(28, 28);
        Region region = new Region("Region", 8, 8, 1,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        int numberOfImagesToSee = 1000;
        double totalSDRScore = 0.0;
        for (int i = 1; i < (numberOfImagesToSee + 1); i++) {
            mnistManager.setCurrent(i);
            int[][] image = mnistManager.readImage();

            retina.see2DIntArray(image);
            spatialPooler.performPooling();
            Set<ColumnPosition> columnActivityAfterSeeingCurrentMNISTImage = spatialPooler
                    .getActiveColumnPositions();

            // compute SDR score
View Full Code Here

        filledSet.add(cp2);
        filledSet.add(cp3);
        filledSet.add(cp4);

        // images this oldRetina will see are all 66x66 pixels
        this.retina = new Retina(66, 66);

        this.region = new Region("Region", 8, 8, 3, 77.8, 1);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(this.retina.getVisionCells(), this.region, 0, 0);
View Full Code Here

                this.desiredPercentageOfActiveColumns,
                totalNumberOfColumnsInRegion);
    }

    private void setUpColumnActivityAfterSeeingImage2() throws IOException {
        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 1, 50, 3);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        retina.seeBMPImage("2.bmp");

        spatialPooler.performPooling(); // 11 active columns
        this.columnActivityAfterSeeingImage2 = spatialPooler
                .getActiveColumnPositions();
        // = (6,5)(6, 3)(6, 2)(5, 3)(3, 5)(2, 2)(1, 3)(1, 2)(2, 5)(1, 5)(4, 4)
View Full Code Here

        Region L = new Region("L", 250, 250, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        neocortex.changeCurrentRegionTo("H");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), L, 0, 0);

        // NOTE: I, J, K, & L are connected to different parts of the same Retina
        Retina retina = new Retina(1000, 1000);

        AbstractSensorCellsToRegionConnect opticNerve = new SensorCellsToRegionRectangleConnect();
        opticNerve.connect(retina.getVisionCells(new Rectangle(new Point(0, 0), new Point(500, 500))), I, 0, 0); // .getVisionCells(topLeftPoint, bottomRightPoint)
        opticNerve.connect(retina.getVisionCells(new Rectangle(new Point(0, 500), new Point(500, 1000))), J, 0, 0);
        opticNerve.connect(retina.getVisionCells(new Rectangle(new Point(500, 0), new Point(1000, 500))), K, 0, 0);
        opticNerve.connect(retina.getVisionCells(new Rectangle(new Point(500, 500), new Point(1000, 1000))), L, 0, 0);

        NervousSystem nervousSystem = new NervousSystem(neocortex, null, retina); // no LGN with circle surround input for now

        return nervousSystem;
    }
View Full Code Here

    private Region region;
    private SpatialPooler spatialPooler;

    public void setUp() {
        // images this oldRetina will see are all 66x66 pixels
        this.retina = new Retina(66, 66);

        this.region = new Region("Region name", 8, 8, 1, 77.8, 1);
        this.region.setInhibitionRadius(3);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
View Full Code Here

        Neocortex unconnectedNeocortex = new Neocortex(new Region("V1", 4, 4,
                4, 50, 3), new RegionToRegionRectangleConnect());

        LGN unconnectedLGN = new LGN(new Region("LGN", 8, 8, 1, 50, 3));

        Retina unconnectedRetina = new Retina(66, 66);

        NervousSystem nervousSystem = new NervousSystem(unconnectedNeocortex,
                unconnectedLGN, unconnectedRetina);

        // connect OldRetina to LGN
        Retina retina = nervousSystem.getPNS().getSNS().getRetina();
        LGN LGN = nervousSystem.getCNS().getBrain().getThalamus().getLGN();
        AbstractSensorCellsToRegionConnect opticNerve = new SensorCellsToRegionRectangleConnect();
        opticNerve.connect(retina.getVisionCells(), LGN.getRegion(), 0, 0);

        // connect LGN to very small part of V1 Region of Neocortex
        Neocortex neocortex = nervousSystem.getCNS().getBrain().getCerebrum()
                .getCerebralCortex().getNeocortex();
        AbstractRegionToRegionConnect regionToRegionConnect = new RegionToRegionRectangleConnect();
View Full Code Here

        return nervousSystem;
    }

    public void testHowToRunSpatialPoolingOnNervousSystem() throws IOException {
        Retina retina = partialNervousSystem.getPNS().getSNS().getRetina();
        Region LGNRegion = partialNervousSystem.getCNS().getBrain()
                .getThalamus().getLGN().getRegion();

        retina.seeBMPImage("2.bmp");

        SpatialPooler spatialPooler = new SpatialPooler(LGNRegion);
        spatialPooler.setLearningState(true);
        spatialPooler.performPooling();
        Set<ColumnPosition> LGNNeuronActivity = spatialPooler
View Full Code Here

    public void setUp() {
    }

    public void test_getActiveColumnPositionsAsString() throws IOException {
        Retina retina = new Retina(66, 66);

        Region region = new Region("region", 8, 8, 4, 50, 1);

        AbstractSensorCellsToRegionConnect connectType2 = new SensorCellsToRegionRectangleConnect();
        connectType2.connect(retina.getVisionCells(), region, 2, 2);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        // declare sets to test on
        Set<ColumnPosition> emptySet = new HashSet<ColumnPosition>();
        Set<ColumnPosition> filledSet = new HashSet<ColumnPosition>();

        // create columns that should be in the filledSet
        ColumnPosition cp1 = new ColumnPosition(6, 5);
        ColumnPosition cp2 = new ColumnPosition(6, 2);
        ColumnPosition cp3 = new ColumnPosition(1, 2);
        ColumnPosition cp4 = new ColumnPosition(2, 5);
        ColumnPosition cp5 = new ColumnPosition(4, 4);

        // add the column positions to the filledSet
        filledSet.add(cp1);
        filledSet.add(cp2);
        filledSet.add(cp3);
        filledSet.add(cp4);
        filledSet.add(cp5);

        assertEquals(emptySet, spatialPooler.getActiveColumnPositions());

        // view the image, which will activate Columns in the spatialPooler
        retina.seeBMPImage("2.bmp");
        spatialPooler.performPooling();

        // filledSet contains ((6, 5), (6, 2), (1, 2), (2, 5), (4, 4))
        assertEquals(filledSet, spatialPooler.getActiveColumnPositions());
    }
View Full Code Here

TOP

Related Classes of model.Retina

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.