{"action":"created","issue":{"url":"https://api.github.com/repos/davidsandberg/facenet/issues/819","repository_url":"https://api.github.com/repos/davidsandberg/facenet","labels_url":"https://api.github.com/repos/davidsandberg/facenet/issues/819/labels{/name}","comments_url":"https://api.github.com/repos/davidsandberg/facenet/issues/819/comments","events_url":"https://api.github.com/repos/davidsandberg/facenet/issues/819/events","html_url":"https://github.com/davidsandberg/facenet/issues/819","id":344382093,"node_id":"MDU6SXNzdWUzNDQzODIwOTM=","number":819,"title":"Incompatible matrix size while calculating embedding for a single image","user":{"login":"tamaghnadutta","id":31533050,"node_id":"MDQ6VXNlcjMxNTMzMDUw","avatar_url":"https://avatars1.githubusercontent.com/u/31533050?v=4","gravatar_id":"","url":"https://api.github.com/users/tamaghnadutta","html_url":"https://github.com/tamaghnadutta","followers_url":"https://api.github.com/users/tamaghnadutta/followers","following_url":"https://api.github.com/users/tamaghnadutta/following{/other_user}","gists_url":"https://api.github.com/users/tamaghnadutta/gists{/gist_id}","starred_url":"https://api.github.com/users/tamaghnadutta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamaghnadutta/subscriptions","organizations_url":"https://api.github.com/users/tamaghnadutta/orgs","repos_url":"https://api.github.com/users/tamaghnadutta/repos","events_url":"https://api.github.com/users/tamaghnadutta/events{/privacy}","received_events_url":"https://api.github.com/users/tamaghnadutta/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-25T10:16:57Z","updated_at":"2018-09-08T17:57:55Z","closed_at":"2018-07-26T07:50:10Z","author_association":"NONE","body":"I was going through issue #503 #321 #278 and #234 regarding generation of embedding for a single image. Although I didn't see any issue reported for the following error.\r\n\r\nI am trying to generate embeddings for a single image. My error is as follows:\r\n\r\n```\r\nInvalidArgumentError (see above for traceback): Matrix size-incompatible: In[0]: [1,7168], In[1]: [1792,512]\r\n\t [[Node: InceptionResnetV1/Bottleneck/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"](InceptionResnetV1/Logits/Dropout/cond/Merge, `InceptionResnetV1/Bottleneck/weights/read)]]\r\n```\r\n\r\n\r\nWhy is this happening?\r\n\r\nI have used the frozen graph definition provided by the author too! My code is as follows:\r\n\r\nI am passing the aligned image as input\r\n\r\n```\r\nwith tf.Session() as sess:\r\n        #Load the model\r\n        print('Loading feature extraction model')\r\n        facenet.load_model('../../frozen_graph.pb')\r\n        #Get input and output tensors\r\n        images_placeholder = tf.get_default_graph().get_tensor_by_name(\"input:0\")\r\n        embeddings = tf.get_default_graph().get_tensor_by_name(\"embeddings:0\")\r\n        phase_train_placeholder = tf.get_default_graph().get_tensor_by_name(\"phase_train:0\")\r\n        embedding_size = embeddings.get_shape()[1]\r\n        # Run forward pass to calculate embeddings\r\n        print('Calculating features for images')\r\n        nrof_images = 1\r\n        nrof_batches_per_epoch = int(math.ceil(1.0*nrof_images / 90))\r\n        emb_array = np.zeros((nrof_images, embedding_size))\r\n        for i in range(nrof_batches_per_epoch):\r\n            start_index = i*90\r\n            end_index = min((i+1)*90, nrof_images)\r\n            feed_dict = { images_placeholder:images, phase_train_placeholder:False }\r\n            emb_array[start_index:end_index,:] = sess.run(embeddings, feed_dict=feed_dict)\r\n\r\n\r\nimage = misc.imread('<image_path>')\r\naligned_image = align_image.align_img(image) #calling align image code provided by author\r\nimages = np.zeros((1, 182, 182, 3))\r\nimages[0,:,:,:] = aligned_image\r\n```\r\n\r\nPassing this '_images_' to the Tensorflow session."},"comment":{"url":"https://api.github.com/repos/davidsandberg/facenet/issues/comments/419661382","html_url":"https://github.com/davidsandberg/facenet/issues/819#issuecomment-419661382","issue_url":"https://api.github.com/repos/davidsandberg/facenet/issues/819","id":419661382,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTY2MTM4Mg==","user":{"login":"priyakansal","id":38773738,"node_id":"MDQ6VXNlcjM4NzczNzM4","avatar_url":"https://avatars3.githubusercontent.com/u/38773738?v=4","gravatar_id":"","url":"https://api.github.com/users/priyakansal","html_url":"https://github.com/priyakansal","followers_url":"https://api.github.com/users/priyakansal/followers","following_url":"https://api.github.com/users/priyakansal/following{/other_user}","gists_url":"https://api.github.com/users/priyakansal/gists{/gist_id}","starred_url":"https://api.github.com/users/priyakansal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/priyakansal/subscriptions","organizations_url":"https://api.github.com/users/priyakansal/orgs","repos_url":"https://api.github.com/users/priyakansal/repos","events_url":"https://api.github.com/users/priyakansal/events{/privacy}","received_events_url":"https://api.github.com/users/priyakansal/received_events","type":"User","site_admin":false},"created_at":"2018-09-08T17:57:55Z","updated_at":"2018-09-08T17:57:55Z","author_association":"NONE","body":"@tamaghnadutta \r\nHi,\r\nI am facing the same issue.\r\nHave you find the solution?\r\nIf yes, Please suggest how to rectify this?"}}
{"actor":{"display_login":"priyakansal"}}