Created
January 26, 2023 23:56
-
-
Save konverner/a19412944d74a157337c6c72dddaeeca to your computer and use it in GitHub Desktop.
get embeddings from resnet with pytorch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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