예제 #1
0
    def KerasParse(architecture_name, image_path):
        # get original model prediction result
        original_predict = keras_extractor.inference(architecture_name, image_path)

        # download model
        model_filename = keras_extractor.download(architecture_name, TestModels.cachedir)

        # original to IR
        parser = Keras2Parser(model_filename)
        parser.gen_IR()
        parser.save_to_proto(TestModels.tmpdir + architecture_name + "_converted.pb")
        parser.save_weights(TestModels.tmpdir + architecture_name + "_converted.npy")
        del parser
        return original_predict
    def KerasParse(architecture_name, image_path):
        from mmdnn.conversion.examples.keras.extractor import keras_extractor
        from mmdnn.conversion.keras.keras2_parser import Keras2Parser

        # get original model prediction result
        original_predict = keras_extractor.inference(architecture_name, TestModels.cachedir, image_path)

        # download model
        model_filename = keras_extractor.download(architecture_name, TestModels.cachedir)
        del keras_extractor

        # original to IR
        IR_file = TestModels.tmpdir + 'keras_' + architecture_name + "_converted"
        parser = Keras2Parser(model_filename)
        parser.run(IR_file)
        del parser
        del Keras2Parser
        return original_predict
예제 #3
0
    def KerasParse(architecture_name, image_path):
        from mmdnn.conversion.examples.keras.extractor import keras_extractor
        from mmdnn.conversion.keras.keras2_parser import Keras2Parser

        # get original model prediction result
        original_predict = keras_extractor.inference(architecture_name, TestModels.cachedir, image_path)

        # download model
        model_filename = keras_extractor.download(architecture_name, TestModels.cachedir)
        del keras_extractor

        # original to IR
        IR_file = TestModels.tmpdir + 'keras_' + architecture_name + "_converted"
        parser = Keras2Parser(model_filename)
        parser.run(IR_file)
        del parser
        del Keras2Parser
        return original_predict