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

IndexError in music-arousal-valence predict.py #11

Open
shaolo1 opened this issue Oct 4, 2023 · 0 comments
Open

IndexError in music-arousal-valence predict.py #11

shaolo1 opened this issue Oct 4, 2023 · 0 comments

Comments

@shaolo1
Copy link

shaolo1 commented Oct 4, 2023

After scanning my collection I have found a number of tracks that get an IndexError processing the results.

I added a few prints that I thought might be helpful

code

        embeddings = self.embeddings[embedding_type](waveform)
        print(f'{embeddings=}')

        classifier_name = f"{dataset}-{embedding_type}"
        results = self.classifiers[classifier_name](embeddings)
        print(f'1 {results=}')
        results = np.mean(results.squeeze(), axis=0)
        print(f'2 {results=}')

        # Manual normalization (1, 9) -> (-1, 1)
        results = (results - 5) / 4
        print(f'3 {results=}')

        valence = results[0]
        arousal = results[1]

results

embeddings=array([[-9.79215622e-01, -8.83984268e-01, -1.24399066e-01,
        -1.76216686e+00,  2.23284006e+00, -2.35090113e+00,
        -1.51178837e-01, -7.01047301e-01, -1.43495429e+00,
        -2.37940550e-02, -1.29274404e+00, -1.91006780e+00,
         1.25425029e+00, -8.58444750e-01,  7.34418631e-01,
         1.33782005e+00,  2.59214449e+00,  7.50851035e-01,
        -1.70553470e+00,  2.75724173e-01,  7.39336312e-01,
        -1.39294171e+00,  1.54597783e+00,  4.18036556e+00,
        -6.21451616e-01,  4.44779444e+00,  1.75153589e+00,
        -1.52528954e+00,  2.38282728e+00,  7.09380984e-01,
         2.29190707e-01,  1.83067608e+00, -4.18588161e-01,
         2.74203825e+00,  1.44375741e+00,  4.74760234e-01,
         1.68121433e+00,  1.47874069e+00, -1.43617809e-01,
         1.61118841e+00, -4.04867458e+00, -1.74851203e+00,
        -7.01254368e-01,  8.15650105e-01, -3.72627974e-01,
        -3.70025277e-01, -1.27522266e+00, -3.15851212e-01,
         3.06479597e+00,  2.72586560e+00, -1.56302571e+00,
         4.67827857e-01, -1.73909569e+00,  1.84981191e+00,
        -4.66434956e-02, -2.83670783e-01,  2.95574927e+00,
        -1.03319979e+00, -6.25443459e-03,  1.73981488e+00,
         1.23516762e+00, -1.13622689e+00, -1.46244502e+00,
         2.78344154e-01, -1.81369394e-01, -2.91738105e+00,
        -9.67344344e-01, -3.99259138e+00, -2.59917498e+00,
         9.12960827e-01,  3.73457408e+00,  1.10781193e+00,
         2.50818825e+00,  9.99556780e-02,  8.17857623e-01,
         2.07035232e+00,  8.15089345e-01,  4.53723907e-01,
         2.33492875e+00,  1.09855568e+00,  7.04147816e-01,
         7.99394250e-01,  1.43385303e+00,  2.09725070e+00,
        -2.20253325e+00, -2.23348546e+00,  2.42416933e-01,
         8.75000894e-01,  7.81318426e-01, -2.33874941e+00,
        -1.38941491e+00,  2.43245935e+00,  5.70881069e-01,
        -1.18041801e+00, -2.64751124e+00,  1.97756720e+00,
         3.16218066e+00, -1.19582140e+00, -2.14283633e+00,
        -2.38000154e-01, -2.88674641e+00, -3.46466994e+00,
         8.75189066e-01,  1.96835589e+00, -3.10026336e+00,
         8.83012056e-01, -6.35378361e-01,  9.42563534e-01,
         2.52133560e+00,  9.96280730e-01, -9.30942893e-02,
         9.47340965e-01,  3.68399858e-01,  2.75828791e+00,
        -3.09385014e+00, -2.02378774e+00,  1.70357120e+00,
        -2.36064720e+00,  1.22432148e+00,  2.61093092e+00,
        -4.17023540e-01,  4.29861546e-02,  1.84735775e+00,
        -2.60978580e+00,  1.00775516e+00,  2.10353518e+00,
        -2.91596794e+00, -1.38390124e-01,  1.19646978e+00,
        -3.24083090e+00,  1.05771589e+00,  3.88351679e-01,
         2.92800188e-01, -1.96619999e+00,  1.95784867e+00,
        -4.13798034e-01,  1.47642946e+00,  1.82268894e+00,
        -2.04837084e+00,  3.72619486e+00,  5.20634508e+00,
        -1.47109365e+00, -1.74831533e+00, -2.20906281e+00,
         1.04206157e+00,  2.17300224e+00, -1.77130532e+00,
         3.63481402e-01,  1.55684721e+00,  1.12421358e+00,
         6.73773527e-01, -2.70564651e+00, -1.60699368e+00,
        -5.89830041e-01, -7.11880744e-01, -7.72383094e-01,
        -4.74024773e+00, -7.64594853e-01, -3.01190495e-01,
         3.00760567e-02,  3.28799963e-01, -9.20998335e-01,
        -5.90195060e-01, -2.10354662e+00, -8.08288455e-02,
        -3.00726771e-01, -2.94073272e+00, -6.67897463e-02,
         4.05205935e-01, -1.01796746e-01, -6.07753038e-01,
         1.34296894e-01,  2.52990663e-01,  1.05131876e+00,
        -1.03456736e-01,  2.22371054e+00, -1.65700173e+00,
         4.42044616e-01, -1.74274778e+00,  2.11299562e+00,
         1.25178683e+00, -3.84630859e-01,  6.38607979e+00,
        -5.62303066e-02,  2.39617169e-01,  5.12941265e+00,
        -3.73447478e-01,  2.76882744e+00, -1.02909255e+00,
         8.72482896e-01, -3.09532136e-03,  1.65725648e+00,
        -1.45965195e+00,  4.96256053e-02,  1.95450640e+00,
         1.29016256e+00,  4.35873270e-02,  1.59944141e+00,
         2.08828044e+00,  1.44816399e+00]], dtype=float32)
1 results=array([[4.485778 , 4.6124716]], dtype=float32)
2 results=4.5491247
3 results=-0.11271882057189941
exception invalid index to scalar variable.
Traceback (most recent call last):
  File "test.py", line 35, in _run
    valence, arousal = predictor.predict(Path(url),  None, "msd-musicnn", "emomusic")
  File "music-arousal-valence/predict.py", line 122, in predict
    valence = results[0]
IndexError: invalid index to scalar variable.
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

1 participant