mlpack / models

models built with mlpack
https://models.mlpack.org/docs
BSD 3-Clause "New" or "Revised" License
35 stars 40 forks source link

input for add<Convolution> mlpack #40

Closed InterTriplete2010 closed 3 years ago

InterTriplete2010 commented 3 years ago

I have two quick questions about the add and I cannot find the answer in the documentation. Say that I pass a vector to add of length 4130, which I have obtained from "flattening" a matrix 14x295. Just to clarify, when I say that I pass a vector, I mean that I have a csv file (same structure as in https://github.com/mlpack/examples/blob/master/mnist_cnn/mnist_cnn.cpp) with ~20000 different images all labeled. Each row is obviously a vector that has been flattened => 20000x4130.

I want my input to be 14x295, so my add will be something like this:

model.Add<Convolution<>>(1, // Number of input activation maps. 14, // Number of output activation maps. 3, // Filter width. 3, // Filter height. 1, // Stride along width. 1, // Stride along height. 0, // Padding width. 0, // Padding height. 196, // Input width. 14 // Input height. );

Questions:

1) My first question is about the matrix of data that Armadillo creates when I open the csv file. Armadillo saves the data in a 4130x20000 matrix, which means a transpose form of the original structure. So, do I need to transpose my matrix to have a 14x196 input? Or has the convolution been built knowing that Armadillo transposes the data? I am asking this question, because I need to know if the width has to be 196 or 14.

2) Second question: how will add create my the 14x295 matrix? Assuming that my input will be a 20000x4130 matrix, my assumption is that the first 295 columns will be the elements of the first row, then the next 295 columns will be the elements of the second row, etc. until I have my 14x295 matrix. Is that correct?

Thank you!!! Alex.

rcurtin commented 3 years ago

This should be clarified by mlpack/mlpack#2753. :+1:

mlpack-bot[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1:

mlpack-bot[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1: