Image classification error

Good day all,

I am going back to a project I worked on a couple of years ago called classify Real Image With Pretrained Model, on mxnet-dot-readthedocs-dot-org, and discovered that it is now on mxnet-dot-incubator-dot-apache-dot-org.
The project worked the last time I tried it, but that was a different version of R and mxnet. (2016).
It’s url is now:,
and I’m trying to run it again with R v3.3.1 (64-bit), and RStudio v1.1.447.

When I run the line:

prob <- predict(model, X=normed)

I’m getting:

Error in symbol$infer.shape(list(…)) :
Error in operator ch_concat_3c_chconcat: [17:04:44] c:\jenkins\workspace\mxnet\mxnet\src\operator\nn\ Check failed: shape_assign(&(*in_shape)[i], dshape) Incompatible input shape: expected [1,0,14,14], got [1,320,13,13]

I copied the preproc.image function verbatim from the tutorial, but I still get the error.

My mxnet is mxnet_1.3.0.

Thanks for any help.

P.S. after I run the preproc.image on the parrots file, I try plotting the new image, and get the

Is this a usual normalized image ?

Hi @tjclifford,

Are you trying to predict using the parrot image (from the imager package) and still hitting this error? If not, make sure your image is an RGB image of at least 224x244 in resolution. And after being passes through preproc.image it should have shape (224, 224, 3, 1).

With regards to the plot of the image after being passes through preproc.image your choice of rendering looks wrong. Since it’s an image you’ll want to plot it as such, rather than a sequence of pixel values (as in your plot attached). Use imager to plot.