# Path: moonlight/engine.py
# CONFIG = tf.ConfigProto(device_count={'GPU': 0})
# class OMREngine(object):
#   def __init__(self, glyph_classifier_fn=None):
#   def run(self, input_pngs, output_notesequence=False):
#   def process_image(self, image_arr, process_structure=True):
#   def _get_page(self, feed_dict=None, process_structure=True):
# def _nested_ndarrays_to_tensors(data):
# 
# Path: moonlight/glyphs/saved_classifier.py
# _SIGNATURE_KEYS = [
#     # Created if the ServingInputReceiver has 'patch' in
#     # receiver_tensors_alternatives.
#     'patch:predict',
#     # Seems to only be created if receiver_tensors_alternatives is not set.
#     tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY,
# ]
# _RUN_MIN_LENGTH_CONSTANT_NAME = 'runtime_params/run_min_length:0'
# class SavedConvolutional1DClassifier(
#     convolutional.Convolutional1DGlyphClassifier):
#   def __init__(self,
#                structure,
#                saved_model_dir,
#                num_sections=19,
#                *args,
#                **kwargs):
#   def staffline_predictions(self):
# 
# Path: moonlight/tools/export_kmeans_centroids.py
# def run(tfrecords_filename, export_dir):
# def main(argv):


import os.path
import tempfile
import librosa
import tensorflow as tf
from moonlight import engine
from moonlight.glyphs import saved_classifier
from moonlight.tools import export_kmeans_centroids
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""End to end test for exporting the KNN model."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function





class ExportKmeansCentroidsTest(tf.test.TestCase):

  def testEndToEnd(self):
    with tempfile.TemporaryDirectory() as tmpdir:
      with engine.get_included_labels_file() as centroids:
        export_dir = os.path.join(tmpdir, 'export')
        export_kmeans_centroids.run(centroids.name, export_dir)

      # Now load the saved model.

# Path: moonlight/engine.py
# CONFIG = tf.ConfigProto(device_count={'GPU': 0})
# class OMREngine(object):
#   def __init__(self, glyph_classifier_fn=None):
#   def run(self, input_pngs, output_notesequence=False):
#   def process_image(self, image_arr, process_structure=True):
#   def _get_page(self, feed_dict=None, process_structure=True):
# def _nested_ndarrays_to_tensors(data):
# 
# Path: moonlight/glyphs/saved_classifier.py
# _SIGNATURE_KEYS = [
#     # Created if the ServingInputReceiver has 'patch' in
#     # receiver_tensors_alternatives.
#     'patch:predict',
#     # Seems to only be created if receiver_tensors_alternatives is not set.
#     tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY,
# ]
# _RUN_MIN_LENGTH_CONSTANT_NAME = 'runtime_params/run_min_length:0'
# class SavedConvolutional1DClassifier(
#     convolutional.Convolutional1DGlyphClassifier):
#   def __init__(self,
#                structure,
#                saved_model_dir,
#                num_sections=19,
#                *args,
#                **kwargs):
#   def staffline_predictions(self):
# 
# Path: moonlight/tools/export_kmeans_centroids.py
# def run(tfrecords_filename, export_dir):
# def main(argv):


# Path: moonlight/tools/export_kmeans_centroids_test.py
import os.path
import tempfile
import librosa
import tensorflow as tf
from moonlight import engine
from moonlight.glyphs import saved_classifier
from moonlight.tools import export_kmeans_centroids

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""End to end test for exporting the KNN model."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function





class ExportKmeansCentroidsTest(tf.test.TestCase):

  def testEndToEnd(self):
    with tempfile.TemporaryDirectory() as tmpdir:
      with engine.get_included_labels_file() as centroids:
        export_dir = os.path.join(tmpdir, 'export')
        export_kmeans_centroids.run(centroids.name, export_dir)

      # Now load the saved model.

      omr = engine.OMREngine(