当前位置: 首页>>代码示例>>Python>>正文


Python vgsl_model.InitNetwork方法代码示例

本文整理汇总了Python中vgsl_model.InitNetwork方法的典型用法代码示例。如果您正苦于以下问题:Python vgsl_model.InitNetwork方法的具体用法?Python vgsl_model.InitNetwork怎么用?Python vgsl_model.InitNetwork使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vgsl_model的用法示例。


在下文中一共展示了vgsl_model.InitNetwork方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testEndToEndSizes0d

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes0d(self):
    """Tests that the output sizes match when training/running real 0d data.

    Uses mnist with dual summarizing LSTMs to reduce to a single value.
    """
    filename = _testdata('mnist-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='4,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lfxs16]O0s12',
          mode='train')
      tf.global_variables_initializer().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 2)
      self.assertEqual(len(labels.shape), 1)
      self.assertEqual(output.shape[0], labels.shape[0])
      self.assertEqual(output.shape[1], 12)

  # TODO(rays) Support logistic and test with Imagenet (as 0d, multi-object.) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:25,代码来源:vgsl_model_test.py

示例2: testEndToEndSizes1dCTC

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes1dCTC(self):
    """Tests that the output sizes match when training with CTC.

    Basic bidi LSTM on top of convolution and summarizing LSTM with CTC.
    """
    filename = _testdata('arial-32-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='2,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lbx100]O1c105',
          mode='train')
      tf.global_variables_initializer().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 3)
      self.assertEqual(len(labels.shape), 2)
      self.assertEqual(output.shape[0], labels.shape[0])
      # This is ctc - the only cast-iron guarantee is labels <= output.
      self.assertLessEqual(labels.shape[1], output.shape[1])
      self.assertEqual(output.shape[2], 105) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:25,代码来源:vgsl_model_test.py

示例3: testEndToEndSizes1dFixed

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes1dFixed(self):
    """Tests that the output sizes match when training/running 1 data.

    Convolution, summarizing LSTM with fwd rev fwd to allow no CTC.
    """
    filename = _testdata('numbers-16-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='8,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lfx64 Lrx64 Lfx64]O1s12',
          mode='train')
      tf.global_variables_initializer().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 3)
      self.assertEqual(len(labels.shape), 2)
      self.assertEqual(output.shape[0], labels.shape[0])
      # Not CTC, output lengths match.
      self.assertEqual(output.shape[1], labels.shape[1])
      self.assertEqual(output.shape[2], 12)

  # TODO(rays) Get a 2-d dataset and support 2d (heat map) outputs. 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:27,代码来源:vgsl_model_test.py

示例4: testEndToEndSizes0d

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes0d(self):
    """Tests that the output sizes match when training/running real 0d data.

    Uses mnist with dual summarizing LSTMs to reduce to a single value.
    """
    filename = _testdata('mnist-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='4,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lfxs16]O0s12',
          mode='train')
      tf.initialize_all_variables().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 2)
      self.assertEqual(len(labels.shape), 1)
      self.assertEqual(output.shape[0], labels.shape[0])
      self.assertEqual(output.shape[1], 12)

  # TODO(rays) Support logistic and test with Imagenet (as 0d, multi-object.) 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:25,代码来源:vgsl_model_test.py

示例5: testEndToEndSizes1dCTC

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes1dCTC(self):
    """Tests that the output sizes match when training with CTC.

    Basic bidi LSTM on top of convolution and summarizing LSTM with CTC.
    """
    filename = _testdata('arial-32-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='2,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lbx100]O1c105',
          mode='train')
      tf.initialize_all_variables().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 3)
      self.assertEqual(len(labels.shape), 2)
      self.assertEqual(output.shape[0], labels.shape[0])
      # This is ctc - the only cast-iron guarantee is labels <= output.
      self.assertLessEqual(labels.shape[1], output.shape[1])
      self.assertEqual(output.shape[2], 105) 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:25,代码来源:vgsl_model_test.py

示例6: testEndToEndSizes1dFixed

# 需要导入模块: import vgsl_model [as 别名]
# 或者: from vgsl_model import InitNetwork [as 别名]
def testEndToEndSizes1dFixed(self):
    """Tests that the output sizes match when training/running 1 data.

    Convolution, summarizing LSTM with fwd rev fwd to allow no CTC.
    """
    filename = _testdata('numbers-16-tiny')
    with self.test_session() as sess:
      model = vgsl_model.InitNetwork(
          filename,
          model_spec='8,0,0,1[Cr5,5,16 Mp3,3 Lfys16 Lfx64 Lrx64 Lfx64]O1s12',
          mode='train')
      tf.initialize_all_variables().run(session=sess)
      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(sess=sess, coord=coord)
      _, step = model.TrainAStep(sess)
      self.assertEqual(step, 1)
      output, labels = model.RunAStep(sess)
      self.assertEqual(len(output.shape), 3)
      self.assertEqual(len(labels.shape), 2)
      self.assertEqual(output.shape[0], labels.shape[0])
      # Not CTC, output lengths match.
      self.assertEqual(output.shape[1], labels.shape[1])
      self.assertEqual(output.shape[2], 12)

  # TODO(rays) Get a 2-d dataset and support 2d (heat map) outputs. 
开发者ID:coderSkyChen,项目名称:Action_Recognition_Zoo,代码行数:27,代码来源:vgsl_model_test.py


注:本文中的vgsl_model.InitNetwork方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。