Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prep_fsd.py problems #14

Open
aandreysr opened this issue Nov 5, 2023 · 4 comments
Open

prep_fsd.py problems #14

aandreysr opened this issue Nov 5, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@aandreysr
Copy link

I'm following the step-by-step implementation of PSLA here on GitHub, but when I run 'python3 prep_fsd.py,' it creates the folders FSD50K.dev_audio_16k and FSD50K.eval_audio_16k at the specified dataset path. However, it doesn't generate the converted audios inside the respective folders. Any idea what might be happening?

P.S.: The terminal indicates that the samples were created, but they were not.
The data path is defined as fsd_path = './dataset/', and this is the folder structure:

dataset
|
|--FSD50K.dev_audio
|--FSD50K.doc
|--FSD50K.eval_audio
|--FSD50K.ground_truth
|--FSD50K.metadata

@YuanGongND
Copy link
Owner

do you have sox installed? if no, please do so.

It isn't complex, you can debug it.

resample_cnt = 0
set_list = ['dev', 'eval']
for set in set_list:
basepath = fsd_path + '/FSD50K.'+ set +'_audio/'
targetpath = fsd_path + '/FSD50K.'+ set +'_audio_16k/'
if os.path.exists(targetpath) == False:
os.mkdir(targetpath)
files = get_immediate_files(basepath)
for audiofile in files:
os.system('sox ' + basepath + audiofile+' -r 16000 ' + targetpath + audiofile + '> /dev/null 2>&1')
resample_cnt += 1
if resample_cnt % 1000 == 0:
print('Resampled {:d} samples.'.format(resample_cnt))
print('Resampling finished.')
print('--------------------------------------------')

@YuanGongND YuanGongND added the bug Something isn't working label Nov 5, 2023
@aandreysr
Copy link
Author

aandreysr commented Nov 5, 2023

I think I got a better indication of what might be wrong. When running the run.sh, it calls ../../src/run.sh and shows the following error, despite having installed the requirements.txt. I'm using Python 3.7.7 via SSH

+ export TORCH_HOME=./
+ TORCH_HOME=./
+ att_head=4
+ model=efficientnet
+ psla=True
+ eff_b=2
+ batch_size=24
+ '[' True == True ']'
+ impretrain=True
+ freqm=48
+ timem=192
+ mixup=0.5
+ bal=True
+ lr=5e-4
+ p=mean
+ '[' mean == median ']'
+ trpath=./datafiles/fsd50k_tr_full_type1_2_mean.json
+ epoch=40
+ wa_start=21
+ wa_end=40
+ lrscheduler_start=10
+ exp_dir=./exp/demo-efficientnet-2-5e-4-fsd50k-impretrain-True-fm48-tm192-mix0.5-bal-True-b24-lemean-2
+ mkdir -p ./exp/demo-efficientnet-2-5e-4-fsd50k-impretrain-True-fm48-tm192-mix0.5-bal-True-b24-lemean-2
+ CUDA_CACHE_DISABLE=1
+ python ../../src/run.py --data-train ./datafiles/fsd50k_tr_full_type1_2_mean.json --data-val ./datafiles/fsd50k_val_full.json --data-eval ./datafiles/fsd50k_eval_full.json --exp-dir ./exp/demo-efficientnet-2-5e-4-fsd50k-impretrain-True-fm48-tm192-mix0.5-bal-True-b24-lemean-2 --n-print-steps 1000 --save_model True --num-workers 32 --label-csv ./class_labels_indices.csv --n_class 200 --n-epochs 40 --batch-size 24 --lr 5e-4 --model efficientnet --eff_b 2 --impretrain True --att_head 4 --freqm 48 --timem 192 --mixup 0.5 --bal True --lr_patience 2 --dataset_mean -4.6476 --dataset_std 4.5699 --target_length 3000 --noise False --metrics mAP --warmup True --loss BCE --lrscheduler_start 10 --lrscheduler_decay 0.5 --wa True --wa_start 21 --wa_end 40
Traceback (most recent call last):
  File "../../src/run.py", line 9, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

@YuanGongND
Copy link
Owner

This is a different problem, you would need to install the dependencies, see https://github.com/YuanGongND/psla#getting-started.

The previous issues is not torch related, have you checked sox?

@aandreysr
Copy link
Author

aandreysr commented Nov 5, 2023

The previously mentioned issue, now it creates the folders, and only a few audios are being converted in the folder FSD50K.dev_audio_16k. When I run the network, it displays the error below, and the folder FSD50K.eval_audio_16k remains empty.

 File "/home/andrey/mestrado/venv-psla/lib/python3.7/site-packages/torchaudio/backend/sox_backend.py", line 35, in load
    raise OSError("{} not found or is a directory".format(filepath))
OSError: ./dataset/FSD50K.dev_audio_16k/35034.wav not found or is a directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants