I'm trying to adapt the example in the readme markdown to accept a grayscale input image with a resolution of 512x448 in the range 0-1 and an output of 8 values between 0-1. My dimensions seem to be incompatible somewhere along the line, but I can't figure out exactly where.
const int WIDTH = 512;
const int HEIGHT = 448;
const int DEPTH = 100;
const int KEYPAD = 8;
Eigen::MatrixXd screen(WIDTH*HEIGHT,DEPTH);
Eigen::MatrixXd keypad(KEYPAD,DEPTH);
Eigen::MatrixXd pred;
// Construct a network object
MiniDNN::Network net;
// Create three layers
// Layer 1 -- convolutional, input size 512x448x1, 1 output channels, filter size 5x5
MiniDNN::Layer* layer1 = new MiniDNN::Convolutional<MiniDNN::ReLU>(WIDTH, HEIGHT, 1, 1, 5, 5);
// Layer 2 -- max pooling, input size 16x16x1, pooling window size 3x3
MiniDNN::Layer* layer2 = new MiniDNN::MaxPooling<MiniDNN::ReLU>(16, 16, 1, 3, 3);
// Layer 3 -- fully connected, input size 5x5x1, output size 8
MiniDNN::Layer* layer3 = new MiniDNN::FullyConnected<MiniDNN::Identity>(5 * 5 * 1, KEYPAD);
// Add layers to the network object
net.add_layer(layer1);
net.add_layer(layer2);
net.add_layer(layer3);
// Set output layer
net.set_output(new MiniDNN::RegressionMSE());
// Create optimizer object
MiniDNN::RMSProp opt;
opt.m_lrate = 0.001;
// (Optional) set callback function object
MiniDNN::VerboseCallback callback;
net.set_callback(callback);
net.init(0, 0.01, 123);
// Populate observations and responses here...
...
...
net.fit(opt, screen, keypad, 100, 10, 123);
The above code when executed yields to the following error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): Unit sizes do not match
Aborted (core dumped)
Any insight on what I am doing incorrectly @giovastabile or @yixuan?
I'm trying to adapt the example in the readme markdown to accept a grayscale input image with a resolution of 512x448 in the range 0-1 and an output of 8 values between 0-1. My dimensions seem to be incompatible somewhere along the line, but I can't figure out exactly where.
const int WIDTH = 512;const int HEIGHT = 448;const int DEPTH = 100;const int KEYPAD = 8;Eigen::MatrixXd screen(WIDTH*HEIGHT,DEPTH);Eigen::MatrixXd keypad(KEYPAD,DEPTH);Eigen::MatrixXd pred;// Construct a network objectMiniDNN::Network net;// Create three layers// Layer 1 -- convolutional, input size 512x448x1, 1 output channels, filter size 5x5MiniDNN::Layer* layer1 = new MiniDNN::Convolutional<MiniDNN::ReLU>(WIDTH, HEIGHT, 1, 1, 5, 5);// Layer 2 -- max pooling, input size 16x16x1, pooling window size 3x3MiniDNN::Layer* layer2 = new MiniDNN::MaxPooling<MiniDNN::ReLU>(16, 16, 1, 3, 3);// Layer 3 -- fully connected, input size 5x5x1, output size 8MiniDNN::Layer* layer3 = new MiniDNN::FullyConnected<MiniDNN::Identity>(5 * 5 * 1, KEYPAD);// Add layers to the network objectnet.add_layer(layer1);net.add_layer(layer2);net.add_layer(layer3);// Set output layernet.set_output(new MiniDNN::RegressionMSE());// Create optimizer objectMiniDNN::RMSProp opt;opt.m_lrate = 0.001;// (Optional) set callback function objectMiniDNN::VerboseCallback callback;net.set_callback(callback);net.init(0, 0.01, 123);// Populate observations and responses here.........net.fit(opt, screen, keypad, 100, 10, 123);The above code when executed yields to the following error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): Unit sizes do not match
Aborted (core dumped)
Any insight on what I am doing incorrectly @giovastabile or @yixuan?