Skip to content

Getting embeddings #22

Answered by KeremTurgutlu
johnyquest7 asked this question in Q&A
Feb 11, 2021 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Assuming you trained with a learner such as:

dls = get_dls(resize, bs)
model = create_swav_model(arch=xresnet34, n_in=3, pretrained=False)
learn = Learner(dls, model, SWAVLoss(),
                cbs=[SWAV(crop_sizes=[size,96], 
                          num_crops=[2,6],
                          min_scales=[0.25,0.2],
                          max_scales=[1.0,0.35]),
                     TerminateOnNaNCallback()])

You can simply use learn.model.encoder and feed input image to extract it's embedding. Don't forget to process the image with the same transforms you used during training, like normalization.

If this doesn't help, please feel free to share link to a notebook that you have so th…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@johnyquest7
Comment options

@KeremTurgutlu
Comment options

@johnyquest7
Comment options

@KeremTurgutlu
Comment options

@johnyquest7
Comment options

Answer selected by KeremTurgutlu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants