JacobChalk / TIM

Codebase for the paper: "TIM: A Time Interval Machine for Audio-Visual Action Recognition"
36 stars 5 forks source link

Audio feature extraction error #34

Open schowdhury671 opened 14 hours ago

schowdhury671 commented 14 hours ago

Hi,

I am getting the following error while trying to extract the Epic-Kitchens audio features for training:

Traceback (most recent call last):
  File "tools/run_net.py", line 24, in <module>
    main()
  File "tools/run_net.py", line 20, in main
    launch_job(cfg=cfg, init_method=args.init_method, func=test)
  File "/private/home/sanjoyc/TIM/feature_extractors/auditory_slowfast/slowfast/utils/misc.py", line 224, in launch_job
    torch.multiprocessing.spawn(
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 282, in spawn
    return start_processes(fn, args, nprocs, join, daemon, start_method="spawn")
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 238, in start_processes
    while not context.join():
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 189, in join
    raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException: 

-- Process 0 terminated with the following error:
Traceback (most recent call last):
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 76, in _wrap
    fn(i, *args)
  File "/private/home/sanjoyc/TIM/feature_extractors/auditory_slowfast/slowfast/utils/multiprocessing.py", line 60, in run
    ret = func(cfg)
  File "/private/home/sanjoyc/TIM/feature_extractors/auditory_slowfast/tools/test_net.py", line 143, in test
    metadata, audio_features = perform_test(test_loader, model, test_meter, cfg)
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/private/home/sanjoyc/TIM/feature_extractors/auditory_slowfast/tools/test_net.py", line 28, in perform_test
    for cur_iter, (inputs, labels, audio_idx, meta) in enumerate(test_loader):
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 630, in __next__
    data = self._next_data()
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 673, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 55, in fetch
    return self.collate_fn(data)
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 317, in default_collate
    return collate(batch, collate_fn_map=default_collate_fn_map)
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 174, in collate
    return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed]  # Backwards compatibility.
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 174, in <listcomp>
    return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed]  # Backwards compatibility.
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 183, in collate
    clone[i] = collate(samples, collate_fn_map=collate_fn_map)
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 142, in collate
    return collate_fn_map[elem_type](batch, collate_fn_map=collate_fn_map)
  File "/private/home/sanjoyc/.conda/envs/TIM/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 214, in collate_tensor_fn
    return torch.stack(batch, 0, out=out)
RuntimeError: stack expects each tensor to be equal size, but got [1, 50, 128] at entry 0 and [1, 44, 128] at entry 23

I am trying to run the following command:

python tools/run_net.py --cfg /private/home/sanjoyc/TIM/feature_extractors/auditory_slowfast/configs/EPIC-SOUNDS/SLOWFAST_R50.yaml NUM_GPUS 2 OUTPUT_DIR /private/home/sanjoyc/TIM/extracted_features_audio EPICSOUNDS.AUDIO_DATA_FILE /private/home/sanjoyc/auditory-slow-fast/EPIC_SOUNDS/hdf5/EPIC-KITCHENS-100_audio.hdf5 EPICSOUNDS.TEST_LIST /private/home/sanjoyc/TIM/data_split/EPIC_Sounds_train.pkl TEST.CHECKPOINT_FILE_PATH /private/home/sanjoyc/TIM/ckpts/asf_epicsounds.pyth TEST.NUM_FEATURES 3

Can you please let me know how to resolve this? Thanks!

JaesungHuh commented 6 hours ago

Hi, is this train set or val set or test set?

BW, Jaesung

JaesungHuh commented 3 hours ago

I saw your command and it seems like you are extracting the features with test list.

I pulled the main branch and tried the feature extraction. It works fine for me.

Could you make sure that you are using the most recent commit, please?

Let me know if this doesn't work.

BW, Jaesung

schowdhury671 commented 1 hour ago

Hi,

Thanks for the response. Actually this is for train set. I think the test and val has worked without error. I am using the latest version of the code. Can you please let me know if the command will be different for the train set?