Closed singhbhupender1 closed 6 years ago
Remove all the "pyc" files and run them again, from the comment line it looks like it is loading path I ran in my computer "/home/ap/github/...".
Thanks, I created a new notebook coz I was facing the same issue even after deleting the .pyc files.
But I found another issue. In this code block:
# get the image features image_features = get_image_features(image_file_name, CNN_weights_file_name)
i get error:
TypeError Traceback (most recent call last)
Replace the function get_image_features
with
def get_image_features(image_file_name, CNN_weights_file_name):
''' Runs the given image_file to VGG 16 model and returns the
weights (filters) as a 1, 4096 dimension vector '''
image_features = np.zeros((1, 4096))
from skimage import io
# if you would rather not install skimage, then use cv2.VideoCapture which surprisingly can read from url
# see this SO answer http://answers.opencv.org/question/16385/cv2imread-a-url/?answer=16389#post-id-16389
im = cv2.resize(io.imread(image_file_name), (224, 224))
im = im.transpose((2,0,1)) # convert the image to RGBA
# this axis dimension is required because VGG was trained on a dimension
# of 1, 3, 224, 224 (first axis is for the batch size
# even though we are using only one image, we have to keep the dimensions consistent
im = np.expand_dims(im, axis=0)
image_features[0,:] = get_image_model(CNN_weights_file_name).predict(im)[0]
return image_features
# get the image features image_features = get_image_features(image_file_name, CNN_weights_file_name)
another error creeps in:TypeError Traceback (most recent call last)
Okay, give me a couple of hours, and I will fix the issues. I have not updated the notebook in long time and probably newer versions of Keras does not support old api calls. What is your version of Keras?
keras : 2.1.5 spacy : 2.0.12 Tensorflow-gpu: 1.7.0
scikit-learn : 0.19.2
To a fresh pull
git pull origin master
I have fixed it to run on Keras 2.1, Spacy 2.0, and TF 1.6
runs without a problem now. As a suggestion xrange() could be a replaced by range() to support python 3. Also, is there a research paper referring to this?
This is the baseline model (figure 8) from this paper: https://arxiv.org/pdf/1505.00468.pdf
when i run this part from notebook
from keras.utils.visualize_util import plot model_vqa = get_VQA_model(VQA_model_file_name, VQA_weights_file_name) plot(model_vqa, to_file='model_vqa.png')
i get error KeyError Traceback (most recent call last)