easy_vision.python.model.deeplab¶
easy_vision.python.model.deeplab.deeplab¶
-
class
easy_vision.python.model.deeplab.deeplab.
DeepLab
(model_config, feature_dict, label_dict=None, mode='predict', categories=None)[source]¶ Bases:
easy_vision.python.model.cv_model.CVModel
implement deeplab v3+ model, which include an aspp head and a decoder head
-
__init__
(model_config, feature_dict, label_dict=None, mode='predict', categories=None)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
build_metric_graph
(eval_config)[source]¶ build metric graph for deeplab the following metrics are calculated:
mean_iou: TP / (TP + FP + FN) accuracy: TP / (TP + FP + FN + TN) positive_accuracy: TP / (TP + FN) negative_accuracy: TN / (TN + FP) positive_pixel_percentage: (TP + TN) / (TP + FP + TN + FN)TP: true positive FP: false positive TN: true negative FN: false negative
Parameters: eval_config – protos.eval_config_pb2.EvalConfig instance Returns: a dict of tf.metrics ops
-
build_predict_graph
()[source]¶ create the forward graph
- Returns: a dict of tensors
- logits, batch_size * width * height * num_classes, tf.float probs, batch_size * width * height * num_classes, softmax result, tf.float preds, batch_size * width * height, tf.int32, predict label of each pixel
-
classmethod
create_class
(name)¶
-
easy_vision.python.model.deeplab.deeplab_helper¶
-
easy_vision.python.model.deeplab.deeplab_helper.
aspp_block
(inputs, is_training, aspp_config)[source]¶ build aspp block on top of inputs
Parameters: - inputs – tensor of tf.float32, batch_size x height x width x channels
- is_training – bool, whether the training phase
- batchnorm_trainable – bool, whether to train the batchnorm parameters
- aspp_config – protos.aspp_block_pb2.ASPPBlock
Returns: tensor of tf.float32
-
easy_vision.python.model.deeplab.deeplab_helper.
split_separable_conv2d
(inputs, num_outputs, kernel_size, rate=1, weight_decay=4e-05, depthwise_weights_initializer_stddev=0.33, pointwise_weights_initializer_stddev=0.06, scope=None)[source]¶ Splits a separable conv2d into depthwise and pointwise conv2d. This operation differs from slim.separable_conv2d as this operation applies activation function between depthwise and pointwise conv2d.
Parameters: - inputs – Input tensor with shape [batch, height, width, channels].
- num_outputs – Number of filters in the 1x1 pointwise convolution.
- kernel_size – A list of length 2: [kernel_height, kernel_width] of of the filters. Can be an int if both values are the same.
- rate – Atrous convolution rate for the depthwise convolution.
- weight_decay – The weight decay to use for regularizing the model.
- depthwise_weights_initializer_stddev – The standard deviation of the truncated normal weight initializer for depthwise convolution.
- pointwise_weights_initializer_stddev – The standard deviation of the truncated normal weight initializer for pointwise convolution.
- scope – Optional scope for the operation.
Returns: Computed features after split separable conv2d.
easy_vision.python.model.deeplab.seg_decode_head¶
-
class
easy_vision.python.model.deeplab.seg_decode_head.
SegDecoderHead
(feature_dict, head_config, label_dict=None, mode='predict')[source]¶ Bases:
easy_vision.python.model.cv_head.CVHead
implement the decoder head for semantic segmentation the decoder will refine the edge of raw segmentation results
-
__init__
(feature_dict, head_config, label_dict=None, mode='predict')[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-