Ejemplo n.º 1
0
################################################################################

VALIDATE_TO_PRECISION_N = 5

################################################################################

sys.path.append('..')
from inceptionV1OnFire import construct_inceptionv1onfire

################################################################################

# tflearn - load model

print("Load tflearn model from: ../models/InceptionV1-OnFire ...", end='')
model_tflearn = construct_inceptionv1onfire(224, 224, training=False)
model_tflearn.load(os.path.join("../models/SP-InceptionV1-OnFire",
                                "sp-inceptiononv1onfire"),
                   weights_only=True)
print("OK")

################################################################################

# tf protocol buffer - load model (into opencv)

print("Load protocolbuf (pb) model from: inceptiononv1onfire.pb ...", end='')
tensorflow_pb_model = cv2.dnn.readNetFromTensorflow('sp-inceptionv1onfire.pb')
print("OK")

################################################################################
Ejemplo n.º 2
0
sys.path.append('..')

################################################################################

from inceptionV1OnFire import construct_inceptionv1onfire
from converter import convert_to_pb
from converter import convert_to_tflite

################################################################################

if __name__ == '__main__':

    # construct and re-export model (so that is excludes the training layers)

    model = construct_inceptionv1onfire(224, 224, False)
    print("[INFO] Constructed InceptionV1-OnFire (binary, full-frame)...")

    path = "../models/InceptionV1-OnFire/inceptiononv1onfire"
    # path to tflearn checkpoint including filestem
    input_layer_name = 'InputData/X'  # input layer of network
    output_layer_name = 'FullyConnected/Softmax'  # output layer of network
    filename = "inceptionv1onfire.pb"  # output pb format filename

    convert_to_pb(model, path, input_layer_name, output_layer_name, filename)
    convert_to_tflite(filename, input_layer_name, output_layer_name)

    tf.reset_default_graph()

    print("[INFO] Constructed InceptionV1-OnFire (superpixel)...")