ImageMLDataSet extends BasicMLDataSet { public final void downsample(final int theHeight, final int theWidth) { this.height = theHeight; this.width = theWidth; for (final MLDataPair pair : this) { if (!(pair.getInput() instanceof ImageMLData)) { throw new NeuralNetworkError( "Invalid class type found in ImageNeuralDataSet, only " + "ImageNeuralData items are allowed."); } final ImageMLData input = (ImageMLData) pair.getInput(); input.downsample(this.downsampler, this.findBounds, height, width, this.hi, this.lo); } } ImageMLDataSet(final Downsample theDownsampler,
			final boolean theFindBounds, 
			final double theHi, final double theLo); final void downsample(final int theHeight, final int theWidth); final int getHeight(); final int getWidth(); static final String MUST_USE_IMAGE; }
@Test public void testSerialize() throws Exception { FileUtil.copyResource("org/encog/data/img/a.png", IMG_A); FileUtil.copyResource("org/encog/data/img/b.png", IMG_B); FileUtil.copyResource("org/encog/data/img/c.png", IMG_C); Downsample downsampler = new SimpleIntensityDownsample(); ImageMLDataSet training = new ImageMLDataSet(downsampler, false, 1, -1); ImageMLData inputImage1 = new ImageMLData(ImageIO.read(IMG_A)); ImageMLData inputImage2 = new ImageMLData(ImageIO.read(IMG_B)); ImageMLData inputImage3 = new ImageMLData(ImageIO.read(IMG_C)); BasicMLData idealImage1 = new BasicMLData(new double[]{1.0,0.0,0.0}); BasicMLData idealImage2 = new BasicMLData(new double[]{0.0,1.0,0.0}); BasicMLData idealImage3 = new BasicMLData(new double[]{0.0,0.0,1.0}); training.add(inputImage1,idealImage1); training.add(inputImage2,idealImage2); training.add(inputImage3,idealImage3); training.downsample(10, 10); EncogUtility.saveCSV(FILE_CSV, CSVFormat.DECIMAL_POINT, training ); }