Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 217FE200B73 for ; Mon, 29 Aug 2016 16:53:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2040D160AB8; Mon, 29 Aug 2016 14:53:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6E0C1160A89 for ; Mon, 29 Aug 2016 16:53:03 +0200 (CEST) Received: (qmail 84666 invoked by uid 500); 29 Aug 2016 14:53:02 -0000 Mailing-List: contact commits-help@singa.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.incubator.apache.org Delivered-To: mailing list commits@singa.incubator.apache.org Received: (qmail 84657 invoked by uid 99); 29 Aug 2016 14:53:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2016 14:53:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 3E13AC031E for ; Mon, 29 Aug 2016 14:53:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id wj5z9wqCnO7j for ; Mon, 29 Aug 2016 14:53:01 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id C92435FB59 for ; Mon, 29 Aug 2016 14:53:00 +0000 (UTC) Received: (qmail 84595 invoked by uid 99); 29 Aug 2016 14:53:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2016 14:53:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 088E1E0209; Mon, 29 Aug 2016 14:53:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zhaojing@apache.org To: commits@singa.incubator.apache.org Date: Mon, 29 Aug 2016 14:53:00 -0000 Message-Id: <0ccc572d9d1e423abb638be60c50c5a9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-singa git commit: SINGA-241 Fix bugs in Imagenet example archived-at: Mon, 29 Aug 2016 14:53:04 -0000 Repository: incubator-singa Updated Branches: refs/heads/master 9b9dc10cb -> 65bf582c0 SINGA-241 Fix bugs in Imagenet example Remove the fixed numbers of training and test images. Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/68278c44 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/68278c44 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/68278c44 Branch: refs/heads/master Commit: 68278c442a2c727aadd2c05e6931939c2244e29a Parents: f9c6d5c Author: Xiangrui Authored: Thu Aug 18 16:28:17 2016 +0800 Committer: Xiangrui Committed: Thu Aug 18 16:28:17 2016 +0800 ---------------------------------------------------------------------- examples/imagenet/ilsvrc12.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/68278c44/examples/imagenet/ilsvrc12.h ---------------------------------------------------------------------- diff --git a/examples/imagenet/ilsvrc12.h b/examples/imagenet/ilsvrc12.h index a6d4238..74fffbb 100644 --- a/examples/imagenet/ilsvrc12.h +++ b/examples/imagenet/ilsvrc12.h @@ -83,12 +83,13 @@ class ILSVRC { /// n_read: number of images which are read size_t LoadData(int flag, string file, size_t read_size, Tensor *x, Tensor *y, size_t *n_read, int nthreads); - + /// A wrapper method to spawn a thread to execute LoadData() method. std::thread AsyncLoadData(int flag, string file, size_t read_size, Tensor *x, Tensor *y, size_t *n_read, int nthreads); void DecodeTransform(int flag, int thid, int nthreads, vector images, Tensor *x, Tensor *y); + /// A wrapper method to spawn a thread to execute Decodetransform() method. std::thread AsyncDecodeTransform(int flag, int thid, int nthreads, vector images, Tensor *x, Tensor *y); @@ -191,9 +192,7 @@ void ILSVRC::CreateTrainData(string image_list, string input_folder, std::default_random_engine()); LOG(INFO) << "Total number of training images is " << file_list.size(); size_t num_train_images = file_list.size(); - num_train_images = 12900; if (file_size == 0) file_size = num_train_images; - // todo: accelerate with omp for (size_t imageid = 0; imageid < num_train_images; imageid++) { string path = input_folder + "/" + file_list[imageid].first; Tensor image = ReadImage(path); @@ -206,7 +205,6 @@ void ILSVRC::CreateTrainData(string image_list, string input_folder, std::vector input; input.push_back(image); input.push_back(lb); - // LOG(INFO) << path << "\t" << label; string encoded_str = encoder->Encode(input); if (writer == nullptr) { writer = new BinFileWriter(); @@ -257,7 +255,6 @@ void ILSVRC::CreateTestData(string image_list, string input_folder, file_list.push_back(std::make_pair(image_file_name, label)); LOG(INFO) << "Total number of test images is " << file_list.size(); size_t num_test_images = file_list.size(); - num_test_images = 500; for (size_t imageid = 0; imageid < num_test_images; imageid++) { string path = input_folder + "/" + file_list[imageid].first; Tensor image = ReadImage(path); @@ -292,7 +289,7 @@ void ILSVRC::ReadMean(string path) { bfreader.Close(); mean = ret[0]; } -/// A wrapper method to spawn a thread to execute LoadData() method. + std::thread ILSVRC::AsyncLoadData(int flag, string file, size_t read_size, Tensor *x, Tensor *y, size_t *n_read, int nthreads) { @@ -344,7 +341,6 @@ size_t ILSVRC::LoadData(int flag, string file, size_t read_size, Tensor *x, return nimg; } -/// A wrapper method to spawn a thread to execute Decodetransform() method. std::thread ILSVRC::AsyncDecodeTransform(int flag, int thid, int nthreads, vector images, Tensor *x, Tensor *y) {