Combine Features Dimension Mismatch
Closed this issue · 2 comments
The following error occurred when I executed the command python preprocess/combine_features.py
.
......
P47_webcam02_P47_cereals is combined.
Traceback (most recent call last):
File "preprocess/combine_features.py", line 31, in <module>
result[row.ind:, :] = tfeat[:diff, :]
ValueError: could not broadcast input array from shape (32,768) into shape (36,768)
The previous features have been successfully combined, but there is a dimension problem when combining this feature. I can't figure out what caused it. How can I solve it? I really need your help and look forward to your answers. Thank you very much!
Bridge-Prompt/datasets/datasets.py
Line 312 in f976156
When I load
breakfast_exfm.npy
, I found that only P47_webcam02_P47_coffee
has the numpy broadcast error by observing the output.Not only that, then I encounter the FileNotFoundError when I run
python ft_acti.py
, which is
File "/root/autodl-tmp/Bridge-Prompt-Patchup/datasets/datasets.py", line 196, in __getitem__
seq[n, :, :] = np.load(os.path.join(self.feat_dir, videoname + '_' + vid + '.npy'))
File "/root/miniconda3/lib/python3.8/site-packages/numpy/lib/npyio.py", line 417, in load
fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/Bridge-Prompt/data/breakfast/features_dir/
breakfast_vit_acti_ls/P47_webcam02_P47_friedegg_0.npy'
I know .npy files are determined according to v_vlen_breakfast.json
. I found breakfast_acti.npy
is the corresponding v_vlen_breakfast.json
. Therefore, I load breakfast_acti.npy
instead of breakfast_exfm.npy
.
Bridge-Prompt/datasets/datasets.py
Line 309 in f976156
After deleting the comment, I re extract the feature and combine them. However, the numpy broadcast error occurs again.
Traceback (most recent call last):
File "preprocess/combine_features.py", line 36, in <module>
result[row.ind:row.ind + 32, :] = tfeat
ValueError: could not broadcast input array from shape (32,768) into shape (21,768)
breakfast_acti.npy
and breakfast_exfm.npy
go to different conditions.
if index == group.index[-1]:
diff = vlen - row.ind
result[row.ind:, :] = tfeat[:diff, :]
else:
result[row.ind:row.ind + 32, :] = tfeat
I really need your help and look forward to your answers. Thank you very much!
The issue has been solved. It is caused by the mismatch of the json.