pytorch-cpp icon indicating copy to clipboard operation
pytorch-cpp copied to clipboard

Error in loading MNIST dataset, convolutional_neural_network

Open Paras-97 opened this issue 3 years ago • 2 comments

Hi, I am unable to read the images in the MNIST dataset. below I have listed the error that I am receiving. Can you please help me with it. Thanks

: ~/Projects/cnn/build$ ./cnn

Convolutional Neural Network

CUDA available. Training on GPU. terminate called after throwing an instance of 'c10::Error' what(): Error opening images file at ../../../../data/mnist/train-images-idx3-ubyte Exception raised from read_images at ../torch/csrc/api/src/data/datasets/mnist.cpp:67 (most recent call first): frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) + 0x6b (0x7f9f8f93e0db in /home/paras/Libraries/libtorch/lib/libc10.so) frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0xce (0x7f9f8f939d2e in /home/paras/Libraries/libtorch/lib/libc10.so) frame #2: + 0x43847a2 (0x7f9f0b77e7a2 in /home/paras/Libraries/libtorch/lib/libtorch_cpu.so) frame #3: torch::data::datasets::MNIST::MNIST(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, torch::data::datasets::MNIST::Mode) + 0x46 (0x7f9f0b77f846 in /home/paras/Libraries/libtorch/lib/libtorch_cpu.so) frame #4: main + 0x121 (0x55670d49790c in ./cnn) frame #5: __libc_start_main + 0xf3 (0x7f9ec30140b3 in /lib/x86_64-linux-gnu/libc.so.6) frame #6: _start + 0x2e (0x55670d49752e in ./cnn)

Aborted (core dumped)

Paras-97 avatar Dec 20 '21 10:12 Paras-97

@Paras-97 did you run cmake -B build -D DOWNLOAD_DATASETS=ON - this will download the dataset right now the line:

what(): Error opening images file at ../../../../data/mnist/train-images-idx3-ubyte

indicates that dataset isn't available, so while reading this is throwing an error

Also, please go through this section in detail

prabhuomkar avatar Dec 20 '21 18:12 prabhuomkar

@Paras-97 can you confirm?

prabhuomkar avatar Dec 21 '21 20:12 prabhuomkar

Closing this issue as no further comment

prabhuomkar avatar Oct 04 '22 12:10 prabhuomkar