{"action":"created","comment":{"url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/comments/125717499","pull_request_review_id":48134245,"id":125717499,"diff_hunk":"@@ -0,0 +1,111 @@\n+# Copyright 2017 Databricks, Inc.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# 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, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+\n+from abc import ABCMeta, abstractmethod\n+\n+import keras.backend as K\n+from keras.applications import inception_v3, resnet50, vgg16, vgg19, xception\n+from keras.applications.imagenet_utils import decode_predictions\n+import tensorflow as tf\n+\n+from sparkdl.transformers.utils import (imageInputPlaceholder, InceptionV3Constants)\n+\n+\n+KERAS_APPLICATION_MODELS = set([\"InceptionV3\"]) #, \"ResNet50\", \"Xception\", \"VGG16\", \"VGG19\"])\n+\n+\n+\"\"\"\n+Essentially a factory function for getting the correct KerasApplicationModelSession class","path":"python/sparkdl/transformers/keras_applications.py","position":30,"original_position":30,"commit_id":"c6740117c38be0134616724511f757c4daa1d5d8","original_commit_id":"c6740117c38be0134616724511f757c4daa1d5d8","user":{"login":"phi-dbq","id":28275034,"avatar_url":"https://avatars3.githubusercontent.com/u/28275034?v=3","gravatar_id":"","url":"https://api.github.com/users/phi-dbq","html_url":"https://github.com/phi-dbq","followers_url":"https://api.github.com/users/phi-dbq/followers","following_url":"https://api.github.com/users/phi-dbq/following{/other_user}","gists_url":"https://api.github.com/users/phi-dbq/gists{/gist_id}","starred_url":"https://api.github.com/users/phi-dbq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phi-dbq/subscriptions","organizations_url":"https://api.github.com/users/phi-dbq/orgs","repos_url":"https://api.github.com/users/phi-dbq/repos","events_url":"https://api.github.com/users/phi-dbq/events{/privacy}","received_events_url":"https://api.github.com/users/phi-dbq/received_events","type":"User","site_admin":false},"body":"`KerasApplicationModelSession `?","created_at":"2017-07-05T18:09:05Z","updated_at":"2017-07-05T18:09:05Z","html_url":"https://github.com/databricks/spark-deep-learning/pull/30#discussion_r125717499","pull_request_url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/comments/125717499"},"html":{"href":"https://github.com/databricks/spark-deep-learning/pull/30#discussion_r125717499"},"pull_request":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30","id":128703005,"html_url":"https://github.com/databricks/spark-deep-learning/pull/30","diff_url":"https://github.com/databricks/spark-deep-learning/pull/30.diff","patch_url":"https://github.com/databricks/spark-deep-learning/pull/30.patch","issue_url":"https://api.github.com/repos/databricks/spark-deep-learning/issues/30","number":30,"state":"open","locked":false,"title":"Adding generic support for Keras pre-trained models","user":{"login":"sueann","id":4411489,"avatar_url":"https://avatars2.githubusercontent.com/u/4411489?v=3","gravatar_id":"","url":"https://api.github.com/users/sueann","html_url":"https://github.com/sueann","followers_url":"https://api.github.com/users/sueann/followers","following_url":"https://api.github.com/users/sueann/following{/other_user}","gists_url":"https://api.github.com/users/sueann/gists{/gist_id}","starred_url":"https://api.github.com/users/sueann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sueann/subscriptions","organizations_url":"https://api.github.com/users/sueann/orgs","repos_url":"https://api.github.com/users/sueann/repos","events_url":"https://api.github.com/users/sueann/events{/privacy}","received_events_url":"https://api.github.com/users/sueann/received_events","type":"User","site_admin":false},"body":"DeepImageFeaturizer/Predictor currently has InceptionV3. We want to add other pre-trained models available from Keras. Here is a simple clean way to add them. In this PR, it's just adding the light wrapper, keeping the old InceptionV3 tests to verify the correctness. In the next PR (or commit depending on how fast we review this), we'll make the tests re-usable as well. Then after that we can add all the models.\r\n\r\nThe code to use the various Keras pre-trained model is basically the same so it is captured here under KerasApplicationModel.getModelData. See [https://keras.io/applications](https://keras.io/applications).\r\n\r\nThe `ModelData` interface between the classes is a bit fragile, but seems okay for now...\r\n","created_at":"2017-07-03T22:53:15Z","updated_at":"2017-07-05T18:09:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a394eb5cd88a0e5ab0d4c5c49efa953c5d5f0b1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"MrBago","id":223219,"avatar_url":"https://avatars1.githubusercontent.com/u/223219?v=3","gravatar_id":"","url":"https://api.github.com/users/MrBago","html_url":"https://github.com/MrBago","followers_url":"https://api.github.com/users/MrBago/followers","following_url":"https://api.github.com/users/MrBago/following{/other_user}","gists_url":"https://api.github.com/users/MrBago/gists{/gist_id}","starred_url":"https://api.github.com/users/MrBago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrBago/subscriptions","organizations_url":"https://api.github.com/users/MrBago/orgs","repos_url":"https://api.github.com/users/MrBago/repos","events_url":"https://api.github.com/users/MrBago/events{/privacy}","received_events_url":"https://api.github.com/users/MrBago/received_events","type":"User","site_admin":false},{"login":"thunterdb","id":7594753,"avatar_url":"https://avatars3.githubusercontent.com/u/7594753?v=3","gravatar_id":"","url":"https://api.github.com/users/thunterdb","html_url":"https://github.com/thunterdb","followers_url":"https://api.github.com/users/thunterdb/followers","following_url":"https://api.github.com/users/thunterdb/following{/other_user}","gists_url":"https://api.github.com/users/thunterdb/gists{/gist_id}","starred_url":"https://api.github.com/users/thunterdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thunterdb/subscriptions","organizations_url":"https://api.github.com/users/thunterdb/orgs","repos_url":"https://api.github.com/users/thunterdb/repos","events_url":"https://api.github.com/users/thunterdb/events{/privacy}","received_events_url":"https://api.github.com/users/thunterdb/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30/commits","review_comments_url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30/comments","review_comment_url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/comments{/number}","comments_url":"https://api.github.com/repos/databricks/spark-deep-learning/issues/30/comments","statuses_url":"https://api.github.com/repos/databricks/spark-deep-learning/statuses/c6740117c38be0134616724511f757c4daa1d5d8","head":{"label":"sueann:ML-2733","ref":"ML-2733","sha":"c6740117c38be0134616724511f757c4daa1d5d8","user":{"login":"sueann","id":4411489,"avatar_url":"https://avatars2.githubusercontent.com/u/4411489?v=3","gravatar_id":"","url":"https://api.github.com/users/sueann","html_url":"https://github.com/sueann","followers_url":"https://api.github.com/users/sueann/followers","following_url":"https://api.github.com/users/sueann/following{/other_user}","gists_url":"https://api.github.com/users/sueann/gists{/gist_id}","starred_url":"https://api.github.com/users/sueann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sueann/subscriptions","organizations_url":"https://api.github.com/users/sueann/orgs","repos_url":"https://api.github.com/users/sueann/repos","events_url":"https://api.github.com/users/sueann/events{/privacy}","received_events_url":"https://api.github.com/users/sueann/received_events","type":"User","site_admin":false},"repo":{"id":93466865,"name":"spark-deep-learning","full_name":"sueann/spark-deep-learning","owner":{"login":"sueann","id":4411489,"avatar_url":"https://avatars2.githubusercontent.com/u/4411489?v=3","gravatar_id":"","url":"https://api.github.com/users/sueann","html_url":"https://github.com/sueann","followers_url":"https://api.github.com/users/sueann/followers","following_url":"https://api.github.com/users/sueann/following{/other_user}","gists_url":"https://api.github.com/users/sueann/gists{/gist_id}","starred_url":"https://api.github.com/users/sueann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sueann/subscriptions","organizations_url":"https://api.github.com/users/sueann/orgs","repos_url":"https://api.github.com/users/sueann/repos","events_url":"https://api.github.com/users/sueann/events{/privacy}","received_events_url":"https://api.github.com/users/sueann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sueann/spark-deep-learning","description":"Deep Learning Pipelines for Apache Spark","fork":true,"url":"https://api.github.com/repos/sueann/spark-deep-learning","forks_url":"https://api.github.com/repos/sueann/spark-deep-learning/forks","keys_url":"https://api.github.com/repos/sueann/spark-deep-learning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sueann/spark-deep-learning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sueann/spark-deep-learning/teams","hooks_url":"https://api.github.com/repos/sueann/spark-deep-learning/hooks","issue_events_url":"https://api.github.com/repos/sueann/spark-deep-learning/issues/events{/number}","events_url":"https://api.github.com/repos/sueann/spark-deep-learning/events","assignees_url":"https://api.github.com/repos/sueann/spark-deep-learning/assignees{/user}","branches_url":"https://api.github.com/repos/sueann/spark-deep-learning/branches{/branch}","tags_url":"https://api.github.com/repos/sueann/spark-deep-learning/tags","blobs_url":"https://api.github.com/repos/sueann/spark-deep-learning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sueann/spark-deep-learning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sueann/spark-deep-learning/git/refs{/sha}","trees_url":"https://api.github.com/repos/sueann/spark-deep-learning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sueann/spark-deep-learning/statuses/{sha}","languages_url":"https://api.github.com/repos/sueann/spark-deep-learning/languages","stargazers_url":"https://api.github.com/repos/sueann/spark-deep-learning/stargazers","contributors_url":"https://api.github.com/repos/sueann/spark-deep-learning/contributors","subscribers_url":"https://api.github.com/repos/sueann/spark-deep-learning/subscribers","subscription_url":"https://api.github.com/repos/sueann/spark-deep-learning/subscription","commits_url":"https://api.github.com/repos/sueann/spark-deep-learning/commits{/sha}","git_commits_url":"https://api.github.com/repos/sueann/spark-deep-learning/git/commits{/sha}","comments_url":"https://api.github.com/repos/sueann/spark-deep-learning/comments{/number}","issue_comment_url":"https://api.github.com/repos/sueann/spark-deep-learning/issues/comments{/number}","contents_url":"https://api.github.com/repos/sueann/spark-deep-learning/contents/{+path}","compare_url":"https://api.github.com/repos/sueann/spark-deep-learning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sueann/spark-deep-learning/merges","archive_url":"https://api.github.com/repos/sueann/spark-deep-learning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sueann/spark-deep-learning/downloads","issues_url":"https://api.github.com/repos/sueann/spark-deep-learning/issues{/number}","pulls_url":"https://api.github.com/repos/sueann/spark-deep-learning/pulls{/number}","milestones_url":"https://api.github.com/repos/sueann/spark-deep-learning/milestones{/number}","notifications_url":"https://api.github.com/repos/sueann/spark-deep-learning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sueann/spark-deep-learning/labels{/name}","releases_url":"https://api.github.com/repos/sueann/spark-deep-learning/releases{/id}","deployments_url":"https://api.github.com/repos/sueann/spark-deep-learning/deployments","created_at":"2017-06-06T02:26:27Z","updated_at":"2017-06-06T02:26:28Z","pushed_at":"2017-07-05T16:46:51Z","git_url":"git://github.com/sueann/spark-deep-learning.git","ssh_url":"git@github.com:sueann/spark-deep-learning.git","clone_url":"https://github.com/sueann/spark-deep-learning.git","svn_url":"https://github.com/sueann/spark-deep-learning","homepage":null,"size":3038,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"databricks:master","ref":"master","sha":"cf9d5f2c45e9479d4673ddbaf18fdf7cfa1a386d","user":{"login":"databricks","id":4998052,"avatar_url":"https://avatars1.githubusercontent.com/u/4998052?v=3","gravatar_id":"","url":"https://api.github.com/users/databricks","html_url":"https://github.com/databricks","followers_url":"https://api.github.com/users/databricks/followers","following_url":"https://api.github.com/users/databricks/following{/other_user}","gists_url":"https://api.github.com/users/databricks/gists{/gist_id}","starred_url":"https://api.github.com/users/databricks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databricks/subscriptions","organizations_url":"https://api.github.com/users/databricks/orgs","repos_url":"https://api.github.com/users/databricks/repos","events_url":"https://api.github.com/users/databricks/events{/privacy}","received_events_url":"https://api.github.com/users/databricks/received_events","type":"Organization","site_admin":false},"repo":{"id":92971378,"name":"spark-deep-learning","full_name":"databricks/spark-deep-learning","owner":{"login":"databricks","id":4998052,"avatar_url":"https://avatars1.githubusercontent.com/u/4998052?v=3","gravatar_id":"","url":"https://api.github.com/users/databricks","html_url":"https://github.com/databricks","followers_url":"https://api.github.com/users/databricks/followers","following_url":"https://api.github.com/users/databricks/following{/other_user}","gists_url":"https://api.github.com/users/databricks/gists{/gist_id}","starred_url":"https://api.github.com/users/databricks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databricks/subscriptions","organizations_url":"https://api.github.com/users/databricks/orgs","repos_url":"https://api.github.com/users/databricks/repos","events_url":"https://api.github.com/users/databricks/events{/privacy}","received_events_url":"https://api.github.com/users/databricks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/databricks/spark-deep-learning","description":"Deep Learning Pipelines for Apache Spark","fork":false,"url":"https://api.github.com/repos/databricks/spark-deep-learning","forks_url":"https://api.github.com/repos/databricks/spark-deep-learning/forks","keys_url":"https://api.github.com/repos/databricks/spark-deep-learning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/databricks/spark-deep-learning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/databricks/spark-deep-learning/teams","hooks_url":"https://api.github.com/repos/databricks/spark-deep-learning/hooks","issue_events_url":"https://api.github.com/repos/databricks/spark-deep-learning/issues/events{/number}","events_url":"https://api.github.com/repos/databricks/spark-deep-learning/events","assignees_url":"https://api.github.com/repos/databricks/spark-deep-learning/assignees{/user}","branches_url":"https://api.github.com/repos/databricks/spark-deep-learning/branches{/branch}","tags_url":"https://api.github.com/repos/databricks/spark-deep-learning/tags","blobs_url":"https://api.github.com/repos/databricks/spark-deep-learning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/databricks/spark-deep-learning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/databricks/spark-deep-learning/git/refs{/sha}","trees_url":"https://api.github.com/repos/databricks/spark-deep-learning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/databricks/spark-deep-learning/statuses/{sha}","languages_url":"https://api.github.com/repos/databricks/spark-deep-learning/languages","stargazers_url":"https://api.github.com/repos/databricks/spark-deep-learning/stargazers","contributors_url":"https://api.github.com/repos/databricks/spark-deep-learning/contributors","subscribers_url":"https://api.github.com/repos/databricks/spark-deep-learning/subscribers","subscription_url":"https://api.github.com/repos/databricks/spark-deep-learning/subscription","commits_url":"https://api.github.com/repos/databricks/spark-deep-learning/commits{/sha}","git_commits_url":"https://api.github.com/repos/databricks/spark-deep-learning/git/commits{/sha}","comments_url":"https://api.github.com/repos/databricks/spark-deep-learning/comments{/number}","issue_comment_url":"https://api.github.com/repos/databricks/spark-deep-learning/issues/comments{/number}","contents_url":"https://api.github.com/repos/databricks/spark-deep-learning/contents/{+path}","compare_url":"https://api.github.com/repos/databricks/spark-deep-learning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/databricks/spark-deep-learning/merges","archive_url":"https://api.github.com/repos/databricks/spark-deep-learning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/databricks/spark-deep-learning/downloads","issues_url":"https://api.github.com/repos/databricks/spark-deep-learning/issues{/number}","pulls_url":"https://api.github.com/repos/databricks/spark-deep-learning/pulls{/number}","milestones_url":"https://api.github.com/repos/databricks/spark-deep-learning/milestones{/number}","notifications_url":"https://api.github.com/repos/databricks/spark-deep-learning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/databricks/spark-deep-learning/labels{/name}","releases_url":"https://api.github.com/repos/databricks/spark-deep-learning/releases{/id}","deployments_url":"https://api.github.com/repos/databricks/spark-deep-learning/deployments","created_at":"2017-05-31T17:30:28Z","updated_at":"2017-07-04T12:33:32Z","pushed_at":"2017-07-05T16:46:52Z","git_url":"git://github.com/databricks/spark-deep-learning.git","ssh_url":"git@github.com:databricks/spark-deep-learning.git","clone_url":"https://github.com/databricks/spark-deep-learning.git","svn_url":"https://github.com/databricks/spark-deep-learning","homepage":null,"size":3028,"stargazers_count":354,"watchers_count":354,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":7,"forks":56,"open_issues":7,"watchers":354,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30"},"html":{"href":"https://github.com/databricks/spark-deep-learning/pull/30"},"issue":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/issues/30"},"comments":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/databricks/spark-deep-learning/statuses/c6740117c38be0134616724511f757c4daa1d5d8"}}}}
{"actor":{"display_login":"phi-dbq"}}