Python datasets.sparse_pianoroll_to_dense() Examples

The following are 6 code examples of datasets.sparse_pianoroll_to_dense(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module datasets , or try the search function .
Example #1
Source File: calculate_pianoroll_mean.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb')) 
Example #2
Source File: calculate_pianoroll_mean.py    From Gun-Detector with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb')) 
Example #3
Source File: calculate_pianoroll_mean.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb')) 
Example #4
Source File: calculate_pianoroll_mean.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb')) 
Example #5
Source File: calculate_pianoroll_mean.py    From models with Apache License 2.0 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb')) 
Example #6
Source File: calculate_pianoroll_mean.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def main(unused_argv):
  if FLAGS.out_file is None:
    FLAGS.out_file = FLAGS.in_file
  with tf.gfile.Open(FLAGS.in_file, 'r') as f:
    pianorolls = pickle.load(f)
  dense_pianorolls = [sparse_pianoroll_to_dense(p, MIN_NOTE, NUM_NOTES)[0]
                      for p in pianorolls['train']]
  # Concatenate all elements along the time axis.
  concatenated = np.concatenate(dense_pianorolls, axis=0)
  mean = np.mean(concatenated, axis=0)
  pianorolls['train_mean'] = mean
  # Write out the whole pickle file, including the train mean.
  pickle.dump(pianorolls, open(FLAGS.out_file, 'wb'))