# Generating image embedding using CNN

I have a CNN model using cifar -10 dataset. The model was built using Keras (Tensorflow).

Now based on this model, I have to generate an image embedding (vector). That means - an input image comes and I have to output the embedding vector of that image.

I am not sure how to do that. This is not a straight forward prediction/classification output. Rather I have to output the embedding of the input image (which is off couse the predicted embedding but an embedding vector nonetheless).

Any suggestion?

• Thanks. I looked into your link. So suppose I have the encoder network only in my autoencoder model (no decoder as I only care about the image embedding). So in the autoencoder function, I do return conv3. After training I save the model. Now when a new test image comes, how do I collect the output? I understand I have to do pred = autoencoder.predict(test_data) but whats next? – nad Feb 9 '19 at 23:34
• You just have to pass the image through the encoder, and the output is the embedding. Of course, for the embedding to make sense, you have to pair it with a decoder when training. At the end, to get the embedding, you can simply do something like pred = encoder.predict(test_data) – dpstart Feb 14 '19 at 13:52