{"action":"created","comment":{"url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/comments/80663324","pull_request_review_id":1704890,"id":80663324,"diff_hunk":"@@ -0,0 +1,327 @@\n+# -*- coding: utf-8 -*-\n+\"\"\"\n+Created on Mon Sep 05 13:01:00 2016\n+\n+@author: yamane\n+\"\"\"\n+\n+import numpy as np\n+from chainer import cuda, optimizers, Chain, serializers\n+import chainer.functions as F\n+import chainer.links as L\n+import matplotlib.pyplot as plt\n+from skimage import color, io\n+import time\n+import copy\n+import tqdm\n+\n+\n+# ネットワークの定義\n+class Colorizationnet(Chain):\n+    def __init__(self):\n+        super(Colorizationnet, self).__init__(\n+            lconv1=L.Convolution2D(1, 32, 3, stride=2, pad=1),\n+            lnorm1=L.BatchNormalization(32),\n+            lconv2=L.Convolution2D(32, 64, 3, stride=1, pad=1),\n+            lnorm2=L.BatchNormalization(64),\n+            lconv3=L.Convolution2D(64, 64, 3, stride=2, pad=1),\n+            lnorm3=L.BatchNormalization(64),\n+            lconv4=L.Convolution2D(64, 128, 3, stride=1, pad=1),\n+            lnorm4=L.BatchNormalization(128),\n+            lconv5=L.Convolution2D(128, 128, 3, stride=2, pad=1),\n+            lnorm5=L.BatchNormalization(128),\n+            lconv6=L.Convolution2D(128, 256, 3, stride=1, pad=1),\n+            lnorm6=L.BatchNormalization(256),\n+\n+            gconv1=L.Convolution2D(256, 256, 3, stride=2, pad=1),\n+            gnorm1=L.BatchNormalization(256),\n+            gconv2=L.Convolution2D(256, 256, 3, stride=1, pad=1),\n+            gnorm2=L.BatchNormalization(256),\n+            gconv3=L.Convolution2D(256, 256, 3, stride=2, pad=1),\n+            gnorm3=L.BatchNormalization(256),\n+            gconv4=L.Convolution2D(256, 256, 3, stride=1, pad=1),\n+            gnorm4=L.BatchNormalization(256),\n+            gl1=L.Linear(1024, 512),\n+            gnorm5=L.BatchNormalization(512),\n+            gl2=L.Linear(512, 256),\n+            gnorm6=L.BatchNormalization(256),\n+            gl3=L.Linear(256, 128),\n+            gnorm7=L.BatchNormalization(128),\n+\n+            classl1=L.Linear(256, 256),\n+            classnorm1=L.BatchNormalization(256),\n+            classl2=L.Linear(256, 205),\n+\n+            mconv1=L.Convolution2D(256, 256, 3, stride=1, pad=1),\n+            mnorm1=L.BatchNormalization(256),\n+            mconv2=L.Convolution2D(256, 128, 3, stride=1, pad=1),\n+            mnorm2=L.BatchNormalization(128),\n+\n+            # num_features次元の重みをnum_classesクラス分用意する\n+            fusion=L.Convolution2D(256, 128, 1, stride=1),\n+            fnorm=L.BatchNormalization(128),\n+            cconv1=L.Convolution2D(128, 64, 3, stride=1, pad=1),\n+            cnorm1=L.BatchNormalization(64),\n+            cconv2=L.Convolution2D(64, 32, 3, stride=1, pad=1),\n+            cnorm2=L.BatchNormalization(32),\n+            cconv3=L.Convolution2D(32, 32, 3, stride=1, pad=1),\n+            cnorm3=L.BatchNormalization(32),\n+            cconv4=L.Convolution2D(32, 16, 3, stride=1, pad=1),\n+            cnorm4=L.BatchNormalization(16),\n+\n+            output=L.Convolution2D(16, 2, 3, stride=1, pad=1),\n+            onorm=L.BatchNormalization(2)\n+        )\n+\n+    def low_level_features_network(self, X, test):\n+        h = F.relu(self.lnorm1(self.lconv1(X), test=test))\n+        h = F.relu(self.lnorm2(self.lconv2(h), test=test))\n+        h = F.relu(self.lnorm3(self.lconv3(h), test=test))\n+        h = F.relu(self.lnorm4(self.lconv4(h), test=test))\n+        h = F.relu(self.lnorm5(self.lconv5(h), test=test))\n+        y = F.relu(self.lnorm6(self.lconv6(h), test=test))\n+        return y\n+\n+    def global_features_network(self, h, test):\n+        h = F.relu(self.gnorm1(self.gconv1(h), test=test))\n+        h = F.relu(self.gnorm2(self.gconv2(h), test=test))\n+        h = F.relu(self.gnorm3(self.gconv3(h), test=test))\n+        h = F.relu(self.gnorm4(self.gconv4(h), test=test))\n+        h = F.relu(self.gnorm5(self.gl1(h), test=test))\n+        h_global = F.relu(self.gnorm6(self.gl2(h), test=test))\n+        h_class = F.relu(self.classnorm1(self.classl1(h_global), test=test))\n+        y_class = self.classl2(h_class)\n+        y_global = F.relu(self.gnorm7(self.gl3(h_global), test=test))\n+        return y_global, y_class\n+\n+    def mid_level_features_network(self, h, test):\n+        h = F.relu(self.mnorm1(self.mconv1(h), test=test))\n+        y = F.relu(self.mnorm2(self.mconv2(h), test=test))\n+        return y\n+\n+    def colorization_network(self, h_local, h_global, test):\n+        h_global = F.reshape(h_global, (-1, 128, 1, 1))\n+        h_global = F.broadcast_to(h_global, h_local.data.shape)\n+        h = F.concat((h_local.data, h_global), axis=1)\n+        h = F.relu(self.fnorm(self.fusion(h), test=test))\n+        h = F.relu(self.cnorm1(self.cconv1(h), test=test))\n+        h = F.unpooling_2d(h, 2, outsize=[14, 14])\n+        h = F.relu(self.cnorm2(self.cconv2(h), test=test))\n+        h = F.relu(self.cnorm3(self.cconv3(h), test=test))\n+        h = F.unpooling_2d(h, 2, outsize=[28, 28])\n+        h = F.relu(self.cnorm4(self.cconv4(h), test=test))\n+        h = F.tanh(self.onorm(self.output(h), test=test))","path":"colorization_quarter_v1.py","position":113,"original_position":113,"commit_id":"437b04b89d56c8bed852d32504fdb950c52f8cd3","original_commit_id":"437b04b89d56c8bed852d32504fdb950c52f8cd3","user":{"login":"ronekko","id":142082,"avatar_url":"https://avatars.githubusercontent.com/u/142082?v=3","gravatar_id":"","url":"https://api.github.com/users/ronekko","html_url":"https://github.com/ronekko","followers_url":"https://api.github.com/users/ronekko/followers","following_url":"https://api.github.com/users/ronekko/following{/other_user}","gists_url":"https://api.github.com/users/ronekko/gists{/gist_id}","starred_url":"https://api.github.com/users/ronekko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronekko/subscriptions","organizations_url":"https://api.github.com/users/ronekko/orgs","repos_url":"https://api.github.com/users/ronekko/repos","events_url":"https://api.github.com/users/ronekko/events{/privacy}","received_events_url":"https://api.github.com/users/ronekko/received_events","type":"User","site_admin":false},"body":"BNには正規化後に再スケーリングがあるから大丈夫かもしれないです．","created_at":"2016-09-27T10:34:30Z","updated_at":"2016-09-27T10:34:30Z","html_url":"https://github.com/YamaneSasuke/colorization/pull/2#discussion_r80663324","pull_request_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/comments/80663324"},"html":{"href":"https://github.com/YamaneSasuke/colorization/pull/2#discussion_r80663324"},"pull_request":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2","id":84789137,"html_url":"https://github.com/YamaneSasuke/colorization/pull/2","diff_url":"https://github.com/YamaneSasuke/colorization/pull/2.diff","patch_url":"https://github.com/YamaneSasuke/colorization/pull/2.patch","issue_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/2","number":2,"state":"open","locked":false,"title":"[WIP]画像サイズが56*56verを作成する","user":{"login":"YamaneSasuke","id":18733265,"avatar_url":"https://avatars.githubusercontent.com/u/18733265?v=3","gravatar_id":"","url":"https://api.github.com/users/YamaneSasuke","html_url":"https://github.com/YamaneSasuke","followers_url":"https://api.github.com/users/YamaneSasuke/followers","following_url":"https://api.github.com/users/YamaneSasuke/following{/other_user}","gists_url":"https://api.github.com/users/YamaneSasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/YamaneSasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YamaneSasuke/subscriptions","organizations_url":"https://api.github.com/users/YamaneSasuke/orgs","repos_url":"https://api.github.com/users/YamaneSasuke/repos","events_url":"https://api.github.com/users/YamaneSasuke/events{/privacy}","received_events_url":"https://api.github.com/users/YamaneSasuke/received_events","type":"User","site_admin":false},"body":"計算時間を短縮するため問題の規模を小さくする。\r\n画像サイズを224*224ではなく56*56にする。","created_at":"2016-09-11T15:17:09Z","updated_at":"2016-09-27T10:34:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"368c4e5adc3c5373d20cddcfe256dae7bb65e29a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2/commits","review_comments_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2/comments","review_comment_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/comments{/number}","comments_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/2/comments","statuses_url":"https://api.github.com/repos/YamaneSasuke/colorization/statuses/437b04b89d56c8bed852d32504fdb950c52f8cd3","head":{"label":"YamaneSasuke:colorization_quarter","ref":"colorization_quarter","sha":"437b04b89d56c8bed852d32504fdb950c52f8cd3","user":{"login":"YamaneSasuke","id":18733265,"avatar_url":"https://avatars.githubusercontent.com/u/18733265?v=3","gravatar_id":"","url":"https://api.github.com/users/YamaneSasuke","html_url":"https://github.com/YamaneSasuke","followers_url":"https://api.github.com/users/YamaneSasuke/followers","following_url":"https://api.github.com/users/YamaneSasuke/following{/other_user}","gists_url":"https://api.github.com/users/YamaneSasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/YamaneSasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YamaneSasuke/subscriptions","organizations_url":"https://api.github.com/users/YamaneSasuke/orgs","repos_url":"https://api.github.com/users/YamaneSasuke/repos","events_url":"https://api.github.com/users/YamaneSasuke/events{/privacy}","received_events_url":"https://api.github.com/users/YamaneSasuke/received_events","type":"User","site_admin":false},"repo":{"id":66923124,"name":"colorization","full_name":"YamaneSasuke/colorization","owner":{"login":"YamaneSasuke","id":18733265,"avatar_url":"https://avatars.githubusercontent.com/u/18733265?v=3","gravatar_id":"","url":"https://api.github.com/users/YamaneSasuke","html_url":"https://github.com/YamaneSasuke","followers_url":"https://api.github.com/users/YamaneSasuke/followers","following_url":"https://api.github.com/users/YamaneSasuke/following{/other_user}","gists_url":"https://api.github.com/users/YamaneSasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/YamaneSasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YamaneSasuke/subscriptions","organizations_url":"https://api.github.com/users/YamaneSasuke/orgs","repos_url":"https://api.github.com/users/YamaneSasuke/repos","events_url":"https://api.github.com/users/YamaneSasuke/events{/privacy}","received_events_url":"https://api.github.com/users/YamaneSasuke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/YamaneSasuke/colorization","description":null,"fork":false,"url":"https://api.github.com/repos/YamaneSasuke/colorization","forks_url":"https://api.github.com/repos/YamaneSasuke/colorization/forks","keys_url":"https://api.github.com/repos/YamaneSasuke/colorization/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YamaneSasuke/colorization/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YamaneSasuke/colorization/teams","hooks_url":"https://api.github.com/repos/YamaneSasuke/colorization/hooks","issue_events_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/events{/number}","events_url":"https://api.github.com/repos/YamaneSasuke/colorization/events","assignees_url":"https://api.github.com/repos/YamaneSasuke/colorization/assignees{/user}","branches_url":"https://api.github.com/repos/YamaneSasuke/colorization/branches{/branch}","tags_url":"https://api.github.com/repos/YamaneSasuke/colorization/tags","blobs_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/refs{/sha}","trees_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YamaneSasuke/colorization/statuses/{sha}","languages_url":"https://api.github.com/repos/YamaneSasuke/colorization/languages","stargazers_url":"https://api.github.com/repos/YamaneSasuke/colorization/stargazers","contributors_url":"https://api.github.com/repos/YamaneSasuke/colorization/contributors","subscribers_url":"https://api.github.com/repos/YamaneSasuke/colorization/subscribers","subscription_url":"https://api.github.com/repos/YamaneSasuke/colorization/subscription","commits_url":"https://api.github.com/repos/YamaneSasuke/colorization/commits{/sha}","git_commits_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/commits{/sha}","comments_url":"https://api.github.com/repos/YamaneSasuke/colorization/comments{/number}","issue_comment_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/comments{/number}","contents_url":"https://api.github.com/repos/YamaneSasuke/colorization/contents/{+path}","compare_url":"https://api.github.com/repos/YamaneSasuke/colorization/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YamaneSasuke/colorization/merges","archive_url":"https://api.github.com/repos/YamaneSasuke/colorization/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YamaneSasuke/colorization/downloads","issues_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues{/number}","pulls_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls{/number}","milestones_url":"https://api.github.com/repos/YamaneSasuke/colorization/milestones{/number}","notifications_url":"https://api.github.com/repos/YamaneSasuke/colorization/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YamaneSasuke/colorization/labels{/name}","releases_url":"https://api.github.com/repos/YamaneSasuke/colorization/releases{/id}","deployments_url":"https://api.github.com/repos/YamaneSasuke/colorization/deployments","created_at":"2016-08-30T08:45:42Z","updated_at":"2016-08-30T08:50:58Z","pushed_at":"2016-09-27T10:09:01Z","git_url":"git://github.com/YamaneSasuke/colorization.git","ssh_url":"git@github.com:YamaneSasuke/colorization.git","clone_url":"https://github.com/YamaneSasuke/colorization.git","svn_url":"https://github.com/YamaneSasuke/colorization","homepage":null,"size":42,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"YamaneSasuke:master","ref":"master","sha":"3a2b526a4cffd00d0be7faa5b4ac30ca8f5c679a","user":{"login":"YamaneSasuke","id":18733265,"avatar_url":"https://avatars.githubusercontent.com/u/18733265?v=3","gravatar_id":"","url":"https://api.github.com/users/YamaneSasuke","html_url":"https://github.com/YamaneSasuke","followers_url":"https://api.github.com/users/YamaneSasuke/followers","following_url":"https://api.github.com/users/YamaneSasuke/following{/other_user}","gists_url":"https://api.github.com/users/YamaneSasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/YamaneSasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YamaneSasuke/subscriptions","organizations_url":"https://api.github.com/users/YamaneSasuke/orgs","repos_url":"https://api.github.com/users/YamaneSasuke/repos","events_url":"https://api.github.com/users/YamaneSasuke/events{/privacy}","received_events_url":"https://api.github.com/users/YamaneSasuke/received_events","type":"User","site_admin":false},"repo":{"id":66923124,"name":"colorization","full_name":"YamaneSasuke/colorization","owner":{"login":"YamaneSasuke","id":18733265,"avatar_url":"https://avatars.githubusercontent.com/u/18733265?v=3","gravatar_id":"","url":"https://api.github.com/users/YamaneSasuke","html_url":"https://github.com/YamaneSasuke","followers_url":"https://api.github.com/users/YamaneSasuke/followers","following_url":"https://api.github.com/users/YamaneSasuke/following{/other_user}","gists_url":"https://api.github.com/users/YamaneSasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/YamaneSasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YamaneSasuke/subscriptions","organizations_url":"https://api.github.com/users/YamaneSasuke/orgs","repos_url":"https://api.github.com/users/YamaneSasuke/repos","events_url":"https://api.github.com/users/YamaneSasuke/events{/privacy}","received_events_url":"https://api.github.com/users/YamaneSasuke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/YamaneSasuke/colorization","description":null,"fork":false,"url":"https://api.github.com/repos/YamaneSasuke/colorization","forks_url":"https://api.github.com/repos/YamaneSasuke/colorization/forks","keys_url":"https://api.github.com/repos/YamaneSasuke/colorization/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YamaneSasuke/colorization/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YamaneSasuke/colorization/teams","hooks_url":"https://api.github.com/repos/YamaneSasuke/colorization/hooks","issue_events_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/events{/number}","events_url":"https://api.github.com/repos/YamaneSasuke/colorization/events","assignees_url":"https://api.github.com/repos/YamaneSasuke/colorization/assignees{/user}","branches_url":"https://api.github.com/repos/YamaneSasuke/colorization/branches{/branch}","tags_url":"https://api.github.com/repos/YamaneSasuke/colorization/tags","blobs_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/refs{/sha}","trees_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YamaneSasuke/colorization/statuses/{sha}","languages_url":"https://api.github.com/repos/YamaneSasuke/colorization/languages","stargazers_url":"https://api.github.com/repos/YamaneSasuke/colorization/stargazers","contributors_url":"https://api.github.com/repos/YamaneSasuke/colorization/contributors","subscribers_url":"https://api.github.com/repos/YamaneSasuke/colorization/subscribers","subscription_url":"https://api.github.com/repos/YamaneSasuke/colorization/subscription","commits_url":"https://api.github.com/repos/YamaneSasuke/colorization/commits{/sha}","git_commits_url":"https://api.github.com/repos/YamaneSasuke/colorization/git/commits{/sha}","comments_url":"https://api.github.com/repos/YamaneSasuke/colorization/comments{/number}","issue_comment_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues/comments{/number}","contents_url":"https://api.github.com/repos/YamaneSasuke/colorization/contents/{+path}","compare_url":"https://api.github.com/repos/YamaneSasuke/colorization/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YamaneSasuke/colorization/merges","archive_url":"https://api.github.com/repos/YamaneSasuke/colorization/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YamaneSasuke/colorization/downloads","issues_url":"https://api.github.com/repos/YamaneSasuke/colorization/issues{/number}","pulls_url":"https://api.github.com/repos/YamaneSasuke/colorization/pulls{/number}","milestones_url":"https://api.github.com/repos/YamaneSasuke/colorization/milestones{/number}","notifications_url":"https://api.github.com/repos/YamaneSasuke/colorization/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YamaneSasuke/colorization/labels{/name}","releases_url":"https://api.github.com/repos/YamaneSasuke/colorization/releases{/id}","deployments_url":"https://api.github.com/repos/YamaneSasuke/colorization/deployments","created_at":"2016-08-30T08:45:42Z","updated_at":"2016-08-30T08:50:58Z","pushed_at":"2016-09-27T10:09:01Z","git_url":"git://github.com/YamaneSasuke/colorization.git","ssh_url":"git@github.com:YamaneSasuke/colorization.git","clone_url":"https://github.com/YamaneSasuke/colorization.git","svn_url":"https://github.com/YamaneSasuke/colorization","homepage":null,"size":42,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2"},"html":{"href":"https://github.com/YamaneSasuke/colorization/pull/2"},"issue":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/issues/2"},"comments":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/YamaneSasuke/colorization/statuses/437b04b89d56c8bed852d32504fdb950c52f8cd3"}}}}
{"actor":{"display_login":"ronekko"}}