zoo.pipeline.api.net package¶
Submodules¶
zoo.pipeline.api.net.graph_net module¶
-
class
zoo.pipeline.api.net.graph_net.GraphNet(input, output, jvalue=None, bigdl_type='float', **kwargs)[source]¶ Bases:
bigdl.nn.layer.Model-
freeze_up_to(names)[source]¶ Freeze the model from the bottom up to the layers specified by names (inclusive). This is useful for finetuning a model
Parameters: names – A list of module names to be Freezed Returns: current graph model
-
static
from_jvalue(jvalue, bigdl_type='float')[source]¶ Create a Python Model base on the given java value
Parameters: jvalue – Java object create by Py4j Returns: A Python Model
-
layers¶
-
new_graph(outputs)[source]¶ Specify a list of nodes as output and return a new graph using the existing nodes
Parameters: outputs – A list of nodes specified Returns: A graph model
-
predict(x, batch_per_thread=4, distributed=True)[source]¶ Use a model to do prediction.
# Arguments x: Prediction data. A Numpy array or RDD of Sample or ImageSet. batch_per_thread:
The default value is 4. When distributed is True,the total batch size is batch_per_thread * rdd.getNumPartitions. When distributed is False the total batch size is batch_per_thread * numOfCores.- distributed: Boolean. Whether to do prediction in distributed mode or local mode.
- Default is True. In local mode, x must be a Numpy array.
-
unfreeze(names=None)[source]¶ “unfreeze” module, i.e. make the module parameters(weight/bias, if exists) to be trained(updated) in training process. If ‘names’ is a non-empty list, unfreeze layers that match given names
Parameters: names – list of module names to be unFreezed. Default is None. Returns: current graph model
-
zoo.pipeline.api.net.net_load module¶
-
class
zoo.pipeline.api.net.net_load.Net[source]¶ Bases:
object-
static
load(model_path, weight_path=None, bigdl_type='float')[source]¶ Load an existing Analytics Zoo model defined in Keras-style(with weights).
Parameters: - model_path – The path to load the saved model. Local file system, HDFS and Amazon S3 are supported. HDFS path should be like ‘hdfs://[host]:[port]/xxx’. Amazon S3 path should be like ‘s3a://bucket/xxx’.
- weight_path – The path for pre-trained weights if any. Default is None.
Returns: An Analytics Zoo model.
-
static
load_bigdl(model_path, weight_path=None, bigdl_type='float')[source]¶ Load a pre-trained BigDL model.
Parameters: - model_path – The path to the pre-trained model.
- weight_path – The path to the weights of the pre-trained model. Default is None.
Returns: A pre-trained model.
-
static
load_caffe(def_path, model_path, bigdl_type='float')[source]¶ Load a pre-trained Caffe model.
Parameters: - def_path – The path containing the caffe model definition.
- model_path – The path containing the pre-trained caffe model.
Returns: A pre-trained model.
-
static
load_keras(json_path=None, hdf5_path=None, by_name=False)[source]¶ Load a pre-trained Keras model.
Parameters: - json_path – The json path containing the keras model definition. Default is None.
- hdf5_path – The HDF5 path containing the pre-trained keras model weights with or without the model architecture. Default is None.
- by_name – by default the architecture should be unchanged. If set as True, only layers with the same name will be loaded.
Returns: A BigDL model.
-
static