(onset_probs, onset_labels, frame_probs,
                              frame_labels, sequence_frame_predictions)
return np.flipud(np.transpose(pianoroll_img, [1, 0, 2]))
Create a pianoroll image showing frame posteriors, predictions & labels.
Create a pianoroll image showing frame posteriors, predictions & labels.
Create a pianoroll image showing frame posteriors predictions & labels .
def posterior_pianoroll_image(onset_probs, onset_labels, frame_probs,
                              frame_labels, sequence_frame_predictions):
  """Create a pianoroll image showing frame posteriors, predictions & labels."""
  def probs_and_labels_image(probs, labels, max_length):
    pianoroll_img = np.zeros([max_length, labels.shape[1], 3])

    # Show overlap in yellow
    pianoroll_img[:probs.shape[0], :, 0] = probs
    pianoroll_img[:labels.shape[0], :, 1] = labels
    return pianoroll_img
  max_length = np.max([onset_probs.shape[0], onset_labels.shape[0],
                       frame_probs.shape[0], frame_labels.shape[0],
                       sequence_frame_predictions.shape[0]])
  pianoroll_img = np.concatenate([
      probs_and_labels_image(onset_probs, onset_labels, max_length),
      probs_and_labels_image(frame_probs, frame_labels, max_length),
      probs_and_labels_image(sequence_frame_predictions, frame_labels,
                             max_length),
  ], axis=1)

  return np.flipud(np.transpose(pianoroll_img, [1, 0, 2]))
def posterior_pianoroll_image ( onset_probs , onset_labels , frame_probs , frame_labels , sequence_frame_predictions ) : def probs_and_labels_image ( probs , labels , max_length ) : pianoroll_img = np . zeros ( [ max_length , labels . shape [ 1 ] , 3 ] ) # Show overlap in yellow pianoroll_img [ : probs . shape [ 0 ] , : , 0 ] = probs pianoroll_img [ : labels . shape [ 0 ] , : , 1 ] = labels return pianoroll_img max_length = np . max ( [ onset_probs . shape [ 0 ] , onset_labels . shape [ 0 ] , frame_probs . shape [ 0 ] , frame_labels . shape [ 0 ] , sequence_frame_predictions . shape [ 0 ] ] ) pianoroll_img = np . concatenate ( [ probs_and_labels_image ( onset_probs , onset_labels , max_length ) , probs_and_labels_image ( frame_probs , frame_labels , max_length ) , probs_and_labels_image ( sequence_frame_predictions , frame_labels , max_length ) , ] , axis = 1 ) return np . flipud ( np . transpose ( pianoroll_img , [ 1 , 0 , 2 ] ) )