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

Issues with evaluation (std and salience for beat/downbeat) #21

Open
in-conscious opened this issue Jan 28, 2021 · 6 comments
Open

Issues with evaluation (std and salience for beat/downbeat) #21

in-conscious opened this issue Jan 28, 2021 · 6 comments

Comments

@in-conscious
Copy link

Hi! I was trying to realize the evaluation part of the code according to the paper (see the attached picture) Pop Music Transformer: Beat-based Modeling and Generation of Expressive Pop Piano Compositions:

image

However, There must be some mistakes with my calculation because of the perceptable distincts between my result of beat std and downbeat salience and the one the paper. Also, I found difficulty in realizing the part of downbeat std because of the different description (perhaps?) of the paper and the file for madmom. The data presented in my result is based on the train set (Remi/data/train) and madmom, and I think I transferred the .midi files into correct .wav files:

image

image

I've viewed https://madmom.readthedocs.io/en/latest/modules/features/downbeats.html for related information but still failed to solve it by myself. Therefore, could you please share the evaluation part with me? Thank you so much!

@remyhuang
Copy link
Contributor

please attach your code, thanks.

@in-conscious
Copy link
Author

Here's my code, thanks.
`

def Eval_rhythm(audio_path):

  print("path ", audio_path)
  # RNNDownBeatProcessor
  act = downbeats.RNNDownBeatProcessor()(audio_path)       
  # DBNDownBeatTrackingProcessor
  proc2 = downbeats.DBNDownBeatTrackingProcessor(beats_per_bar=[4, 4], fps=100)
  result = proc2(act)
  # print("act = ", act)
  # print("---" * 50)
  # print(result)

  # Beat Std
  rawbeat_std = [i[0] for i in result]
  beat_new = [0] * len(rawbeat_std)
  beat_new[0] = rawbeat_std[0]
  for i in range(1, len(rawbeat_std)):
      beat_new[i] = rawbeat_std[i] - rawbeat_std[i - 1]
  beat_std = np.std(beat_new, ddof=1)
  print("Beat Std = ", beat_std)

  # Downbeat Std
  rawdownbeat_std = [i[1] for i in result]
  downbeat_new = [0] * len(rawdownbeat_std)
  downbeat_new[0] = rawdownbeat_std[0]
  for i in range(1, len(rawdownbeat_std)):
      downbeat_new[i] = rawdownbeat_std[i] - rawdownbeat_std[i - 1]
  downbeat_std = np.std(downbeat_new, ddof=1)
  print("Downbeat Std = ", downbeat_std)

  # Downbeat Salience
  downbeat_salience = [i[1] for i in act]
  salience = sum(downbeat_salience) / len(downbeat_salience)
  print("Downbeat Salience = ", salience)
  
  return beat_std, downbeat_std, salience

`

@remyhuang
Copy link
Contributor

Take a quick look at your code.

  1. why beat_new[0] = rawbeat_std[0], but beat_new[i] = rawbeat_std[i] - rawbeat_std[i - 1]
  2. is "downbeat" salience, not "all" salience

@in-conscious
Copy link
Author

image

I guess τBt-τB(t-1) for τB0 should be (τB0 - 0)? That's because I failed to find the code of the referred model. It was missing according to the link in the paper of that author (for the several edition I've found). I also wrote to the website master of the institute he was working in for the new link of that code but there's still no reply.

image

I think I was calculating the downbeat salience. There's a nonstandard in the name of it ("salience") and I'll revise it. Thanks again!

@in-conscious
Copy link
Author

Would you like to share the evaluation code?

@MarcusLee-awsome
Copy link

Can you share the code of the evaluation。I can't find it in the website

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

3 participants