diff --git a/OpenIMDS_TEST/.vs/OpenIMDS_TEST/v14/.suo b/OpenIMDS_TEST/.vs/OpenIMDS_TEST/v14/.suo index 0c568de..2176c6c 100644 Binary files a/OpenIMDS_TEST/.vs/OpenIMDS_TEST/v14/.suo and b/OpenIMDS_TEST/.vs/OpenIMDS_TEST/v14/.suo differ diff --git a/OpenIMDS_TEST/test.cpp b/OpenIMDS_TEST/test.cpp index da83855..64470e2 100644 --- a/OpenIMDS_TEST/test.cpp +++ b/OpenIMDS_TEST/test.cpp @@ -1,15 +1,29 @@ #include"../classification/mnist.h" +#include"../classification/cifar10.h" #include - -int main(){ - IMDSImage train=GetMnistTrainData(); - +void CifarTest() { + IMDSImage train = GetCifar10TrainData(); IMDSImage mini_batch = GetRandomMiniBatch(train, 64); - - for(int i=0;i + The MNIST database of handwritten digits, available from this page, has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. @@ -40,10 +40,23 @@ IMDSImage GetMnistValidData(int padding=0,float alpha=1.0F,bool bias=true);` IMDSImage train= GetMnistTrainData(0, 1 / 255.0F,true); IMDSImage valid= GetMnistValidData(0, 1 / 255.0F,true); ``` +### Fashion(mnist.h) -#### Cifar-10 + - +**[Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist)** is a dataset of Zalando's article images—consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. We intend Fashion-MNIST to serve as a direct drop-in replacement for the original MNIST dataset for benchmarking machine learning algorithms. It shares the same image size and structure of training and testing splits. + +```c +IMDSImage GetFashionTrainData(int padding=0,float alpha=1.0F,bool bias=true) +``` + +```c +IMDSImage GetFashionValidData(int padding=0,float alpha=1.0F,bool bias=true) +``` + +### Cifar-10(cifar10.h) + + The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. diff --git a/classification/cifar10.h b/classification/cifar10.h index 1702c0f..e37bd04 100644 --- a/classification/cifar10.h +++ b/classification/cifar10.h @@ -91,7 +91,7 @@ static inline IMDSImage __ReadCIFAR10(char* image_file, int padding, float alpha imgs.n = 10000; imgs.label = (int*)calloc(imgs.n, sizeof(int)); imgs.image = (float**)calloc(imgs.n, sizeof(float*)); - char row[3073]; + unsigned char row[3073]; for (int i = 0; i < 10000; i++) { fread(row, 1, 3073, fp); imgs.label[i] = (int)row[0]; @@ -156,11 +156,11 @@ static inline IMDSImage GetCifar10TrainData(int padding _IMDSCPPDV(0), float alp char name_img[MAX_PATH + 1] = { 0 }; IMDSImage train; char* url[5] = { - "https://www.dropbox.com/s/1u0hpkbbddn3hc1/openimds_cifar10_train_1.bin?dl=1" - ,"https://www.dropbox.com/s/mxk1zozw42cqk2a/openimds_cifar10_train_2.bin?dl=1" - ,"https://www.dropbox.com/s/cxg81q891j78wa9/openimds_cifar10_train_3.bin?dl=1" - ,"https://www.dropbox.com/s/tcnds6l7rba5tn7/openimds_cifar10_train_4.bin?dl=1" - ,"https://www.dropbox.com/s/u9500s411uocjgg/openimds_cifar10_train_5.bin?dl=1" + "https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_train_1.bin" + ,"https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_train_2.bin" + ,"https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_train_3.bin" + ,"https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_train_4.bin" + ,"https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_train_5.bin" }; train.c = 3; train.w = 32 + padding * 2; @@ -184,7 +184,7 @@ static inline IMDSImage GetCifar10TrainData(int padding _IMDSCPPDV(0), float alp static inline IMDSImage GetCifar10ValidData(int padding _IMDSCPPDV(0), float alpha _IMDSCPPDV(1.0F), bool bias _IMDSCPPDV(true)) { char tmp_path[MAX_PATH + 1] = { 0 }; char* name_img = "openimds_cifar10_test.bin"; - char* url = "https://www.dropbox.com/s/uifxmb6hi0rmvr3/openimds_cifar10_test.bin?dl=1"; + char* url = "https://github.com/springkim/OpenIMDS/releases/download/Cifar10/openimds_cifar10_test.bin"; __DownloadCifar10(tmp_path, url,name_img,30730000); char path_img[MAX_PATH + 1] = { 0 }; strcat(strcpy(path_img, tmp_path), name_img); diff --git a/classification/mnist.h b/classification/mnist.h index 0b5245e..af92958 100644 --- a/classification/mnist.h +++ b/classification/mnist.h @@ -217,8 +217,8 @@ static inline IMDSImage GetMnistTrainData(int padding _IMDSCPPDV(0), float alpha char tmp_path[MAX_PATH + 1] = { 0 }; char* name_img = "openimds_mnist_train_image.bin"; char* name_lbl = "openimds_mnist_train_label.bin"; - __DownloadMNIST(tmp_path, "https://www.dropbox.com/s/f56cag59pk58lel/openimds_mnist_train_image.bin?dl=1" - , "https://www.dropbox.com/s/r1rgfhshebdhnms/openimds_mnist_train_label.bin?dl=1" + __DownloadMNIST(tmp_path, "https://github.com/springkim/OpenIMDS/releases/download/MNIST/openimds_mnist_train_image.bin" + , "https://github.com/springkim/OpenIMDS/releases/download/MNIST/openimds_mnist_train_label.bin" , name_img, name_lbl, 47040016,60008); char path_img[MAX_PATH + 1] = { 0 }; char path_lbl[MAX_PATH + 1] = { 0 }; @@ -230,8 +230,8 @@ static inline IMDSImage GetMnistValidData(int padding _IMDSCPPDV(0), float alpha char tmp_path[MAX_PATH + 1] = { 0 }; char* name_img = "openimds_mnist_valid_image.bin"; char* name_lbl = "openimds_mnist_valid_label.bin"; - __DownloadMNIST(tmp_path, "https://www.dropbox.com/s/zsf4wicmmru34s9/openimds_mnist_valid_image.bin?dl=1" - , "https://www.dropbox.com/s/wsj7xetwmwuhxj8/openimds_mnist_valid_label.bin?dl=1" + __DownloadMNIST(tmp_path, "https://github.com/springkim/OpenIMDS/releases/download/MNIST/openimds_mnist_valid_image.bin" + , "https://github.com/springkim/OpenIMDS/releases/download/MNIST/openimds_mnist_valid_label.bin" , name_img, name_lbl,7840016,10008); char path_img[MAX_PATH + 1] = { 0 }; char path_lbl[MAX_PATH + 1] = { 0 }; @@ -239,4 +239,30 @@ static inline IMDSImage GetMnistValidData(int padding _IMDSCPPDV(0), float alpha strcat(strcpy(path_lbl, tmp_path), name_lbl); return __ReadMNIST(path_img, path_lbl, padding, alpha,bias); } +static inline IMDSImage GetFashionTrainData(int padding _IMDSCPPDV(0), float alpha _IMDSCPPDV(1.0F), bool bias _IMDSCPPDV(true)) { + char tmp_path[MAX_PATH + 1] = { 0 }; + char* name_img = "openimds_fashion_train_image.bin"; + char* name_lbl = "openimds_fashion_train_label.bin"; + __DownloadMNIST(tmp_path, "https://github.com/springkim/OpenIMDS/releases/download/fashion/train-images-idx3-ubyte" + , "https://github.com/springkim/OpenIMDS/releases/download/fashion/train-labels-idx1-ubyte" + , name_img, name_lbl, 47040016, 60008); + char path_img[MAX_PATH + 1] = { 0 }; + char path_lbl[MAX_PATH + 1] = { 0 }; + strcat(strcpy(path_img, tmp_path), name_img); + strcat(strcpy(path_lbl, tmp_path), name_lbl); + return __ReadMNIST(path_img, path_lbl, padding, alpha, bias); +} +static inline IMDSImage GetFashionValidData(int padding _IMDSCPPDV(0), float alpha _IMDSCPPDV(1.0F), bool bias _IMDSCPPDV(true)) { + char tmp_path[MAX_PATH + 1] = { 0 }; + char* name_img = "openimds_fashion_valid_image.bin"; + char* name_lbl = "openimds_fashion_valid_label.bin"; + __DownloadMNIST(tmp_path, "https://github.com/springkim/OpenIMDS/releases/download/fashion/t10k-images-idx3-ubyte" + , "https://github.com/springkim/OpenIMDS/releases/download/fashion/t10k-labels-idx1-ubyte" + , name_img, name_lbl, 7840016, 10008); + char path_img[MAX_PATH + 1] = { 0 }; + char path_lbl[MAX_PATH + 1] = { 0 }; + strcat(strcpy(path_img, tmp_path), name_img); + strcat(strcpy(path_lbl, tmp_path), name_lbl); + return __ReadMNIST(path_img, path_lbl, padding, alpha, bias); +} #endif //MNIST_7E2_1_1C_MNIST_HPP_INCLUDED