ebouteillon / freesound-audio-tagging-2019

Freesound Audio Tagging 2019
MIT License
95 stars 15 forks source link

WORK folder error #1

Closed happyprotean closed 5 years ago

happyprotean commented 5 years ago

Hi Sir, I met an error when I was trying to run training-CNN-model1 at step: Train on noisy data. It shows it cannot find files in the WORK folder. But I check the WORK folder, there is nothing. Do you know what may cause this error? Thanks a lot!


ValueError Traceback (most recent call last)

in 7 ) 8 ----> 9 data = (src.transform(tfms, size=128) 10 .databunch(bs=bs) 11 ) ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\data_block.py in transform(self, tfms, **kwargs) 503 if not tfms: tfms=(None,None) 504 assert is_listy(tfms) and len(tfms) == 2, "Please pass a list of two lists of transforms (train and valid)." --> 505 self.train.transform(tfms[0], **kwargs) 506 self.valid.transform(tfms[1], **kwargs) 507 if self.test: self.test.transform(tfms[1], **kwargs) ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\data_block.py in transform(self, tfms, tfm_y, **kwargs) 722 def transform(self, tfms:TfmList, tfm_y:bool=None, **kwargs): 723 "Set the `tfms` and `tfm_y` value to be applied to the inputs and targets." --> 724 _check_kwargs(self.x, tfms, **kwargs) 725 if tfm_y is None: tfm_y = self.tfm_y 726 tfms_y = None if tfms is None else list(filter(lambda t: getattr(t, 'use_on_y', True), listify(tfms))) ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\data_block.py in _check_kwargs(ds, tfms, **kwargs) 591 if (tfms is None or len(tfms) == 0) and len(kwargs) == 0: return 592 if len(ds.items) >= 1: --> 593 x = ds[0] 594 try: x.apply_tfms(tfms, **kwargs) 595 except Exception as e: ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\data_block.py in __getitem__(self, idxs) 118 "returns a single item based if `idxs` is an integer or a new `ItemList` object if `idxs` is a range." 119 idxs = try_int(idxs) --> 120 if isinstance(idxs, Integral): return self.get(idxs) 121 else: return self.new(self.items[idxs], inner_df=index_row(self.inner_df, idxs)) 122 ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\vision\data.py in get(self, i) 269 def get(self, i): 270 fn = super().get(i) --> 271 res = self.open(fn) 272 self.sizes[i] = res.size 273 return res ~\Anaconda3\envs\tensorflow\lib\site-packages\fastai\vision\data.py in open(self, fn) 265 def open(self, fn): 266 "Open image in `fn`, subclass and overwrite for custom behavior." --> 267 return open_image(fn, convert_mode=self.convert_mode, after_open=self.after_open) 268 269 def get(self, i): in open_fat2019_image(fn, convert_mode, after_open) 8 else: 9 crop_x = -1 ---> 10 idx = CUR_X_FILES.index(fname) 11 x = PIL.Image.fromarray(CUR_X[idx]) 12 # crop ValueError: 'work\\00097e21.wav' is not in list
ebouteillon commented 5 years ago

Hi @happyprotean ,

CUR_X_FILES is a variable containing names of files and CUR_X the associated pre-processed mel-spectrogram. It seems the filename 'work\00097e21.wav' present in your stack-trace is not in CUR_X_FILES.

Can you please provides first values of CUR_X_FILES? I guess there is a mismatch in the file location stored in CUR_X_FILES and the one requested by fastai library to open_fat2019_image.

I tested exclusively under Linux, and you are using Windows, maybe there is some wizardry to support use of '\' instead of '/' in paths. :smile:

happyprotean commented 5 years ago

Thanks for your reply, sir. Yes, this error is caused by the difference between linux and window. Actually after I change from "fname = fn.split('/')[-1] " to "fname = fn.split('\')[-1] ", it could work. One more question, how long you spend on training this model?

ebouteillon commented 5 years ago

You are welcomed. Congratulations to make it work under Windows. :+1:

Training took about one day with the hardware indicated in README.md.