You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def load_frames(self, movie_name):
filenames = sorted(os.listdir(os.path.join(self.dataset_path, movie_name)))
filenames.sort(key=numerical_sort_key)
# define torch tensor to store the frames of size(0,0,0)
data = []
for filename_number in tqdm(filenames,desc="Loading frames"):
file_path = os.path.join(self.dataset_path, movie_name, filename_number)
if not os.path.isfile(file_path):
print(f"Did not find file: {filename_number}")
try:
with h5py.File(file_path, 'r') as h5_file:
image_embeds=torch.tensor(h5_file[f"frames_{filename_number[:-3]}"][:])
image_embeds = image_embeds[:,1:,:] # remove the first token (CLS) (200,256,1408)
# concate each 4 neighbours image tokens
bs, pn, hs = image_embeds.shape
image_embeds = image_embeds.view(bs, int(pn/4), int(hs*4))
data.extend(image_embeds)
except Exception as e:
print(f"Failed to process {filename_number}: {e}")
frames=torch.stack(data)
return frames
I was testing the code in eval_goldfish_movie_chat.py.
In the load_frames function of MovieChatDataset (Lines 112–137), it appears that the code expects .h5 files corresponding to each video file.
Could you please provide more details on how these .h5 files are generated?
The text was updated successfully, but these errors were encountered:
I was testing the code in eval_goldfish_movie_chat.py.
In the load_frames function of MovieChatDataset (Lines 112–137), it appears that the code expects .h5 files corresponding to each video file.
Could you please provide more details on how these .h5 files are generated?
The text was updated successfully, but these errors were encountered: