dfalbel / speech-keras

Code for the blog post "Simple Audio Classification with Keras"
https://blogs.rstudio.com/tensorflow/posts/2018-06-06-simple-audio-classification-keras/
11 stars 14 forks source link

Dataset padding for multilabel #5

Open Mrugankakarte opened 5 years ago

Mrugankakarte commented 5 years ago

Hi,

Thanks a lot for this wonderful post and code for audio classification. For multi-label I am changing

# transform the class_id into a one-hot encoded vector
response <- tf$one_hot(obs$class_id, 30L)

to

response <- as.matrix(obs[3:82])

as I have one hot encoded the labels and appended them to the dataframe. What else needs to be changed? I am getting the following error...

 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  DataLossError: Attempted to pad to a smaller size than the input element.
     [[node IteratorGetNext_4 (defined at 

padding function in data generator

ds <- ds %>% 
            dataset_padded_batch(batch_size, list(shape(n_chunks, fft_size, NULL), shape(NULL)))