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

Error with numpy variable Xarray #2

Open
TheodoreG opened this issue Mar 13, 2018 · 2 comments
Open

Error with numpy variable Xarray #2

TheodoreG opened this issue Mar 13, 2018 · 2 comments

Comments

@TheodoreG
Copy link

Hello Thomas, I am running your BAD code. I have use the Matlab to change the ff1010bird dataset into .mat files and I set the feature_type='fbank_d_dd' in your create_hdf5_ff1010bird_public.py code.

However, after the script loaded .mat files the Xarray variable in your code has shape (7690, 200, 56), which is 3 dimensional.
But then in line 154 Xarray = np.ndarray.transpose(Xarray, (0, 3, 1, 2)) you treat this variable as a 4 dimensional array and it get error ValueError: axes don't match array.

Could you please help me with this problem? Thanks very much

@topel
Copy link
Owner

topel commented Mar 13, 2018

Hi,
indeed the data should be 4-d arrays as expected by Lasagne (Theano) to run 2-d conv layers: (nb_samples, nb_channels, width, height)

  • If you use fbank+delta+delta-delta (fbank_d_dd), you need to reshape your arrays so that nb_channels=3
  • If you use static fbank (fbank), then nb_channels should be equal to 1

If the Xarray variable has shape (7690, 200, 56), it means that you're using 56 static fbank coefficients, and you should add an extra dimension at index 1:

Xarray = Xarray[:, np.newaxis, :, :] in order to get a (7690, 1, 200, 56) shape

@TheodoreG
Copy link
Author

Thank you so much! I am now running the whole training process and I got following result:
**** Epoch 12 of 30 took 185.667s
lr: 0.002415750 train loss: 0.276738 validation loss: 0.323787 acc: 88.541666 auc: 90.664391 ratio: 85.468974
valid set CM:
[[262 10]
[ 34 78]]
[[96.3 3.7]
[30.4 69.6]]
best auc score update: 90.66 %
current lr: 0.001207875000

Which is close to the leaderboard results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants