I have a working python code in keras with tensorflow backend. I am utilizing transfer learning from VGG16. All is good.
I want to use mxnet backend but had some issues:
from keras.preprocessing.image import ImageDataGenerator
from keras import applications
from helper import target_size, batch_size
from math import ceil
import numpy as np
datagen = ImageDataGenerator(rescale=1./255)
loading vgg16 model, excluding the top fully connected layers
model = applications.VGG16(include_top=False, weights='imagenet' , input_shape=(224, 224 , 3))
above code (shape(224,224,3)) gives :
ValueError: The input must have 3 channels; got
input_shape=(224, 224, 3)
If I use : shape(3,224,24)
'Redefinition of variable %s' % self.name AssertionError: Redefinition of variable block1_conv1/kernel1
How can I properly use mxnet instead of tensorflow backend in working code?
Note: keras.json:
{
"epsilon": 1e-07,
"floatx": "float32",
"image_data_format": "channels_first",
"backend": "mxnet"
}
Edit 1
When I change the backend to mxnet from tensorflow is keras need to re-download vgg16 model for mxnet ?