I have a dataset with PET-CT scans, it looks like directories for every patient with about 300 (from 250 to 350) slices per patient. I need to get 1 embedding for 1 person, I’ve tried to use 3D resnet, but it wasn’t enoght memory in my server. How can I make it?
I have the idea to make a loop in my forward function and for every mini-batch get an embedding, but after it i need to concatenate all of embeddings. For example, in output I’ll have 10 embeddings size [1, 300] for every mini-batch and in batch output I need 1 embedding size [1, 300] for this patient. How can I make it?
I’m not sure, that it’s the best idea at all and I’ll really appreciate any help
I don’t know what “embedding” refers to in your use case, but if you want to store e.g. the penultimate activation of the model you could either return this activation directly in the
forward method or you could use forward hooks.
DataLoader would be the standard approach and you could store the outputs in e.g. a
list and create the tensor afterwards.