Skip to content

Instantly share code, notes, and snippets.

@benjamintanweihao
Created October 2, 2018 16:35
Show Gist options
  • Save benjamintanweihao/12c02b41461d5bf486c017ba11a491c0 to your computer and use it in GitHub Desktop.
Save benjamintanweihao/12c02b41461d5bf486c017ba11a491c0 to your computer and use it in GitHub Desktop.
import tensorflow as tf
import os
from tensorflow.python.keras import Input, Model
from tensorflow.python.keras.models import load_model
from darknet import darknet_base
from definitions import ROOT_DIR
from yolo_layer import YOLOLayer
inputs = Input(shape=(None, None, 3))
outputs, config = darknet_base(inputs)
model = Model(inputs, outputs)
# model.summary()
model.save('model/yolo.h5')
model = load_model('model/yolo.h5', custom_objects={'YOLOLayer': YOLOLayer})
print({t.name: t for t in model.inputs})
print({t.name: t for t in model.outputs})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment