(frame_probs,
                   onset_probs,
                   frame_predictions,
                   onset_predictions,
                   offset_predictions,
                   velocity_values,
                   length,
                   sequence_label,
                   frame_labels,
                   sequence_id,
                   hparams,
                   min_pitch=constants.MIN_MIDI_PITCH,
                   max_pitch=constants.MAX_MIDI_PITCH,
                   prefix='',
                   onsets_only=False,
                   pitch_map=None)
Create a metric name to tf.metric pair dict for transcription metrics.
Create a metric name to tf.metric pair dict for transcription metrics.
Create a metric name to tf . metric pair dict for transcription metrics .
def define_metrics(frame_probs,
                   onset_probs,
                   frame_predictions,
                   onset_predictions,
                   offset_predictions,
                   velocity_values,
                   length,
                   sequence_label,
                   frame_labels,
                   sequence_id,
                   hparams,
                   min_pitch=constants.MIN_MIDI_PITCH,
                   max_pitch=constants.MAX_MIDI_PITCH,
                   prefix='',
                   onsets_only=False,
                   pitch_map=None):
  """Create a metric name to tf.metric pair dict for transcription metrics."""
  with tf.device('/device:CPU:*'):
    metrics = collections.defaultdict(list)
    for i in range(hparams.eval_batch_size):
      for k, v in calculate_metrics(
          frame_probs=frame_probs[i][:length[i]],
          onset_probs=onset_probs[i][:length[i]],
          frame_predictions=frame_predictions[i][:length[i]],
          onset_predictions=onset_predictions[i][:length[i]],
          offset_predictions=offset_predictions[i][:length[i]],
          velocity_values=velocity_values[i][:length[i]],
          sequence_label=sequence_label[i],
          frame_labels=frame_labels[i][:length[i]],
          sequence_id=sequence_id[i],
          hparams=hparams,
          min_pitch=min_pitch,
          max_pitch=max_pitch,
          onsets_only=onsets_only,
          pitch_map=pitch_map).items():
        metrics[k].append(v)
    return {'metrics/' + prefix + k: v for k, v in metrics.items()}
def define_metrics ( frame_probs , onset_probs , frame_predictions , onset_predictions , offset_predictions , velocity_values , length , sequence_label , frame_labels , sequence_id , hparams , min_pitch = constants . MIN_MIDI_PITCH , max_pitch = constants . MAX_MIDI_PITCH , prefix = '' , onsets_only = False , pitch_map = None ) : with tf . device ( '/device:CPU:*' ) : metrics = collections . defaultdict ( list ) for i in range ( hparams . eval_batch_size ) : for k , v in calculate_metrics ( frame_probs = frame_probs [ i ] [ : length [ i ] ] , onset_probs = onset_probs [ i ] [ : length [ i ] ] , frame_predictions = frame_predictions [ i ] [ : length [ i ] ] , onset_predictions = onset_predictions [ i ] [ : length [ i ] ] , offset_predictions = offset_predictions [ i ] [ : length [ i ] ] , velocity_values = velocity_values [ i ] [ : length [ i ] ] , sequence_label = sequence_label [ i ] , frame_labels = frame_labels [ i ] [ : length [ i ] ] , sequence_id = sequence_id [ i ] , hparams = hparams , min_pitch = min_pitch , max_pitch = max_pitch , onsets_only = onsets_only , pitch_map = pitch_map ) . items ( ) : metrics [ k ] . append ( v ) return { 'metrics/' + prefix + k : v for k , v in metrics . items ( ) }