|
|
|
@ -175,10 +175,6 @@ static int tf_start_inference(void *args) |
|
|
|
|
request->status); |
|
|
|
|
if (TF_GetCode(request->status) != TF_OK) { |
|
|
|
|
av_log(&tf_model->ctx, AV_LOG_ERROR, "%s", TF_Message(request->status)); |
|
|
|
|
tf_free_request(infer_request); |
|
|
|
|
if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { |
|
|
|
|
destroy_request_item(&request); |
|
|
|
|
} |
|
|
|
|
return DNN_GENERIC_ERROR; |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
@ -438,8 +434,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) |
|
|
|
|
TF_DeleteImportGraphDefOptions(graph_opts); |
|
|
|
|
TF_DeleteBuffer(graph_def); |
|
|
|
|
if (TF_GetCode(tf_model->status) != TF_OK){ |
|
|
|
|
TF_DeleteGraph(tf_model->graph); |
|
|
|
|
TF_DeleteStatus(tf_model->status); |
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Failed to import serialized graph to model graph\n"); |
|
|
|
|
av_freep(&sess_config); |
|
|
|
|
return DNN_GENERIC_ERROR; |
|
|
|
@ -452,8 +446,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) |
|
|
|
|
TF_SetConfig(sess_opts, sess_config, sess_config_length,tf_model->status); |
|
|
|
|
av_freep(&sess_config); |
|
|
|
|
if (TF_GetCode(tf_model->status) != TF_OK) { |
|
|
|
|
TF_DeleteGraph(tf_model->graph); |
|
|
|
|
TF_DeleteStatus(tf_model->status); |
|
|
|
|
TF_DeleteSessionOptions(sess_opts); |
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Failed to set config for sess options with %s\n", |
|
|
|
|
tf_model->ctx.options.sess_config); |
|
|
|
@ -465,8 +457,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) |
|
|
|
|
TF_DeleteSessionOptions(sess_opts); |
|
|
|
|
if (TF_GetCode(tf_model->status) != TF_OK) |
|
|
|
|
{ |
|
|
|
|
TF_DeleteGraph(tf_model->graph); |
|
|
|
|
TF_DeleteStatus(tf_model->status); |
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Failed to create new session with model graph\n"); |
|
|
|
|
return DNN_GENERIC_ERROR; |
|
|
|
|
} |
|
|
|
@ -479,9 +469,6 @@ static int load_tf_model(TFModel *tf_model, const char *model_filename) |
|
|
|
|
&init_op, 1, NULL, tf_model->status); |
|
|
|
|
if (TF_GetCode(tf_model->status) != TF_OK) |
|
|
|
|
{ |
|
|
|
|
TF_DeleteSession(tf_model->session, tf_model->status); |
|
|
|
|
TF_DeleteGraph(tf_model->graph); |
|
|
|
|
TF_DeleteStatus(tf_model->status); |
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Failed to run session when initializing\n"); |
|
|
|
|
return DNN_GENERIC_ERROR; |
|
|
|
|
} |
|
|
|
@ -865,6 +852,7 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ |
|
|
|
|
av_freep(&model); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
model->model = tf_model; |
|
|
|
|
tf_model->model = model; |
|
|
|
|
ctx = &tf_model->ctx; |
|
|
|
|
ctx->class = &dnn_tensorflow_class; |
|
|
|
@ -931,7 +919,6 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ |
|
|
|
|
goto err; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
model->model = tf_model; |
|
|
|
|
model->get_input = &get_input_tf; |
|
|
|
|
model->get_output = &get_output_tf; |
|
|
|
|
model->options = options; |
|
|
|
|