del d5, e4 d3 = F.relu(self.bnd3(self.dc3(d4))) del d4 d2 = F.relu(self.bnd2(self.dc2(F.concat([e2, d3])))) del d3, e2 d1 = F.relu(self.bnd1(self.dc1(d2))) del d2 d0 = self.dc0(F.concat([e0, d1])) return d0 google_net = GoogLeNet() paintschainer = UNET() chainer.serializers.load_npz('google_net.net', google_net) chainer.serializers.load_npz('paintschainer.net', paintschainer) session = K.get_session() EPS = 1e-12 lr = 1e-6 beta1 = 0.5 with tf.variable_scope("generator"): base_generator = load_model('base_generator.net') sketch_ref_input_448 = tf.placeholder(dtype=tf.float32, shape=(None, None, None, 1)) local_hint_input_448 = tf.placeholder(dtype=tf.float32, shape=(None, None, None, 3)) hint_s57c64_0 = tf.placeholder(dtype=tf.float32, shape=(None, 64)) hint_s29c192_0 = tf.placeholder(dtype=tf.float32, shape=(None, 192)) hint_s29c256_0 = tf.placeholder(dtype=tf.float32, shape=(None, 256)) hint_s29c320_0 = tf.placeholder(dtype=tf.float32, shape=(None, 320)) hint_s15c576_0 = tf.placeholder(dtype=tf.float32, shape=(None, 576)) hint_s15c576_1 = tf.placeholder(dtype=tf.float32, shape=(None, 576))
loaded_model_json = json_file.read() json_file.close() loaded_model = model_from_json(loaded_model_json) loaded_model.load_weights(model_weights_filepath) #loaded_model = load_model('/home/neeraj/keras_jobs/pattern_biased_polka_new/final_pattern_biased_polka_new_inception_v3.h5') print("loaded model from disk") if os.path.isdir("./export"): shutil.rmtree("./export") model = loaded_model # export model export_path = "export/pattern/1" builder = saved_model_builder.SavedModelBuilder(export_path) print(model.input) print(model.output) signature = predict_signature_def(inputs={'images': model.input}, outputs={'scores': model.output}) with K.get_session() as sess: builder.add_meta_graph_and_variables( sess=sess, tags=[tag_constants.SERVING], signature_def_map={'predict': signature}) builder.save()