deeplabcut.pose_estimation_tensorflow.backbones.efficientnet_builder
Classes:
| Name | Description |
|---|---|
BlockDecoder |
Block Decoder for readability. |
Functions:
| Name | Description |
|---|---|
build_model |
A helper function to creates a model and returns predicted logits. |
build_model_base |
A helper function to create a base model and return global_pool. |
efficientnet |
Creates a efficientnet model. |
efficientnet_params |
Get efficientnet params based on model name. |
get_model_params |
Get the block args and global params for a given model. |
swish |
Computes the Swish activation function. |
BlockDecoder
Block Decoder for readability.
Methods:
| Name | Description |
|---|---|
decode |
Decodes a list of string notations to specify blocks inside the network. |
encode |
Encodes a list of Blocks to a list of strings. |
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
decode
Decodes a list of string notations to specify blocks inside the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
a list of strings, each string is a notation of block. |
required |
Returns: A list of namedtuples to represent blocks arguments.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
encode
Encodes a list of Blocks to a list of strings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
A list of namedtuples to represent blocks arguments. |
required |
Returns: a list of strings, each string is a notation of block.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
build_model
build_model(images, model_name, training, override_params=None, model_dir=None, fine_tuning=False, features_only=False)
A helper function to creates a model and returns predicted logits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
input images tensor. |
required | |
|
string, the predefined model name. |
required | |
|
boolean, whether the model is constructed for training. |
required | |
|
A dictionary of params for overriding. Fields must exist in efficientnet_model.GlobalParams. |
None
|
|
|
string, optional model dir for saving configs. |
None
|
|
|
boolean, whether the model is used for finetuning. |
False
|
|
|
build the base feature network only. |
False
|
Returns: logits: the logits tensor of classes. endpoints: the endpoints for each layer. Raises: When model_name specified an undefined model, raises NotImplementedError. When override_params has invalid fields, raises ValueError.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
build_model_base
A helper function to create a base model and return global_pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
input images tensor. |
required | |
|
string, the predefined model name. |
required | |
|
boolean, whether the model is constructed for training. |
required | |
|
A dictionary of params for overriding. Fields must exist in efficientnet_model.GlobalParams. |
None
|
Returns: features: global pool features. endpoints: the endpoints for each layer. Raises: When model_name specified an undefined model, raises NotImplementedError. When override_params has invalid fields, raises ValueError.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
efficientnet
efficientnet(width_coefficient=None, depth_coefficient=None, dropout_rate=0.2, drop_connect_rate=0.2)
Creates a efficientnet model.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
efficientnet_params
Get efficientnet params based on model name.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
get_model_params
Get the block args and global params for a given model.
Source code in deeplabcut/pose_estimation_tensorflow/backbones/efficientnet_builder.py
swish
Computes the Swish activation function.
The tf.nn.swish operation uses a custom gradient to reduce memory usage.
Since saving custom gradients in SavedModel is currently not supported, and
one would not be able to use an exported TF-Hub module for fine-tuning, we
provide this wrapper that can allow to select whether to use the native
TensorFlow swish operation, or whether to use a customized operation that
has uses default TensorFlow gradient computation.
Args:
features: A Tensor representing preactivation values.
use_native: Whether to use the native swish from tf.nn that uses a custom
gradient to reduce memory usage, or to use customized swish that uses
default TensorFlow gradient computation.
Returns:
The activation value.