Esempio n. 1
0
        private static void extract_cifar()
        {
            string[] labels = { "airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck" };
            int      i;

            Data.Data train = Data.Data.load_all_cifar10();
            Data.Data test  = Data.Data.load_cifar10_data("Data.Data/cifar/cifar-10-batches-bin/test_batch.bin");
            for (i = 0; i < train.X.Rows; ++i)
            {
                Image  im     = new Image(32, 32, 3, train.X.Vals[i]);
                int    sclass = Utils.max_index(train.Y.Vals[i], 10);
                string buff   = $"Data.Data/cifar/train/{i}_{labels[sclass]}";
                LoadArgs.save_image_png(im, buff);
            }
            for (i = 0; i < test.X.Rows; ++i)
            {
                Image  im     = new Image(32, 32, 3, test.X.Vals[i]);
                int    sclass = Utils.max_index(test.Y.Vals[i], 10);
                string buff   = $"Data.Data/cifar/test/{i}_{labels[sclass]}";
                LoadArgs.save_image_png(im, buff);
            }
        }