Skip to content

Instantly share code, notes, and snippets.

@konverner
Created January 26, 2023 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konverner/a19412944d74a157337c6c72dddaeeca to your computer and use it in GitHub Desktop.
Save konverner/a19412944d74a157337c6c72dddaeeca to your computer and use it in GitHub Desktop.
get embeddings from resnet with pytorch
import torch
from torchvision import models
modules=list(models.resnet18(weights='IMAGENET1K_V1').children())[:-1]
model = nn.Sequential(*modules)
x = torch.rand(size=[1, 3, 640, 480])
emb = model(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment