static void Main(string[] args) { string CifarDataBatch = args[0]; /* Initialize parameters */ Options.InitializeNNAnalysis(); // Plain old CIFAR binary format ImageDataset data = CIFAR.ReadData(CifarDataBatch, CIFAR.ALL_IMAGES, 0); Trace.Assert(!data.Dataset.HasUninitialized()); for (SplitSize = 100; SplitSize < 10000; SplitSize += 115) { Console.WriteLine("Splitting, SplitSize = {0}", SplitSize); // Split var splits = data.ShuffleSplitMany(SplitSize); Console.WriteLine("Shuffle-split to {0} splits", splits.Count()); foreach (var s in splits) { Trace.Assert(!s.Dataset.HasUninitialized()); } Console.WriteLine("Joining back"); // Union data = Data.UnionMany(splits); Trace.Assert(!data.Dataset.HasUninitialized()); } }
static void Main(string[] args) { string MNISTData = null; string MNISTLabels = null; int split_size = 0; var p = new OptionSet(); p.Add("datafile=", "MNIST data file name", x => MNISTData = x); p.Add("labelfile=", "MNIST label file name", x => MNISTLabels = x); p.Add <int>("split-size=", "Number of images per split", (x => split_size = x)); Cmd.RunOptionSet(p, args); if (MNISTData == null || MNISTData == null || split_size <= 0) { Console.WriteLine("Invalid arguments, use --help"); Environment.Exit(1); } /* Initialize parameters */ Options.InitializeNNAnalysis(); ImageDataset data = MNIST.ReadData(MNISTLabels, MNISTData, MNIST.ALL_IMAGES, 0); // Split var splits = data.ShuffleSplitMany(split_size); int count = 0; foreach (var s in splits) { MNIST.WriteData(MNISTLabels + ".split_" + count.ToString(), MNISTData + ".split_" + count.ToString(), s); count++; } }
static void Main(string[] args) { string CifarDataBatch = null; int split_size = 0; var p = new OptionSet(); p.Add <string>("dataset=", "CIFAR dataset file name", (x => CifarDataBatch = x)); p.Add <int>("split-size=", "Number of images per split", (x => split_size = x)); Cmd.RunOptionSet(p, args); if (CifarDataBatch == null || split_size <= 0) { Console.WriteLine("Invalid arguments, use --help"); Environment.Exit(1); } /* Initialize parameters */ Options.InitializeNNAnalysis(); // Plain old CIFAR binary format ImageDataset data = CIFAR.ReadData(CifarDataBatch, CIFAR.ALL_IMAGES, 0); // Split var splits = data.ShuffleSplitMany(split_size); int count = 0; foreach (var s in splits) { CIFAR.WriteData(CifarDataBatch + ".split_" + count.ToString(), s); count++; } }