Python nets.mobilenet.mobilenet.op() Examples
The following are 11
code examples of nets.mobilenet.mobilenet.op().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
nets.mobilenet.mobilenet
, or try the search function
.
Example #1
Source File: mobilenet_v3.py From models with Apache License 2.0 | 6 votes |
def mbv3_op(ef, n, k, s=1, act=tf.nn.relu, se=None, **kwargs): """Defines a single Mobilenet V3 convolution block. Args: ef: expansion factor n: number of output channels k: stride of depthwise s: stride act: activation function in inner layers se: squeeze excite function. **kwargs: passed to expanded_conv Returns: An object (lib._Op) for inserting in conv_def, representing this operation. """ return op( ops.expanded_conv, expansion_size=expand_input(ef), kernel_size=(k, k), stride=s, num_outputs=n, inner_activation_fn=act, expansion_transform=se, **kwargs)
Example #2
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From vehicle_counting_tensorflow with MIT License | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs
Example #3
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs
Example #4
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs
Example #5
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs
Example #6
Source File: mobilenet_v2_test.py From models with Apache License 2.0 | 5 votes |
def testWithSplits(self): spec = copy.deepcopy(mobilenet_v2.V2_DEF) spec['overrides'] = { (ops.expanded_conv,): dict(split_expansion=2), } _, _ = mobilenet.mobilenet( tf.placeholder(tf.float32, (10, 224, 224, 16)), conv_defs=spec) num_convs = len(find_ops('Conv2D')) # All but 3 op has 3 conv operatore, the remainign 3 have one # and there is one unaccounted. self.assertEqual(num_convs, len(spec['spec']) * 3 - 5)
Example #7
Source File: mobilenet_v2_test.py From models with Apache License 2.0 | 5 votes |
def testDivisibleBy(self): tf.reset_default_graph() mobilenet_v2.mobilenet( tf.placeholder(tf.float32, (10, 224, 224, 16)), conv_defs=mobilenet_v2.V2_DEF, divisible_by=16, min_depth=32) s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')] s = set(s) self.assertSameElements([32, 64, 96, 160, 192, 320, 384, 576, 960, 1280, 1001], s)
Example #8
Source File: mobilenet_v2_test.py From models with Apache License 2.0 | 5 votes |
def testDivisibleByWithArgScope(self): tf.reset_default_graph() # Verifies that depth_multiplier arg scope actually works # if no default min_depth is provided. with slim.arg_scope((mobilenet.depth_multiplier,), min_depth=32): mobilenet_v2.mobilenet( tf.placeholder(tf.float32, (10, 224, 224, 2)), conv_defs=mobilenet_v2.V2_DEF, depth_multiplier=0.1) s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')] s = set(s) self.assertSameElements(s, [32, 192, 128, 1001])
Example #9
Source File: mobilenet_v2_test.py From models with Apache License 2.0 | 5 votes |
def testFineGrained(self): tf.reset_default_graph() # Verifies that depth_multiplier arg scope actually works # if no default min_depth is provided. mobilenet_v2.mobilenet( tf.placeholder(tf.float32, (10, 224, 224, 2)), conv_defs=mobilenet_v2.V2_DEF, depth_multiplier=0.01, finegrain_classification_mode=True) s = [op.outputs[0].get_shape().as_list()[-1] for op in find_ops('Conv2D')] s = set(s) # All convolutions will be 8->48, except for the last one. self.assertSameElements(s, [8, 48, 1001, 1280])
Example #10
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From models with Apache License 2.0 | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs
Example #11
Source File: ssd_mobilenet_v2_fpn_feature_extractor.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v2.V2_DEF) conv_defs['spec'][-1] = mobilenet.op( slim.conv2d, stride=1, kernel_size=[1, 1], num_outputs=256) return conv_defs