mnist network generation
authorYangqing Jia <jiayq84@gmail.com>
Mon, 30 Sep 2013 21:10:04 +0000 (14:10 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Mon, 30 Sep 2013 21:10:04 +0000 (14:10 -0700)
src/caffe/test/data/mnist.py

index d478dc7999384ff73143230f6fe3f6c44467b7b5..02ae7f572a2586c0a5b5a31686a5d27eb440248b 100644 (file)
@@ -17,4 +17,14 @@ for i in range(60000):
   datum = convert.array_to_datum((mnist._data[i] * 255).reshape(1,28,28).astype(np.uint8))
   datum.label = mnist._label[i]
   db.Put('%d' % (i), datum.SerializeToString())
-del db
\ No newline at end of file
+del db
+
+mnist = core_layers.MNISTDataLayer(
+    rootfolder=MNIST_ROOT, name='mnist', is_training = False)
+db = leveldb.LevelDB('mnist-test-leveldb')
+
+for i in range(10000):
+  datum = convert.array_to_datum((mnist._data[i] * 255).reshape(1,28,28).astype(np.uint8))
+  datum.label = mnist._label[i]
+  db.Put('%d' % (i), datum.SerializeToString())
+del db