classification_models
classification_models copied to clipboard
ResNet18 with no top: How to obtain 512-dimensional vector?
I am wondering how to obtain a 512-dimensional vector for an image. I am interested in ResNet18 with no top layer.
As for now, I am getting a list of vectors like the following one. list_of_vectors.txt
I expected getting one 512-dimensional vector for an image
This might be late, but can be of use for anyone faced this
ResNet18, preprocess_input = Classifiers.get('resnet18')
base_model = ResNet18(input_shape=(224,224,3), weights='imagenet', include_top=False)
output = keras.layers.GlobalAveragePooling2D()(base_model.output)
resnet18 = keras.models.Model(inputs=[base_model.input], outputs=[output])
And by the way adding a list of vectors text file like that doesn't make any sense, you could have just shared the shape of your output.