L in extract_features.py
messithanh2k opened this issue · 2 comments
Dear authors,
I extract feature and save into HDF5 file but number of img_ids don't equal number of reg_feat and gri_feat.
In extract_features.py,
Why does batch_size in Dataloader equal BATCH_SIZE - 1 and why append random tensor to imgs from batch in dataloader.
Thank authors.
I have done it.
It is nice that you resolved things yourself. For more detail, let me assure as follows.
L
is the total number of images in the (COCO) dataset.
Why does batch_size in Dataloader equal BATCH_SIZE - 1 and why append random tensor to imgs from batch in dataloader
- Adding a random tensor of a FIXED SHAPE
HxW
is a small trick to ensure all the images in the dataset would be resized to the sameHxW
size. It is for the purpose of saving tensors of the same shape into HDF5.
-
images will be resized to the maximum shape
HxW
as ingrit/models/caption/detector.py
Line 44 in a47e362
-
More about resizing the input images can be found in
Line 327 in a47e362
-
Deformable Attention
prefers the input batch of size 2^N (e.g., 64). Therefore, to make sure that the total number of input images (including the random tensor) = BATCH_SIZE = 64, the real images fetched from the dataloader should bebatch_size = BATCH_SIZE - 1
, in which1
is for the random tensor ;)