andersbll/deeppy

Feature request for `predict`

jgbos opened this issue · 2 comments

This is just a feature request for a future updates to make single image prediction work easy for the user, not a bug.

Let input to NeuralNetwork.predict in

deeppy/deeppy/feed_forward/neural_network.py

be a single image (I'm testing with MNIST). Currently it requires a 4-dimensional array, I have to reshape a single image from the data set from a [1,28,28] to a [1,1,28,28] to execute.

I would prefer not to check array dimensionality in convnet layers for every call to fprop(). How about raising an error in _setup() if the array is not 4D?

As far as I can tell predict does not call _setup() though (only needed for testing, not training). I was only really thinking the feature would be needed in predict (unfortunately there isn't a np.atleast_4d function), but I think it is perfectly fine to raise an error to inform the user of the requirement. Took some debugging to figure out why it was failing, but I also just started playing with this today.