I’m trying to classify video frames, and for that i need to create a batch from a sequence of frames and pass it to the model. currently am classifying frame by frame as following:
The way to go would be to create a custom Dataset that will load your data in init (if they fit in your memory) and to have getitem retrieves one video and its label.
Once you have done that, a standard DataLoader can be set with this Dataset object and your batch size. PyTorch/FastAi will then automatically take care of generating your batches.
One example below:
Note: my dataset doesn’t fit in the (~1.5TB) so I load files in getitem
@bennnun thanks for your answer i’ll try this,
but i was wondering since i’m using an exported model where should I (if needed) apply the transformation function tfms (for example the one that normalize the tensor) ?
thanks