Audio-WestlakeU / audiossl

A library built for easier audio self-supervised training, downstream tasks evaluation
Other
94 stars 10 forks source link

Extracting embeddings. #6

Closed Sreeni1204 closed 1 year ago

Sreeni1204 commented 2 years ago

Hello,

Could you please provide me information on how to extract embeddings from the model?

I am working with VoxCeleb2 audio data. I am training the model from scratch and would like to extract embeddings for further processing.

Please do let me know.

Regards, Sreeni...

lmaxwell commented 2 years ago

Hi,@Sreeni1204. Thanks for you insterest in our work!

For extracting embedding, please see example in "/audiossl/methods/atst/downstream/train_freeze.py".

pretrained_encoder = get_pretraied_encoder(args)

pretrained_module = PretrainedEncoderPLModule(pretrained_encoder,
                                                    6.,
                                                    args.n_last_blocks)
embedding = pretrained_module(input)

You may also want see extract_embedding function(also in train_freeze.py), which show how to extract all embeddings from a dataloader.

Hope this helps. If you have any further questions, please let me know.

Sreeni1204 commented 2 years ago

Hello @lmaxwell thank you for the clarifications. I will go through the file, and consult you for further clarifications.

Thank you :)