You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by zh...@apache.org on 2016/10/05 14:14:24 UTC
[2/2] incubator-singa git commit: SINGA-251 - Implement image loader
for pysinga
SINGA-251 - Implement image loader for pysinga
Add ImageBatchIter in data.py, which prefetches images into mini-batches
and pre-processes images using user defined transform function.
The process is done in another process via multiprocessing
fixed a bug in merge layer which should replicate the gradients in the returned values
To test this feature,
please prepare a train.txt file which consists of multiple lines, where each line is , e.g.
image1.jpg, 0
image2.jpg, 3
image3.jpg, 1
...
The folder should be like
SINGA ROOT/
train.txt
images/
image1.jpg
image2.jpg
...
Then you can run python python/singa/data.py (under the root dir of singa).
After that, you should see a list of images which are transformed from the images in images/ folder.
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/17ac1602
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/17ac1602
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/17ac1602
Branch: refs/heads/master
Commit: 17ac160258093973602eda883562b39069504fc8
Parents: 064f3fb
Author: zhaojing <zh...@comp.nus.edu.sg>
Authored: Wed Oct 5 22:10:20 2016 +0800
Committer: zhaojing <zh...@comp.nus.edu.sg>
Committed: Wed Oct 5 22:10:20 2016 +0800
----------------------------------------------------------------------
python/singa/data.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/17ac1602/python/singa/data.py
----------------------------------------------------------------------
diff --git a/python/singa/data.py b/python/singa/data.py
index db0776e..725b175 100644
--- a/python/singa/data.py
+++ b/python/singa/data.py
@@ -125,6 +125,7 @@ if __name__ == '__main__':
image_transform, shuffle=True, delimeter=',',
image_folder='images/',
capacity=10)
+ data.start()
imgs, labels = data.next()
for idx in range(imgs.shape[0]):
img = Image.fromarray(imgs[idx].astype(np.uint8).transpose(1, 2, 0),