Open jibrjabr opened 4 days ago
What's your batch size?
Batch_size = 32
Could you try 8 or 16 and report back?
I set batch_size = 16, 8, 4, 2. Not sure if it matters, but this results in the DataLoader "batches" having size 1,2,4,16, respectively. All produce the same behavior. For reference when I had used the old version (without issue) batch_size = 64.
Another update, I ran this instead (also taken directly from your documentation):
with extractor.batch_extraction(module_name, output_type="ndarray") as e: for batch in batches: feature_batch = e.extract_batch( batch=batch, flatten_acts=True, # flatten 2D feature maps from an early convolutional or attention layer )
And I got the correct output (batch_size = 16); namely, an ndarray that was 16 x flattened features.
Haven't used THINGSvision in a while (last time thingsvision.vision was still a thing) so I updated to the latest version to extract feature values for some images. I am doing this in vscode with output appearing in an interactive window. Everything seems to run fine (just copying and pasting the tutorial code and specifying the image and output directories) until I try extracting the feature weights (for vgg16_bn):
module_name= 'features.23' features = extractor.extract_features( batches=batches, module_name=module_name, flatten_acts=True, output_type="ndarray", # or "tensor" (only applicable to PyTorch models) )
The cell of code is seemingly executed successfully (little green "success" check mark in the interactive window). And I get the usual message saying that the features have been successfully extracted.
"...Features successfully extracted for all 16 images in the database."
However, there is no variable "features" that is generated as output. And if I try to execute anything else I get the pending clock. I then noticed that some of the cell output text was invisible for some reason and says:
"Batch: 0%| | 0/1 [00:00<?, ?it/s]"
So maybe something didn't execute correctly? Never had any issue with the older version so would appreciate any suggestions of what's going on (I assume it's something on my end).