Python nets.inception.inception_v3_arg_scope() Examples
The following are 30
code examples of nets.inception.inception_v3_arg_scope().
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.inception
, or try the search function
.
Example #1
Source File: inception_v3_test.py From nasnet-tensorflow with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #2
Source File: inception_v3_test.py From DOTA_models with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #3
Source File: inception_v3_test.py From Translation-Invariant-Attacks with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #4
Source File: inception_v3_test.py From Action_Recognition_Zoo with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #5
Source File: inception_v3_test.py From ECO-pytorch with BSD 2-Clause "Simplified" License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #6
Source File: inception_v3_test.py From Machine-Learning-with-TensorFlow-1.x with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #7
Source File: inception_v3_test.py From hands-detection with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #8
Source File: inception_v3_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #9
Source File: inception_v3_test.py From MBMD with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #10
Source File: inception_v3_test.py From Optical-Flow-Guided-Feature with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #11
Source File: inception_v3_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #12
Source File: inception_v3_test.py From SENet-tensorflow-slim with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #13
Source File: inception_v3_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #14
Source File: inception_v3_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def testNoBatchNormScaleByDefault(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3(inputs, num_classes, is_training=False) self.assertEqual(tf.global_variables('.*/BatchNorm/gamma:0$'), [])
Example #15
Source File: inception_v3_test.py From MAX-Object-Detector with Apache License 2.0 | 5 votes |
def testBatchNormScale(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope( inception.inception_v3_arg_scope(batch_norm_scale=True)): inception.inception_v3(inputs, num_classes, is_training=False) gamma_names = set( v.op.name for v in tf.global_variables('.*/BatchNorm/gamma:0$')) self.assertGreater(len(gamma_names), 0) for v in tf.global_variables('.*/BatchNorm/moving_mean:0$'): self.assertIn(v.op.name[:-len('moving_mean')] + 'gamma', gamma_names)
Example #16
Source File: inception_v3_test.py From tf_classification with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #17
Source File: inception_v3_test.py From HumanRecognition with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #18
Source File: body_feature_extractor_common.py From HumanRecognition with MIT License | 5 votes |
def build_network(batch_size, is_training): # input tf_raw_image_data = tf.placeholder(tf.string, shape=(batch_size,)) tf_body_bbox = tf.placeholder(tf.int32, shape=(batch_size, 4)) tf_labels = tf.placeholder(tf.int32, shape=(batch_size,)) # pre-processing pipeline crops = [] for i in range(batch_size): image = tf.image.decode_jpeg(tf_raw_image_data[i], channels=3) body_crop = tf.image.crop_to_bounding_box(image, tf_body_bbox[i, 1], tf_body_bbox[i, 0], tf_body_bbox[i, 3], tf_body_bbox[i, 2]) processed_crop = inception_preprocessing.preprocess_image(body_crop, image_size, image_size, is_training=is_training) crops.append(processed_crop) processed_images = tf.stack(crops) # training pipeline with slim.arg_scope(inception.inception_v3_arg_scope()): _, endpoints = inception.inception_v3(processed_images, num_classes=num_identity, is_training=is_training) # load model parameters init_fn = slim.assign_from_checkpoint_fn(os.path.join(checkpoints_dir, checkpoint_name), slim.get_model_variables(original_variable_namescope)) net_before_pool = tf.reshape(endpoints['Mixed_7c'], shape=(batch_size, -1)) net_before_pool_frozen = tf.stop_gradient(net_before_pool) tf_features = slim.fully_connected(net_before_pool_frozen, feature_length, activation_fn=None) tf_features_normalized = tf.nn.l2_normalize(tf_features, dim=1) tf_loss = coco_loss_layer(tf_features_normalized, tf_labels, batch_size) # optimizer tf_lr = tf.placeholder(dtype=tf.float32, shape=(), name='learning_rate') optimizer = tf.train.AdamOptimizer(learning_rate=0.001) train = optimizer.minimize(tf_loss) # summary tf.summary.scalar('coco_loss', tf_loss) summary_op = tf.summary.merge_all() return (tf_raw_image_data, tf_body_bbox, tf_labels), (init_fn, tf_loss, tf_lr, train, summary_op), tf_features
Example #19
Source File: head_feature_extractor_common.py From HumanRecognition with MIT License | 5 votes |
def build_network(batch_size, is_training): # input tf_raw_image_data = tf.placeholder(tf.string, shape=(batch_size,)) tf_body_bbox = tf.placeholder(tf.int32, shape=(batch_size, 4)) tf_labels = tf.placeholder(tf.int32, shape=(batch_size,)) # pre-processing pipeline crops = [] for i in range(batch_size): image = tf.image.decode_jpeg(tf_raw_image_data[i], channels=3) body_crop = tf.image.crop_to_bounding_box(image, tf_body_bbox[i, 1], tf_body_bbox[i, 0], tf_body_bbox[i, 3], tf_body_bbox[i, 2]) processed_crop = inception_preprocessing.preprocess_image(body_crop, image_size, image_size, is_training=is_training) crops.append(processed_crop) processed_images = tf.stack(crops) # training pipeline with slim.arg_scope(inception.inception_v3_arg_scope()): _, endpoints = inception.inception_v3(processed_images, num_classes=num_identity, is_training=is_training) # load model parameters init_fn = slim.assign_from_checkpoint_fn(os.path.join(checkpoints_dir, checkpoint_name), slim.get_model_variables(original_variable_namescope)) net_before_pool = tf.reshape(endpoints['Mixed_7c'], shape=(batch_size, -1)) net_before_pool_frozen = tf.stop_gradient(net_before_pool) tf_features = slim.fully_connected(net_before_pool_frozen, feature_length, activation_fn=None) tf_features_normalized = tf.nn.l2_normalize(tf_features, dim=1) tf_loss = coco_loss_layer(tf_features_normalized, tf_labels, batch_size) # optimizer tf_lr = tf.placeholder(dtype=tf.float32, shape=(), name='learning_rate') optimizer = tf.train.AdamOptimizer(learning_rate=0.001) train = optimizer.minimize(tf_loss) # summary tf.summary.scalar('coco_loss', tf_loss) summary_op = tf.summary.merge_all() return (tf_raw_image_data, tf_body_bbox, tf_labels), (init_fn, tf_loss, tf_lr, train, summary_op), tf_features
Example #20
Source File: upper_body_feature_extractor_common.py From HumanRecognition with MIT License | 5 votes |
def build_network(batch_size, is_training): # input tf_raw_image_data = tf.placeholder(tf.string, shape=(batch_size,)) tf_body_bbox = tf.placeholder(tf.int32, shape=(batch_size, 4)) tf_labels = tf.placeholder(tf.int32, shape=(batch_size,)) # pre-processing pipeline crops = [] for i in range(batch_size): image = tf.image.decode_jpeg(tf_raw_image_data[i], channels=3) body_crop = tf.image.crop_to_bounding_box(image, tf_body_bbox[i, 1], tf_body_bbox[i, 0], tf_body_bbox[i, 3], tf_body_bbox[i, 2]) processed_crop = inception_preprocessing.preprocess_image(body_crop, image_size, image_size, is_training=is_training) crops.append(processed_crop) processed_images = tf.stack(crops) # training pipeline with slim.arg_scope(inception.inception_v3_arg_scope()): _, endpoints = inception.inception_v3(processed_images, num_classes=num_identity, is_training=is_training) # load model parameters init_fn = slim.assign_from_checkpoint_fn(os.path.join(checkpoints_dir, checkpoint_name), slim.get_model_variables(original_variable_namescope)) net_before_pool = tf.reshape(endpoints['Mixed_7c'], shape=(batch_size, -1)) net_before_pool_frozen = tf.stop_gradient(net_before_pool) tf_features = slim.fully_connected(net_before_pool_frozen, feature_length, activation_fn=None) tf_features_normalized = tf.nn.l2_normalize(tf_features, dim=1) tf_loss = coco_loss_layer(tf_features_normalized, tf_labels, batch_size) # optimizer tf_lr = tf.placeholder(dtype=tf.float32, shape=(), name='learning_rate') optimizer = tf.train.AdamOptimizer(learning_rate=0.001) train = optimizer.minimize(tf_loss) # summary tf.summary.scalar('coco_loss', tf_loss) summary_op = tf.summary.merge_all() return (tf_raw_image_data, tf_body_bbox, tf_labels), (init_fn, tf_loss, tf_lr, train, summary_op), tf_features
Example #21
Source File: inception_v3_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #22
Source File: inception_v3_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def testNoBatchNormScaleByDefault(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3(inputs, num_classes, is_training=False) self.assertEqual(tf.global_variables('.*/BatchNorm/gamma:0$'), [])
Example #23
Source File: inception_v3_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def testBatchNormScale(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope( inception.inception_v3_arg_scope(batch_norm_scale=True)): inception.inception_v3(inputs, num_classes, is_training=False) gamma_names = set( v.op.name for v in tf.global_variables('.*/BatchNorm/gamma:0$')) self.assertGreater(len(gamma_names), 0) for v in tf.global_variables('.*/BatchNorm/moving_mean:0$'): self.assertIn(v.op.name[:-len('moving_mean')] + 'gamma', gamma_names)
Example #24
Source File: inception_v3_test.py From models with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random.uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #25
Source File: inception_v3_test.py From models with Apache License 2.0 | 5 votes |
def testNoBatchNormScaleByDefault(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3(inputs, num_classes, is_training=False) self.assertEqual(tf.global_variables('.*/BatchNorm/gamma:0$'), [])
Example #26
Source File: inception_v3_test.py From models with Apache License 2.0 | 5 votes |
def testBatchNormScale(self): height, width = 299, 299 num_classes = 1000 inputs = tf.placeholder(tf.float32, (1, height, width, 3)) with slim.arg_scope( inception.inception_v3_arg_scope(batch_norm_scale=True)): inception.inception_v3(inputs, num_classes, is_training=False) gamma_names = set( v.op.name for v in tf.global_variables('.*/BatchNorm/gamma:0$')) self.assertGreater(len(gamma_names), 0) for v in tf.global_variables('.*/BatchNorm/moving_mean:0$'): self.assertIn(v.op.name[:-len('moving_mean')] + 'gamma', gamma_names)
Example #27
Source File: inception_v3_test.py From Non-Targeted-Adversarial-Attacks with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #28
Source File: inception_v3_test.py From motion-rcnn with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #29
Source File: inception_v3_test.py From mtl-ssl with Apache License 2.0 | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)
Example #30
Source File: inception_v3_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def testModelHasExpectedNumberOfParameters(self): batch_size = 5 height, width = 299, 299 inputs = tf.random_uniform((batch_size, height, width, 3)) with slim.arg_scope(inception.inception_v3_arg_scope()): inception.inception_v3_base(inputs) total_params, _ = slim.model_analyzer.analyze_vars( slim.get_model_variables()) self.assertAlmostEqual(21802784, total_params)