AccelModel class

Definition

Abstract base class for accel models.

Accelerated models are neural networks that can be accelerated using dedicated hardware.

AccelModel(model_base_path, model_folder_name, version, check_point_uri, save_name, is_frozen=False, weight_path=None)
Inheritance
builtins.object
AccelModel

Methods

get_default_classifier(input_tensor, prefix='classifier')

Import a frozen, default Imagenet classifier for the model into the current graph.

get_input_dims(index=0)

Get nth model input tensor dimensions.

get_output_dims(index=0)

Get nth model output tensor dimensions.

import_graph_def(input_tensor=None, is_training=True)

Import the graph definition corresponding to this model.

Imports accelerated model into currently active graph.

restore_weights(session)

Restore the weights of the model into the specific session.

save_weights(path, session=None)

Save the weights of the model from a specific session into a specific path.

get_default_classifier(input_tensor, prefix='classifier')

Import a frozen, default Imagenet classifier for the model into the current graph.

get_default_classifier(input_tensor, prefix='classifier')

Parameters

prefix

namespace to load classifier into.

input_tensor

The input feature tensor for the classifier. Expected to be [?, 2048]

default value: classifier
model_dir

The directory to download the classifier into. Used as a cache locally.

get_input_dims(index=0)

Get nth model input tensor dimensions.

get_input_dims(index=0)

Parameters

index
default value: 0

get_output_dims(index=0)

Get nth model output tensor dimensions.

get_output_dims(index=0)

Parameters

index
default value: 0

import_graph_def(input_tensor=None, is_training=True)

Import the graph definition corresponding to this model.

Imports accelerated model into currently active graph.

import_graph_def(input_tensor=None, is_training=True)

Parameters

input_tensor

Replace input tensor to accelerated model (must match expected shape and dtype)

default value: None
is_training

Boolean indicating if the imported graph is intending for training.

default value: True

Returns

Either single output tensor or list of output tensors (if more than one).

restore_weights(session)

Restore the weights of the model into the specific session.

restore_weights(session)

Parameters

session
tf.Session

The session to load the weights into.

save_weights(path, session=None)

Save the weights of the model from a specific session into a specific path.

save_weights(path, session=None)

Parameters

path

Path of the checkpoint to save the weights into.

session
tf.Session

Session to save weights from.

default value: None

Attributes

input_tensor_list

List of names of the input tensors of this model.

model_path

Path to directory that contains the model.

model_ref

Name that refers to the model - used for writing the model_def.

model_version

Model Version.

output_tensor_list

List of names of the output tensors of this model.