本文整理匯總了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.)
示例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)
示例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.
示例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.)
示例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)
示例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.