Python nets.inception.inception_resnet_v2_base() Examples

The following are 30 code examples of nets.inception.inception_resnet_v2_base(). 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_resnet_v2_test.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #2
Source File: inception_resnet_v2_test.py    From RetinaNet_Tensorflow_Rotation with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #3
Source File: inception_resnet_v2_test.py    From RetinaNet_Tensorflow_Rotation with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #4
Source File: inception_resnet_v2_test.py    From RetinaNet_Tensorflow_Rotation with MIT License 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points) 
Example #5
Source File: inception_resnet_v2_test.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points.keys()) 
Example #6
Source File: inception_resnet_v2_test.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #7
Source File: inception_resnet_v2_test.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #8
Source File: inception_resnet_v2_test.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #9
Source File: inception_resnet_v2_test.py    From Creative-Adversarial-Networks with MIT License 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points) 
Example #10
Source File: inception_resnet_v2_test.py    From Creative-Adversarial-Networks with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #11
Source File: inception_resnet_v2_test.py    From Creative-Adversarial-Networks with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #12
Source File: inception_resnet_v2_test.py    From Creative-Adversarial-Networks with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #13
Source File: inception_resnet_v2_test.py    From CBAM-tensorflow-slim with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #14
Source File: inception_resnet_v2_test.py    From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #15
Source File: inception_resnet_v2_test.py    From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points) 
Example #16
Source File: inception_resnet_v2_test.py    From Hands-On-Machine-Learning-with-OpenCV-4 with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #17
Source File: inception_resnet_v2_test.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #18
Source File: inception_resnet_v2_test.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #19
Source File: inception_resnet_v2_test.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points) 
Example #20
Source File: inception_resnet_v2_test.py    From garbage-object-detection-tensorflow with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #21
Source File: inception_resnet_v2_test.py    From garbage-object-detection-tensorflow with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #22
Source File: inception_resnet_v2_test.py    From garbage-object-detection-tensorflow with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #23
Source File: inception_resnet_v2_test.py    From garbage-object-detection-tensorflow with MIT License 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points) 
Example #24
Source File: inception_resnet_v2_test.py    From edafa with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #25
Source File: inception_resnet_v2_test.py    From edafa with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #26
Source File: inception_resnet_v2_test.py    From edafa with MIT License 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #27
Source File: inception_resnet_v2_test.py    From edafa with MIT License 6 votes vote down vote up
def testBuildOnlyUptoFinalEndpoint(self):
    batch_size = 5
    height, width = 299, 299
    endpoints = ['Conv2d_1a_3x3', 'Conv2d_2a_3x3', 'Conv2d_2b_3x3',
                 'MaxPool_3a_3x3', 'Conv2d_3b_1x1', 'Conv2d_4a_3x3',
                 'MaxPool_5a_3x3', 'Mixed_5b', 'Mixed_6a',
                 'PreAuxLogits', 'Mixed_7a', 'Conv2d_7b_1x1']
    for index, endpoint in enumerate(endpoints):
      with tf.Graph().as_default():
        inputs = tf.random_uniform((batch_size, height, width, 3))
        out_tensor, end_points = inception.inception_resnet_v2_base(
            inputs, final_endpoint=endpoint)
        if endpoint != 'PreAuxLogits':
          self.assertTrue(out_tensor.op.name.startswith(
              'InceptionResnetV2/' + endpoint))
        self.assertItemsEqual(endpoints[:index+1], end_points.keys()) 
Example #28
Source File: inception_resnet_v2_test.py    From CVTron with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithOutputStrideEight(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', output_stride=8)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 33, 33, 1088],
                        'PreAuxLogits': [5, 33, 33, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #29
Source File: inception_resnet_v2_test.py    From CVTron with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogitsWithAlignedFeatureMaps(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits', align_feature_maps=True)
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 150, 150, 32],
                        'Conv2d_2a_3x3': [5, 150, 150, 32],
                        'Conv2d_2b_3x3': [5, 150, 150, 64],
                        'MaxPool_3a_3x3': [5, 75, 75, 64],
                        'Conv2d_3b_1x1': [5, 75, 75, 80],
                        'Conv2d_4a_3x3': [5, 75, 75, 192],
                        'MaxPool_5a_3x3': [5, 38, 38, 192],
                        'Mixed_5b': [5, 38, 38, 320],
                        'Mixed_6a': [5, 19, 19, 1088],
                        'PreAuxLogits': [5, 19, 19, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape) 
Example #30
Source File: inception_resnet_v2_test.py    From CVTron with Apache License 2.0 6 votes vote down vote up
def testBuildAndCheckAllEndPointsUptoPreAuxLogits(self):
    batch_size = 5
    height, width = 299, 299

    inputs = tf.random_uniform((batch_size, height, width, 3))
    _, end_points = inception.inception_resnet_v2_base(
        inputs, final_endpoint='PreAuxLogits')
    endpoints_shapes = {'Conv2d_1a_3x3': [5, 149, 149, 32],
                        'Conv2d_2a_3x3': [5, 147, 147, 32],
                        'Conv2d_2b_3x3': [5, 147, 147, 64],
                        'MaxPool_3a_3x3': [5, 73, 73, 64],
                        'Conv2d_3b_1x1': [5, 73, 73, 80],
                        'Conv2d_4a_3x3': [5, 71, 71, 192],
                        'MaxPool_5a_3x3': [5, 35, 35, 192],
                        'Mixed_5b': [5, 35, 35, 320],
                        'Mixed_6a': [5, 17, 17, 1088],
                        'PreAuxLogits': [5, 17, 17, 1088]
                       }

    self.assertItemsEqual(endpoints_shapes.keys(), end_points.keys())
    for endpoint_name in endpoints_shapes:
      expected_shape = endpoints_shapes[endpoint_name]
      self.assertTrue(endpoint_name in end_points)
      self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                           expected_shape)