private List<Item> SampleTestingInstance() { var result = new List<Item>(); var n = this.random.Next(this.testing.Count); var entry = this.testing[n]; // Create volume from image data var x = new Volume(28, 28, 1, 0.0); for (var i = 0; i < 28; i++) { for (var j = 0; j < 28; j++) { x.Weights[j + i * 28] = entry.Image[j + i * 28] / 255.0; } } for (var i = 0; i < 4; i++) { result.Add(new Item { Volume = x.Augment(24), Label = entry.Label }); } return result; }
private Item SampleTrainingInstance() { var n = this.random.Next(this.trainingCount); var entry = this.training[n]; // load more batches over time if (this.stepCount % 5000 == 0 && this.stepCount > 0) { this.trainingCount = Math.Min(this.trainingCount + BatchSize, this.training.Count); } // Create volume from image data var x = new Volume(28, 28, 1, 0.0); for (var i = 0; i < 28; i++) { for (var j = 0; j < 28; j++) { x.Weights[j + i * 28] = entry.Image[j + i * 28] / 255.0; } } x = x.Augment(24); return new Item { Volume = x, Label = entry.Label, IsValidation = n % 10 == 0 }; }