How to find similar images based on final embedding layer?

Also some fellas on pytorch forums recommend putting the inference code in a context where you instruct torch not to use the autograd, while some others don’t. What do you think? It should reduce inference time, particularly on the cpu.

Another question: where would you extract the features in order to do a bit of t-SNE? I picked the zeroth layer of the last block (the adaptive pooling), but it turned out to be a very bad-shaped tensor, so i picked the output of the lambda layer (since this question Lambda Layer - #2 by jeremy). It seems the lambda does some kind of flattening. If so, would it be the best point to collect the features? Thanks!

Last but not least, I would like to know your opinion about the method proposed by Jeremy: Record more in Recorder - #2 by jeremy. How does it compare with the class you wrote above (which works fine), if your are not interested in stats?

1 Like