code: 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]))
  
file_path: magenta/magenta/models/onsets_frames_transcription/infer_util.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from magenta.models.onsets_frames_transcription import data
  from note_seq import sequences_lib
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: posterior_pianoroll_image(onset_probs, onset_labels, frame_probs, frame_labels, sequence_frame_predictions) and returns: np, pianoroll_img