Class ModelLoader
Barracuda Model
loader
Inherited Members
Namespace: Unity.Barracuda
Syntax
public static class ModelLoader
Methods
Load(Byte[], Boolean, Boolean)
Return an object oriented representation (aka: Model
) of a neural network from a byte[] array.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static Model Load(byte[] stream, bool verbose = false, bool skipWeights = false)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | stream | binary representation of model as a byte array |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Returns
Type | Description |
---|---|
Model | loaded Model |
Load(String, Boolean, Boolean)
Return an object oriented representation (aka: Model
) of a neural network from a .bc
file.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static Model Load(string filepath, bool verbose = false, bool skipWeights = false)
Parameters
Type | Name | Description |
---|---|---|
String | filepath | file name |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Returns
Type | Description |
---|---|
Model | loaded Model |
Load(NNModel, Boolean, Boolean)
Return an object oriented representation (aka: Model
) of a neural network from a binary representation of type NNModel
.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static Model Load(NNModel model, bool verbose = false, bool skipWeights = false)
Parameters
Type | Name | Description |
---|---|---|
NNModel | model | model |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Returns
Type | Description |
---|---|
Model | loaded Model |
LoadAsync(Byte[], Model, Boolean, Boolean, Single)
Return an object oriented representation (aka: Model
) of a neural network from a byte[] array.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static IEnumerator LoadAsync(byte[] stream, Model model, bool verbose = false, bool skipWeights = false, float maxTimePerYield = 0.01F)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | stream | binary representation of model as a byte array |
Model | model | object-oriented representation of model (must initialize before calling method) |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Single | maxTimePerYield | the maximum amount of time to spend between in computation before yielding |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator (use with StartCoroutine) |
LoadAsync(String, Model, Boolean, Boolean, Single)
Return an object oriented representation (aka: Model
) of a neural network from a .bc
file.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static IEnumerator LoadAsync(string filepath, Model model, bool verbose = false, bool skipWeights = false, float maxTimePerYield = 0.01F)
Parameters
Type | Name | Description |
---|---|---|
String | filepath | file name |
Model | model | object-oriented representation of model (must initialize before calling method) |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Single | maxTimePerYield | the maximum amount of time to spend between in computation before yielding |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator (use with StartCoroutine) |
LoadAsync(NNModel, Model, Boolean, Boolean, Single)
Return an object oriented representation (aka: Model
) of a neural network from a binary representation of type NNModel
.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static IEnumerator LoadAsync(NNModel nnModel, Model model, bool verbose = false, bool skipWeights = false, float maxTimePerYield = 0.01F)
Parameters
Type | Name | Description |
---|---|---|
NNModel | nnModel | binary representation of model |
Model | model | object-oriented representation of model (must initialize before calling method) |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Single | maxTimePerYield | the maximum amount of time to spend between in computation before yielding |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator (use with StartCoroutine) |
LoadAsyncFromStreamingAssets(String, Model, Boolean, Boolean, Single)
Return an object oriented representation (aka: Model
) of a neural network from a .bc
file from the the streaming asset folder.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static IEnumerator LoadAsyncFromStreamingAssets(string filename, Model model, bool verbose = false, bool skipWeights = false, float maxTimePerYield = 0.01F)
Parameters
Type | Name | Description |
---|---|---|
String | filename | file name |
Model | model | object-oriented representation of model (must initialize before calling method) |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Single | maxTimePerYield | the maximum amount of time to spend between in computation before yielding |
Returns
Type | Description |
---|---|
IEnumerator | IEnumerator (use with StartCoroutine) |
LoadFromStreamingAssets(String, Boolean, Boolean)
Return an object oriented representation (aka: Model
) of a neural network from a .bc
file from the the streaming asset folder.
By default details are not logged to the console, set verbose
to true to see loading details.
Declaration
public static Model LoadFromStreamingAssets(string filename, bool verbose = false, bool skipWeights = false)
Parameters
Type | Name | Description |
---|---|---|
String | filename | file name |
Boolean | verbose | verbose |
Boolean | skipWeights | skip loading weights (fast loading, metadata only) |
Returns
Type | Description |
---|---|
Model | loaded Model |