#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <random>
#include <filesystem>
#include <stdlib.h>
#include <unistd.h>
#include <Eigen/Core>
#include <curl/curl.h>
#include <zlib.h>
Go to the source code of this file.
|
| bool | file_exists (const std::string &filename) |
| | Check if file exists.
|
| |
| void | download_file (const std::string &url, const std::string &path) |
| | Download file from URL and save to local path.
|
| |
| bool | unzip_file (const std::string &gz_path, const std::string &out_path) |
| | Unzip gz file and save to local path.
|
| |
| Eigen::MatrixXd | read_mnist_images (const std::string &filename) |
| | Read a MNIST image file.
|
| |
| Eigen::MatrixXd | read_mnist_labels (const std::string &filename) |
| | Read a MNIST label file.
|
| |
| std::tuple< Eigen::MatrixXd, Eigen::MatrixXd, Eigen::MatrixXd, Eigen::MatrixXd > | fetch_mnist (const std::string &data_dir) |
| | Fetch MNIST dataset and save to local directory if it doesn't exist.
|
| |
|
| const std::string | BASE_URL = "http://yann.lecun.com/exdb/mnist/" |
| |
◆ download_file()
| void download_file |
( |
const std::string & |
url, |
|
|
const std::string & |
path |
|
) |
| |
Download file from URL and save to local path.
- Parameters
-
| url | URL of file to download |
| path | Local path to save downloaded file |
◆ fetch_mnist()
| std::tuple< Eigen::MatrixXd, Eigen::MatrixXd, Eigen::MatrixXd, Eigen::MatrixXd > fetch_mnist |
( |
const std::string & |
data_dir | ) |
|
Fetch MNIST dataset and save to local directory if it doesn't exist.
- Parameters
-
| data_dir | Local directory to save MNIST dataset in |
- Returns
- A tuple containing the training and test sets
◆ file_exists()
| bool file_exists |
( |
const std::string & |
filename | ) |
|
Check if file exists.
- Parameters
-
| filename | Name of file to check |
- Returns
- True if file exists, false otherwise
◆ read_mnist_images()
| Eigen::MatrixXd read_mnist_images |
( |
const std::string & |
filename | ) |
|
Read a MNIST image file.
- Parameters
-
| filename | Name of the file to read |
- Returns
- A matrix containing the images
◆ read_mnist_labels()
| Eigen::MatrixXd read_mnist_labels |
( |
const std::string & |
filename | ) |
|
Read a MNIST label file.
- Parameters
-
| filename | Name of the file to read |
- Returns
- A matrix containing the labels
◆ unzip_file()
| bool unzip_file |
( |
const std::string & |
gz_path, |
|
|
const std::string & |
out_path |
|
) |
| |
Unzip gz file and save to local path.
- Parameters
-
| gz_path | Local path of gz file to unzip |
| out_path | Local path to save unzipped file |
- Returns
- True if unzipping was successful, false otherwise
◆ BASE_URL
| const std::string BASE_URL = "http://yann.lecun.com/exdb/mnist/" |