Open iAppCloudSolutions opened 5 years ago
You need to download VGG weights as said in models/CNN/README.md
Replace the get_image_features function with below:
def get_image_model(CNN_weights_file_name): ''' Takes the CNN weights file, and returns the VGG model update with the weights. Requires the file VGG.py inside models/CNN ''' from models.CNN.VGG import VGG_16 image_model = VGG_16(CNN_weights_file_name) image_model.pop() image_model.pop()
sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
# one may experiment with "adam" optimizer, but the loss function for
# this kind of task is pretty standard
image_model.compile(optimizer=sgd, loss='categorical_crossentropy')
return image_model
The download link is broken while trying to download vgg16_weights.h5 .
PLEASE CHECK README HERE: https://github.com/iamaaditya/VQA_Demo/tree/master/models/CNN
I have updated the link. Try now.
Thanks and Regards Adi
On Wed, Sep 22, 2021 at 3:04 PM Aryan Gupta @.***> wrote:
The download link is broken while trying to download vgg16_weights.h5 .
PLEASE CHECK README HERE: https://github.com/iamaaditya/VQA_Demo/tree/master/models/CNN
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/iamaaditya/VQA_Demo/issues/25#issuecomment-925224371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOTJ4T6J67LSQOHMOFIT2DUDISCXANCNFSM4GWLVHZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I'm running on Google colab, I'm getting the following error
ValueError: Unknown layer: Merge. Please ensure this object is passed to the
custom_objectsargument. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.
It occurred while I tried to execute the below code
model_vqa = get_VQA_model(VQA_model_file_name, VQA_weights_file_name)
It happened when I tried load the pretrained json configuration file along with weights file present inside the VGG folder.
1) I checked online but got nothing significant. It suggests I should use the same TF version on which the model is trained. Can you tell me the tensorflow version on which the model is trained upon?
2) Also it is saying to add an argument of custom layer. I don't know the custom layer name with which you trained upon? Please check this out:https://github.com/keras-team/keras/issues/8612
3) Can you tell me the modifications I need to do in the function:
`def get_VQA_model(VQA_model_file_name, VQA_weights_file_name):
# thanks the keras function for loading a model from JSON, this becomes
# very easy to understand and work. Alternative would be to load model
# from binary like cPickle but then model would be obfuscated to users
vqa_model = model_from_json(open(VQA_model_file_name).read())
# vqa_model.summary()
vqa_model.load_model(VQA_weights_file_name)
vqa_model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
return vqa_model`
While running a code, we are receiving below error. Please help me out.
OSError Traceback (most recent call last)