{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-singa/pulls/comments/69403153","id":69403153,"diff_hunk":"@@ -0,0 +1,119 @@\n+/************************************************************\n+*\n+* Licensed to the Apache Software Foundation (ASF) under one\n+* or more contributor license agreements.  See the NOTICE file\n+* distributed with this work for additional information\n+* regarding copyright ownership.  The ASF licenses this file\n+* to you under the Apache License, Version 2.0 (the\n+* \"License\"); you may not use this file except in compliance\n+* with the License.  You may obtain a copy of the License at\n+*\n+*   http://www.apache.org/licenses/LICENSE-2.0\n+*\n+* Unless required by applicable law or agreed to in writing,\n+* software distributed under the License is distributed on an\n+* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+* KIND, either express or implied.  See the License for the\n+* specific language governing permissions and limitations\n+* under the License.\n+*\n+*************************************************************/\n+\n+#include \"singa/io/transformer.h\"\n+#include \"gtest/gtest.h\"\n+#include <time.h>\n+#include <iostream>\n+\n+// decide whether to use opencv\n+// #include \"singa/singa_config.h\"\n+\n+#ifdef USE_OPENCV\n+#include <opencv2/highhui/highhui.hpp>\n+#include <opencv2/imgproc/imgproc.hpp>\n+#endif\n+\n+using singa::Shape;\n+TEST(ImageTransformer, Setup) {\n+  singa::ImageTransformer img_transformer;\n+\n+  singa::TransformerConf conf;\n+  conf.set_resize_height(256);\n+  conf.set_resize_width(256);\n+  conf.set_horizontal_mirror(true);\n+  conf.set_image_dim_order(\"NHWC\");\n+  conf.add_crop_shape(224u);\n+  conf.add_crop_shape(200u);\n+\n+  img_transformer.Setup(conf);\n+  EXPECT_EQ(256, img_transformer.Resize_height());\n+  EXPECT_EQ(256, img_transformer.Resize_width());\n+  EXPECT_EQ(true, img_transformer.Horizontal_mirror());\n+  EXPECT_EQ(\"NHWC\", img_transformer.Image_dim_order());\n+  EXPECT_EQ(224u, img_transformer.Crop_shape()[0]);\n+  EXPECT_EQ(200u, img_transformer.Crop_shape()[1]);\n+}\n+\n+TEST(ImageTransformer, Apply) {","path":"test/singa/test_image_transformer.cc","position":56,"original_position":56,"commit_id":"9c4b3abb5a10d90776748badc5aa8bd62620e8eb","original_commit_id":"9c4b3abb5a10d90776748badc5aa8bd62620e8eb","user":{"login":"dbxinj","id":13883280,"avatar_url":"https://avatars.githubusercontent.com/u/13883280?v=3","gravatar_id":"","url":"https://api.github.com/users/dbxinj","html_url":"https://github.com/dbxinj","followers_url":"https://api.github.com/users/dbxinj/followers","following_url":"https://api.github.com/users/dbxinj/following{/other_user}","gists_url":"https://api.github.com/users/dbxinj/gists{/gist_id}","starred_url":"https://api.github.com/users/dbxinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbxinj/subscriptions","organizations_url":"https://api.github.com/users/dbxinj/orgs","repos_url":"https://api.github.com/users/dbxinj/repos","events_url":"https://api.github.com/users/dbxinj/events{/privacy}","received_events_url":"https://api.github.com/users/dbxinj/received_events","type":"User","site_admin":false},"body":"randomness exists also in crop in kTrain phase.\r\nso, can only test resize in kTrain","created_at":"2016-07-04T02:34:09Z","updated_at":"2016-07-04T02:34:09Z","html_url":"https://github.com/apache/incubator-singa/pull/194#discussion_r69403153","pull_request_url":"https://api.github.com/repos/apache/incubator-singa/pulls/194","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/comments/69403153"},"html":{"href":"https://github.com/apache/incubator-singa/pull/194#discussion_r69403153"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/194"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-singa/pulls/194","id":75996446,"html_url":"https://github.com/apache/incubator-singa/pull/194","diff_url":"https://github.com/apache/incubator-singa/pull/194.diff","patch_url":"https://github.com/apache/incubator-singa/pull/194.patch","issue_url":"https://api.github.com/repos/apache/incubator-singa/issues/194","number":194,"state":"open","locked":false,"title":"SINGA-215 Implement Image Transformation for Image Pre-processing","user":{"login":"dbxinj","id":13883280,"avatar_url":"https://avatars.githubusercontent.com/u/13883280?v=3","gravatar_id":"","url":"https://api.github.com/users/dbxinj","html_url":"https://github.com/dbxinj","followers_url":"https://api.github.com/users/dbxinj/followers","following_url":"https://api.github.com/users/dbxinj/following{/other_user}","gists_url":"https://api.github.com/users/dbxinj/gists{/gist_id}","starred_url":"https://api.github.com/users/dbxinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbxinj/subscriptions","organizations_url":"https://api.github.com/users/dbxinj/orgs","repos_url":"https://api.github.com/users/dbxinj/repos","events_url":"https://api.github.com/users/dbxinj/events{/privacy}","received_events_url":"https://api.github.com/users/dbxinj/received_events","type":"User","site_admin":false},"body":"Implement some of the image transformations (i.e., crop, resize, horizontal_mirror) for pre-processing stage.\r\n\r\nImage resize need to use opencv library.\r\n\r\nCurrently image transformation only support one sample input each time.\r\n\r\nPass all tests.","created_at":"2016-07-01T15:22:42Z","updated_at":"2016-07-04T02:34:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca57cbaa00feda74702c74e7bccc9a4b3ba969b5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-singa/pulls/194/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-singa/pulls/194/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-singa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-singa/issues/194/comments","statuses_url":"https://api.github.com/repos/apache/incubator-singa/statuses/9c4b3abb5a10d90776748badc5aa8bd62620e8eb","head":{"label":"dbxinj:SINGA-215","ref":"SINGA-215","sha":"9c4b3abb5a10d90776748badc5aa8bd62620e8eb","user":{"login":"dbxinj","id":13883280,"avatar_url":"https://avatars.githubusercontent.com/u/13883280?v=3","gravatar_id":"","url":"https://api.github.com/users/dbxinj","html_url":"https://github.com/dbxinj","followers_url":"https://api.github.com/users/dbxinj/followers","following_url":"https://api.github.com/users/dbxinj/following{/other_user}","gists_url":"https://api.github.com/users/dbxinj/gists{/gist_id}","starred_url":"https://api.github.com/users/dbxinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbxinj/subscriptions","organizations_url":"https://api.github.com/users/dbxinj/orgs","repos_url":"https://api.github.com/users/dbxinj/repos","events_url":"https://api.github.com/users/dbxinj/events{/privacy}","received_events_url":"https://api.github.com/users/dbxinj/received_events","type":"User","site_admin":false},"repo":{"id":60352000,"name":"incubator-singa","full_name":"dbxinj/incubator-singa","owner":{"login":"dbxinj","id":13883280,"avatar_url":"https://avatars.githubusercontent.com/u/13883280?v=3","gravatar_id":"","url":"https://api.github.com/users/dbxinj","html_url":"https://github.com/dbxinj","followers_url":"https://api.github.com/users/dbxinj/followers","following_url":"https://api.github.com/users/dbxinj/following{/other_user}","gists_url":"https://api.github.com/users/dbxinj/gists{/gist_id}","starred_url":"https://api.github.com/users/dbxinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbxinj/subscriptions","organizations_url":"https://api.github.com/users/dbxinj/orgs","repos_url":"https://api.github.com/users/dbxinj/repos","events_url":"https://api.github.com/users/dbxinj/events{/privacy}","received_events_url":"https://api.github.com/users/dbxinj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dbxinj/incubator-singa","description":"Mirror of Apache Singa (Incubating)","fork":true,"url":"https://api.github.com/repos/dbxinj/incubator-singa","forks_url":"https://api.github.com/repos/dbxinj/incubator-singa/forks","keys_url":"https://api.github.com/repos/dbxinj/incubator-singa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dbxinj/incubator-singa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dbxinj/incubator-singa/teams","hooks_url":"https://api.github.com/repos/dbxinj/incubator-singa/hooks","issue_events_url":"https://api.github.com/repos/dbxinj/incubator-singa/issues/events{/number}","events_url":"https://api.github.com/repos/dbxinj/incubator-singa/events","assignees_url":"https://api.github.com/repos/dbxinj/incubator-singa/assignees{/user}","branches_url":"https://api.github.com/repos/dbxinj/incubator-singa/branches{/branch}","tags_url":"https://api.github.com/repos/dbxinj/incubator-singa/tags","blobs_url":"https://api.github.com/repos/dbxinj/incubator-singa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dbxinj/incubator-singa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dbxinj/incubator-singa/git/refs{/sha}","trees_url":"https://api.github.com/repos/dbxinj/incubator-singa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dbxinj/incubator-singa/statuses/{sha}","languages_url":"https://api.github.com/repos/dbxinj/incubator-singa/languages","stargazers_url":"https://api.github.com/repos/dbxinj/incubator-singa/stargazers","contributors_url":"https://api.github.com/repos/dbxinj/incubator-singa/contributors","subscribers_url":"https://api.github.com/repos/dbxinj/incubator-singa/subscribers","subscription_url":"https://api.github.com/repos/dbxinj/incubator-singa/subscription","commits_url":"https://api.github.com/repos/dbxinj/incubator-singa/commits{/sha}","git_commits_url":"https://api.github.com/repos/dbxinj/incubator-singa/git/commits{/sha}","comments_url":"https://api.github.com/repos/dbxinj/incubator-singa/comments{/number}","issue_comment_url":"https://api.github.com/repos/dbxinj/incubator-singa/issues/comments{/number}","contents_url":"https://api.github.com/repos/dbxinj/incubator-singa/contents/{+path}","compare_url":"https://api.github.com/repos/dbxinj/incubator-singa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dbxinj/incubator-singa/merges","archive_url":"https://api.github.com/repos/dbxinj/incubator-singa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dbxinj/incubator-singa/downloads","issues_url":"https://api.github.com/repos/dbxinj/incubator-singa/issues{/number}","pulls_url":"https://api.github.com/repos/dbxinj/incubator-singa/pulls{/number}","milestones_url":"https://api.github.com/repos/dbxinj/incubator-singa/milestones{/number}","notifications_url":"https://api.github.com/repos/dbxinj/incubator-singa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dbxinj/incubator-singa/labels{/name}","releases_url":"https://api.github.com/repos/dbxinj/incubator-singa/releases{/id}","deployments_url":"https://api.github.com/repos/dbxinj/incubator-singa/deployments","created_at":"2016-06-03T14:01:05Z","updated_at":"2016-06-03T14:01:07Z","pushed_at":"2016-07-02T15:52:38Z","git_url":"git://github.com/dbxinj/incubator-singa.git","ssh_url":"git@github.com:dbxinj/incubator-singa.git","clone_url":"https://github.com/dbxinj/incubator-singa.git","svn_url":"https://github.com/dbxinj/incubator-singa","homepage":null,"size":3847,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:dev","ref":"dev","sha":"dc013f34fa1c5cb647290ce185b3c2d6e43dcfe0","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":33294317,"name":"incubator-singa","full_name":"apache/incubator-singa","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-singa","description":"Mirror of Apache Singa (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-singa","forks_url":"https://api.github.com/repos/apache/incubator-singa/forks","keys_url":"https://api.github.com/repos/apache/incubator-singa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-singa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-singa/teams","hooks_url":"https://api.github.com/repos/apache/incubator-singa/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-singa/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-singa/events","assignees_url":"https://api.github.com/repos/apache/incubator-singa/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-singa/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-singa/tags","blobs_url":"https://api.github.com/repos/apache/incubator-singa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-singa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-singa/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-singa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-singa/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-singa/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-singa/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-singa/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-singa/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-singa/subscription","commits_url":"https://api.github.com/repos/apache/incubator-singa/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-singa/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-singa/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-singa/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-singa/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-singa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-singa/merges","archive_url":"https://api.github.com/repos/apache/incubator-singa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-singa/downloads","issues_url":"https://api.github.com/repos/apache/incubator-singa/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-singa/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-singa/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-singa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-singa/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-singa/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-singa/deployments","created_at":"2015-04-02T07:00:05Z","updated_at":"2016-07-03T19:38:06Z","pushed_at":"2016-07-03T15:29:42Z","git_url":"git://github.com/apache/incubator-singa.git","ssh_url":"git@github.com:apache/incubator-singa.git","clone_url":"https://github.com/apache/incubator-singa.git","svn_url":"https://github.com/apache/incubator-singa","homepage":null,"size":4417,"stargazers_count":608,"watchers_count":608,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":211,"mirror_url":"git://git.apache.org/incubator-singa.git","open_issues_count":15,"forks":211,"open_issues":15,"watchers":608,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/194"},"html":{"href":"https://github.com/apache/incubator-singa/pull/194"},"issue":{"href":"https://api.github.com/repos/apache/incubator-singa/issues/194"},"comments":{"href":"https://api.github.com/repos/apache/incubator-singa/issues/194/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/194/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-singa/pulls/194/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-singa/statuses/9c4b3abb5a10d90776748badc5aa8bd62620e8eb"}}}}
{"actor":{"display_login":"dbxinj"}}