├── .gcloudignore
├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── app.yaml
├── dist
├── audio
│ ├── countdown.mp4
│ ├── end-of-game.mp4
│ ├── fail.mp4
│ ├── foundit.mp4
│ ├── game-loop.mp4
│ ├── ios-speech-sprite-ja.m4a
│ ├── ios-speech-sprite.m4a
│ ├── time-running-out.mp4
│ ├── timer-increase.mp4
│ └── win.mp4
├── img
│ ├── badge.svg
│ ├── emojis
│ │ ├── game
│ │ │ ├── baby-bottle.svg
│ │ │ ├── backpack.svg
│ │ │ ├── banana.svg
│ │ │ ├── baseball.svg
│ │ │ ├── basketball.svg
│ │ │ ├── bathtub.svg
│ │ │ ├── bed.svg
│ │ │ ├── beer.svg
│ │ │ ├── bicycle.svg
│ │ │ ├── bird.svg
│ │ │ ├── book.svg
│ │ │ ├── bowl.svg
│ │ │ ├── bread.svg
│ │ │ ├── broccoli.svg
│ │ │ ├── building.svg
│ │ │ ├── burrito.svg
│ │ │ ├── bus.svg
│ │ │ ├── cabinet.svg
│ │ │ ├── camera.svg
│ │ │ ├── candle.svg
│ │ │ ├── car.svg
│ │ │ ├── cassette.svg
│ │ │ ├── cat.svg
│ │ │ ├── cellphone.svg
│ │ │ ├── clock.svg
│ │ │ ├── coat.svg
│ │ │ ├── cup.svg
│ │ │ ├── display.svg
│ │ │ ├── dog.svg
│ │ │ ├── donut.svg
│ │ │ ├── door.svg
│ │ │ ├── envelope.svg
│ │ │ ├── fish.svg
│ │ │ ├── flashlight.svg
│ │ │ ├── flower.svg
│ │ │ ├── fries.svg
│ │ │ ├── frying-pan.svg
│ │ │ ├── glove.svg
│ │ │ ├── guitar.svg
│ │ │ ├── hamburger.svg
│ │ │ ├── hammer.svg
│ │ │ ├── hand.svg
│ │ │ ├── hat.svg
│ │ │ ├── headphones.svg
│ │ │ ├── hotdog.svg
│ │ │ ├── house.svg
│ │ │ ├── icecream.svg
│ │ │ ├── jack-o-lantern.svg
│ │ │ ├── key.svg
│ │ │ ├── keyboard.svg
│ │ │ ├── laptop.svg
│ │ │ ├── lemon.svg
│ │ │ ├── light-bulb.svg
│ │ │ ├── lipstick.svg
│ │ │ ├── lock.svg
│ │ │ ├── magnifying-glass.svg
│ │ │ ├── mailbox.svg
│ │ │ ├── microphone.svg
│ │ │ ├── motor-scooter.svg
│ │ │ ├── mouse.svg
│ │ │ ├── mushroom.svg
│ │ │ ├── newspaper.svg
│ │ │ ├── orange.svg
│ │ │ ├── pants.svg
│ │ │ ├── piano.svg
│ │ │ ├── pizza.svg
│ │ │ ├── plate.svg
│ │ │ ├── plug.svg
│ │ │ ├── printer.svg
│ │ │ ├── radio.svg
│ │ │ ├── ramen.svg
│ │ │ ├── sax.svg
│ │ │ ├── scarf.svg
│ │ │ ├── scissors.svg
│ │ │ ├── screw.svg
│ │ │ ├── shirt.svg
│ │ │ ├── shoe.svg
│ │ │ ├── soccer-ball.svg
│ │ │ ├── sock.svg
│ │ │ ├── sofa.svg
│ │ │ ├── spoon.svg
│ │ │ ├── strawberry.svg
│ │ │ ├── sunglasses.svg
│ │ │ ├── sushi.svg
│ │ │ ├── taco.svg
│ │ │ ├── toilet.svg
│ │ │ ├── traffic-light.svg
│ │ │ ├── trash-can.svg
│ │ │ ├── tree.svg
│ │ │ ├── truck.svg
│ │ │ ├── tv.svg
│ │ │ ├── umbrella.svg
│ │ │ ├── wallet.svg
│ │ │ ├── watch.svg
│ │ │ └── wine.svg
│ │ └── ui
│ │ │ ├── crossmark.svg
│ │ │ ├── house.svg
│ │ │ ├── info.svg
│ │ │ ├── sleuth.svg
│ │ │ ├── stopwatch.svg
│ │ │ ├── thumbsdown.svg
│ │ │ ├── thumbsup.svg
│ │ │ └── trophy.svg
│ ├── facebook.svg
│ ├── favicon-152.png
│ ├── favicon-192.png
│ ├── favicon.ico
│ ├── loading.gif
│ ├── logo.svg
│ ├── share.jpg
│ ├── sound.svg
│ └── twitter.svg
├── index.html
├── ja
│ └── index.html
└── model
│ ├── group1-shard1of1
│ ├── tensorflowjs_model.pb
│ └── weights_manifest.json
├── package.json
├── src
├── js
│ ├── camera.ts
│ ├── classes.ts
│ ├── game.ts
│ ├── game_levels.ts
│ ├── index.ts
│ ├── mobilenet.ts
│ ├── scavenger_classes.ts
│ ├── share.ts
│ ├── speech_sprite_timestamps.ts
│ ├── ui.ts
│ └── utils.ts
└── sass
│ ├── camera.scss
│ ├── main.scss
│ ├── mixins.scss
│ ├── ui.scss
│ └── vars.scss
├── training
└── Dockerfile
├── tsconfig.json
├── tslint.json
└── yarn.lock
/.gcloudignore:
--------------------------------------------------------------------------------
1 | *.map
2 | *.pyc
3 | .DS_Store
4 | .git/
5 | node_modules/
6 | src/
7 | training/
8 | package-lock.json
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | package-lock.json
3 | dist/js/
4 | dist/css/
5 | cors-settings.json
6 | *.DS_Store
7 | *.swp
8 | *.map
9 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We’d love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to this project must be accompanied by a Contributor License
9 | Agreement. You (or your employer) retain the copyright to your contribution;
10 | this simply gives us permission to use and redistribute your contributions as
11 | part of the project. Head over to to see
12 | your current agreements on file or to sign a new one.
13 |
14 | You generally only need to submit a CLA once, so if you've already submitted one
15 | (even if it was for a different project), you probably don't need to do it
16 | again.
17 |
18 | ## Code reviews
19 |
20 | All submissions, including submissions by project members, require review. We
21 | use GitHub pull requests for this purpose. Consult
22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23 | information on using pull requests.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 👾 Emoji Scavenger Hunt 👾
2 |
3 | Emoji Scavenger Hunt is an experimental web based game that makes use of TensorFlow.js to identify objects seen by your webcam or mobile camera in the browser. We show you emojis 🍌 ⏰ ☕️ 📱 and you have to find those objects in the real world before your timer runs out 🏆 👍.
4 |
5 | Find out how we built this experiment by reading our [article](https://medium.com/tensorflow/a-look-at-how-we-built-the-emoji-scavenger-hunt-using-tensorflow-js-3d760a7ebfe6) on the Tensorflow blog or try it for yourself at [g.co/emojiscavengerhunt](http://g.co/emojiscavengerhunt).
6 |
7 |
8 | ## Development
9 |
10 | ```sh
11 | yarn prep
12 | ```
13 |
14 | Running `yarn prep` will use yarn to get the right packages and setup the right folders. If you don't have [yarn](https://yarnpkg.com/lang/en/docs/install/) you can install it via homebrew (for Mac). If you’re already running node/npm with nvm (our recommendation) you can install yarn without node using `brew install yarn --without-node`.
15 |
16 | In order to start local development we also require the installation of the [Google Cloud SDK](https://cloud.google.com/sdk/downloads) and associated [App Engine Components](https://cloud.google.com/appengine/docs/standard/python/download). These are used for the local webserver and pushing to app engine for static site hosting.
17 |
18 | Once you have both installed you can run the local development server with:
19 |
20 | ```sh
21 | yarn dev
22 | ```
23 |
24 | This task uses `watchify` to continually watch for changes to JS and SASS files and recompiles them if any changes are detected. You can access the local development server at `http://localhost:3000/`
25 |
26 | When building assets for production use:
27 |
28 | ```sh
29 | yarn build
30 | ```
31 |
32 | This will minify SASS and JS for serving in production.
33 |
34 | ## Build your own model
35 | You can build your own image recognition model by running a Docker container.
36 | Dockerfiles are in `training` directory.
37 |
38 | Prepare images for training by dividing them into directories for each label
39 | name that you want to train.
40 | For example: the directory structure for training *cat* and *dog* will look as
41 | follows assuming image data is stored under `data/images`.
42 |
43 | ```
44 | data
45 | └── images
46 | ├── cat
47 | │ ├── cat1.jpg
48 | │ ├── cat2.jpg
49 | │ └── ...
50 | └── dog
51 | ├── dog1.jpg
52 | ├── dog2.jpg
53 | └── ...
54 | ```
55 |
56 | Once the sample images are ready, you can kickstart the training by building and
57 | running the Docker container.
58 |
59 | ```
60 | $ cd training
61 | $ docker build -t model-builder .
62 | $ docker run -v /path/to/data:/data -it model-builder
63 | ```
64 |
65 | After the training is completed, you'll see three files in the
66 | `data/saved_model_web` directory:
67 |
68 | - tensorflowjs_model.pb (the dataflow graph)
69 | - weights_manifest.json (weight manifest file)
70 | - group1-shard\*of\* (collection of binary weight files)
71 |
72 | They are SavedModel files in a web-friendly format converted by the
73 | [TensorFlow.js converter](https://github.com/tensorflow/tfjs-converter).
74 | You can build your own game using your own custom image recognition model by replacing
75 | the corresponding files under the `dist/model/` directory with the newly generated ones.
76 |
77 | The training script will also generate a file called `scavenger_classes.ts`
78 | which works in conjunction with your generated custom model.
79 | You need to replace the file at `src/js/scavenger_classes.ts` with this newly
80 | generated `scavenger_classes.ts` file so that the labels of your model match
81 | with the trained data.
82 | After replacing the file you can run the build script normally to test your
83 | model in a browser. See the README file for information on running a preview
84 | server.
85 |
86 | Update the game logic in `src/js/game.ts` if needed.
87 |
88 | ```
89 |
90 | ## License
91 |
92 | Copyright 2018 Google LLC
93 |
94 | Licensed under the Apache License, Version 2.0 (the "License");
95 | you may not use this file except in compliance with the License.
96 | You may obtain a copy of the License at
97 |
98 | https://www.apache.org/licenses/LICENSE-2.0
99 |
100 | Unless required by applicable law or agreed to in writing, software
101 | distributed under the License is distributed on an "AS IS" BASIS,
102 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
103 | See the License for the specific language governing permissions and
104 | limitations under the License.
105 |
106 | ## Credits
107 |
108 | This is an experiment and collaboration between Google Brand Studio and the [PAIR](https://ai.google/pair/) teams at Google.
109 |
110 | ## Final Thoughts
111 |
112 | This is not an official Google product. We will do our best to support and maintain this experiment but your mileage may vary.
113 |
114 | We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present, when sharing these works and creating derivative work.
115 |
116 | If you want more info on Google's policy, you can find that [here](https://policies.google.com/)
117 |
--------------------------------------------------------------------------------
/app.yaml:
--------------------------------------------------------------------------------
1 | # @license
2 | # Copyright 2018 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # https://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | runtime: python312
17 | instance_class: F4_1G
18 |
19 | handlers:
20 | - url: /model/(group1-shard1of1)
21 | secure: always
22 | static_files: dist/model/\1
23 | upload: dist/model/(.*)
24 | http_headers:
25 | X-Frame-Options: "DENY"
26 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
27 | X-Content-Type-Options: "nosniff"
28 | X-XSS-Protection: "1; mode=block"
29 | Content-Security-Policy:
30 | "base-uri 'none';
31 | object-src 'none';
32 | font-src 'self'
33 | *.gstatic.com
34 | fonts.googleapis.com;
35 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
36 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
37 | style-src 'self' 'unsafe-inline'
38 | fonts.googleapis.com
39 | *.gstatic.com;"
40 |
41 | - url: /model/(.*\.(pb|json))
42 | secure: always
43 | static_files: dist/model/\1
44 | upload: dist/model/(.*)
45 | http_headers:
46 | X-Frame-Options: "DENY"
47 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
48 | X-Content-Type-Options: "nosniff"
49 | X-XSS-Protection: "1; mode=block"
50 | Content-Security-Policy:
51 | "base-uri 'none';
52 | object-src 'none';
53 | font-src 'self'
54 | *.gstatic.com
55 | fonts.googleapis.com;
56 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
57 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
58 | style-src 'self' 'unsafe-inline'
59 | fonts.googleapis.com
60 | *.gstatic.com;"
61 |
62 | # Static assets (anything with a file extension)
63 | - url: /(.*\..*)
64 | secure: always
65 | static_files: dist/\1
66 | upload: dist/(.*)
67 | http_headers:
68 | X-Frame-Options: "DENY"
69 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
70 | X-Content-Type-Options: "nosniff"
71 | X-XSS-Protection: "1; mode=block"
72 | Content-Security-Policy:
73 | "base-uri 'none';
74 | object-src 'none';
75 | font-src 'self'
76 | *.gstatic.com
77 | fonts.googleapis.com;
78 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
79 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
80 | style-src 'self' 'unsafe-inline'
81 | fonts.googleapis.com
82 | *.gstatic.com;"
83 |
84 | # Root
85 | - url: /
86 | secure: always
87 | static_files: dist/index.html
88 | upload: dist/(.*)
89 | http_headers:
90 | X-Frame-Options: "DENY"
91 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
92 | X-Content-Type-Options: "nosniff"
93 | X-XSS-Protection: "1; mode=block"
94 | Content-Security-Policy:
95 | "base-uri 'none';
96 | object-src 'none';
97 | font-src 'self'
98 | *.gstatic.com
99 | fonts.googleapis.com;
100 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
101 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
102 | style-src 'self' 'unsafe-inline'
103 | fonts.googleapis.com
104 | *.gstatic.com;"
105 |
106 | # Paths with a trailing slash
107 | - url: /(.*\/)
108 | secure: always
109 | static_files: dist/\1index.html
110 | upload: dist/(.*)
111 | http_headers:
112 | X-Frame-Options: "DENY"
113 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
114 | X-Content-Type-Options: "nosniff"
115 | X-XSS-Protection: "1; mode=block"
116 | Content-Security-Policy:
117 | "base-uri 'none';
118 | object-src 'none';
119 | font-src 'self'
120 | *.gstatic.com
121 | fonts.googleapis.com;
122 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
123 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
124 | style-src 'self' 'unsafe-inline'
125 | fonts.googleapis.com
126 | *.gstatic.com;"
127 |
128 | # Paths without a trailing slash
129 | - url: /(.*)?
130 | secure: always
131 | static_files: dist/\1/index.html
132 | upload: dist/(.*)
133 | http_headers:
134 | X-Frame-Options: "DENY"
135 | Strict-Transport-Security: "max-age=2592000; includeSubdomains"
136 | X-Content-Type-Options: "nosniff"
137 | X-XSS-Protection: "1; mode=block"
138 | Content-Security-Policy:
139 | "base-uri 'none';
140 | object-src 'none';
141 | font-src 'self'
142 | *.gstatic.com
143 | fonts.googleapis.com;
144 | script-src 'unsafe-inline' 'strict-dynamic' http: https:
145 | 'sha256-u86hT2CFpyf1kAS+9STbX2ajNCVNH6z80kNNXy3Sb3g=';
146 | style-src 'self' 'unsafe-inline'
147 | fonts.googleapis.com
148 | *.gstatic.com;"
149 |
--------------------------------------------------------------------------------
/dist/audio/countdown.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/countdown.mp4
--------------------------------------------------------------------------------
/dist/audio/end-of-game.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/end-of-game.mp4
--------------------------------------------------------------------------------
/dist/audio/fail.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/fail.mp4
--------------------------------------------------------------------------------
/dist/audio/foundit.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/foundit.mp4
--------------------------------------------------------------------------------
/dist/audio/game-loop.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/game-loop.mp4
--------------------------------------------------------------------------------
/dist/audio/ios-speech-sprite-ja.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/ios-speech-sprite-ja.m4a
--------------------------------------------------------------------------------
/dist/audio/ios-speech-sprite.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/ios-speech-sprite.m4a
--------------------------------------------------------------------------------
/dist/audio/time-running-out.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/time-running-out.mp4
--------------------------------------------------------------------------------
/dist/audio/timer-increase.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/timer-increase.mp4
--------------------------------------------------------------------------------
/dist/audio/win.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/audio/win.mp4
--------------------------------------------------------------------------------
/dist/img/badge.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/banana.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/beer.svg:
--------------------------------------------------------------------------------
1 |
64 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/building.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/bus.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/camera.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/candle.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/car.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/cassette.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/flashlight.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/hamburger.svg:
--------------------------------------------------------------------------------
1 |
71 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/headphones.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/magnifying-glass.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/motor-scooter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/mushroom.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/piano.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/radio.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/sax.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/traffic-light.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/truck.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/game/tv.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/emojis/ui/crossmark.svg:
--------------------------------------------------------------------------------
1 |
26 |
--------------------------------------------------------------------------------
/dist/img/emojis/ui/info.svg:
--------------------------------------------------------------------------------
1 |
31 |
--------------------------------------------------------------------------------
/dist/img/facebook.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/favicon-152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/img/favicon-152.png
--------------------------------------------------------------------------------
/dist/img/favicon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/img/favicon-192.png
--------------------------------------------------------------------------------
/dist/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/img/favicon.ico
--------------------------------------------------------------------------------
/dist/img/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/img/loading.gif
--------------------------------------------------------------------------------
/dist/img/share.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/img/share.jpg
--------------------------------------------------------------------------------
/dist/img/sound.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/dist/img/twitter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/model/group1-shard1of1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/model/group1-shard1of1
--------------------------------------------------------------------------------
/dist/model/tensorflowjs_model.pb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/emoji-scavenger-hunt/88ed5b271d400a565803fb6933a338748c024c86/dist/model/tensorflowjs_model.pb
--------------------------------------------------------------------------------
/dist/model/weights_manifest.json:
--------------------------------------------------------------------------------
1 | [{"paths": ["group1-shard1of1"], "weights": [{"name": "MobilenetV1/Conv2d_0/weights", "shape": [3, 3, 3, 8], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul", "shape": [8], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/sub", "shape": [8], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_1_depthwise/depthwise_weights", "shape": [3, 3, 8, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_1_depthwise/BatchNorm/batchnorm/mul", "shape": [8], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_1_depthwise/BatchNorm/batchnorm/sub", "shape": [8], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_1_pointwise/weights", "shape": [1, 1, 8, 16], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_1_pointwise/BatchNorm/batchnorm/mul", "shape": [16], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_1_pointwise/BatchNorm/batchnorm/sub", "shape": [16], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_2_depthwise/depthwise_weights", "shape": [3, 3, 16, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_2_depthwise/BatchNorm/batchnorm/mul", "shape": [16], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_2_depthwise/BatchNorm/batchnorm/sub", "shape": [16], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_2_pointwise/weights", "shape": [1, 1, 16, 32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_2_pointwise/BatchNorm/batchnorm/mul", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_2_pointwise/BatchNorm/batchnorm/sub", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_3_depthwise/depthwise_weights", "shape": [3, 3, 32, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_3_depthwise/BatchNorm/batchnorm/mul", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_3_depthwise/BatchNorm/batchnorm/sub", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_3_pointwise/weights", "shape": [1, 1, 32, 32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_3_pointwise/BatchNorm/batchnorm/mul", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_3_pointwise/BatchNorm/batchnorm/sub", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_4_depthwise/depthwise_weights", "shape": [3, 3, 32, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_4_depthwise/BatchNorm/batchnorm/mul", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_4_depthwise/BatchNorm/batchnorm/sub", "shape": [32], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_4_pointwise/weights", "shape": [1, 1, 32, 64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_4_pointwise/BatchNorm/batchnorm/mul", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_4_pointwise/BatchNorm/batchnorm/sub", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_5_depthwise/depthwise_weights", "shape": [3, 3, 64, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_5_depthwise/BatchNorm/batchnorm/mul", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_5_depthwise/BatchNorm/batchnorm/sub", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_5_pointwise/weights", "shape": [1, 1, 64, 64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_5_pointwise/BatchNorm/batchnorm/mul", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_5_pointwise/BatchNorm/batchnorm/sub", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_6_depthwise/depthwise_weights", "shape": [3, 3, 64, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_6_depthwise/BatchNorm/batchnorm/mul", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_6_depthwise/BatchNorm/batchnorm/sub", "shape": [64], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_6_pointwise/weights", "shape": [1, 1, 64, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_6_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_6_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_7_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_7_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_7_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_7_pointwise/weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_7_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_7_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_8_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_8_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_8_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_8_pointwise/weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_8_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_8_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_9_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_9_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_9_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_9_pointwise/weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_9_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_9_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_10_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_10_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_10_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_10_pointwise/weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_10_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_10_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_11_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_11_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_11_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_11_pointwise/weights", "shape": [1, 1, 128, 128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_11_pointwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_11_pointwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_12_depthwise/depthwise_weights", "shape": [3, 3, 128, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_12_depthwise/BatchNorm/batchnorm/mul", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_12_depthwise/BatchNorm/batchnorm/sub", "shape": [128], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_12_pointwise/weights", "shape": [1, 1, 128, 256], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_12_pointwise/BatchNorm/batchnorm/mul", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_12_pointwise/BatchNorm/batchnorm/sub", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_13_depthwise/depthwise_weights", "shape": [3, 3, 256, 1], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_13_depthwise/BatchNorm/batchnorm/mul", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_13_depthwise/BatchNorm/batchnorm/sub", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/Conv2d_13_pointwise/weights", "shape": [1, 1, 256, 256], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_13_pointwise/BatchNorm/batchnorm/mul", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/MobilenetV1/Conv2d_13_pointwise/BatchNorm/batchnorm/sub", "shape": [256], "dtype": "float32"}, {"name": "MobilenetV1/Logits/Conv2d_1c_1x1/weights", "shape": [1, 1, 256, 1001], "dtype": "float32"}, {"name": "MobilenetV1/Logits/Conv2d_1c_1x1/biases", "shape": [1001], "dtype": "float32"}, {"name": "MobilenetV1/Predictions/Reshape/shape", "shape": [2], "dtype": "int32"}, {"name": "final_training_ops/weights/final_weights", "shape": [1001, 424], "dtype": "float32"}, {"name": "final_training_ops/biases/final_biases", "shape": [424], "dtype": "float32"}]}]
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "emoji-scavenger-hunt",
3 | "version": "0.1.0",
4 | "description": "Emoji Scavenger Hunt",
5 | "private": true,
6 | "scripts": {
7 | "prep": "yarn && yarn prep:files && yarn build",
8 | "prep:files": "mkdirp dist && mkdirp dist/js && touch dist/js/bundle.js",
9 | "sass-watch": "sass -w src/sass/main.scss dist/css/main.min.css",
10 | "sass-build": "sass src/sass/main.scss dist/css/main.min.css --style compressed",
11 | "js-watch": "watchify src/js/index.ts -p [tsify] -o dist/js/bundle.js -v --debug",
12 | "js-build": "browserify src/js/index.ts -p [tsify] -o dist/js/bundle.js",
13 | "js-compress": "uglifyjs dist/js/bundle.js -c -m -o dist/js/bundle.js",
14 | "dev:server": "python3 -m http.server -d dist 3000",
15 | "build": "concurrently \"yarn sass-build\" \"yarn js-build && yarn js-compress\"",
16 | "dev": "concurrently \"yarn sass-watch\" \"yarn js-watch\" \"yarn dev:server\"",
17 | "lint": "tslint -p . -t verbose"
18 | },
19 | "devDependencies": {
20 | "@types/lodash": "^4.14.202",
21 | "@types/stats.js": "^0.17.0",
22 | "browserify": "^17.0.0",
23 | "browserify-shim": "^3.8.16",
24 | "concurrently": "^8.2.2",
25 | "lodash": "^4.17.21",
26 | "mkdirp": "^3.0.1",
27 | "sass": "^1.69.7",
28 | "stats.js": "^0.17.0",
29 | "tsify": "^5.0.4",
30 | "tslint": "^5.20.1",
31 | "typescript": "^5.3.3",
32 | "uglify-js": "^3.17.4",
33 | "watchify": "^4.0.0"
34 | },
35 | "dependencies": {
36 | "@tensorflow/tfjs-converter": "0.2.1",
37 | "@tensorflow/tfjs-core": "0.9.0",
38 | "babel-polyfill": "^6.26.0"
39 | },
40 | "resolutions": {
41 | "acorn": "^6.4.1",
42 | "lodash": "^4.17.13",
43 | "kind-of": "^6.0.3",
44 | "minimist": "^1.2.3",
45 | "mixin-deep": "^1.3.2",
46 | "set-value": "^2.0.1",
47 | "seedrandom": "2.4.3",
48 | "shell-quote": "^1.7.3",
49 | "cached-path-relative": "^1.1.0",
50 | "browserify-sign": "^4.2.2",
51 | "minimatch": "^3.0.5",
52 | "path-parse": "^1.0.7"
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/js/camera.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | import {game} from './game';
20 | import {addClass} from './classes';
21 |
22 | const SELECTORS = {
23 | CAMERA_ELEMENT: '.camera__element--js',
24 | };
25 |
26 | const CSS_CLASSES = {
27 | CAMERA_FRONT_FACING: 'camera-front-facing'
28 | };
29 |
30 | export const VIDEO_PIXELS = 224;
31 |
32 | /** Initializes and manages interaction with the camera */
33 | export class Camera {
34 | /** The HTMLVideoElement used to show content from the camera */
35 | videoElement: HTMLVideoElement;
36 | /** A canvas element to save snapshots to */
37 | snapShotCanvas: HTMLCanvasElement;
38 | /** The native aspect ratio of the video element once initialized */
39 | aspectRatio: number;
40 |
41 | constructor() {
42 | this.videoElement =
43 | document.querySelector(SELECTORS.CAMERA_ELEMENT);
44 | this.snapShotCanvas = document.createElement('canvas');
45 | }
46 |
47 | /**
48 | * Requests access to the camera and return a Promise with the native width
49 | * and height of the video element when resolved.
50 | *
51 | * @async
52 | * @returns {Promise} A promise with the width and height
53 | * of the video element used as the camera.
54 | */
55 | async setupCamera() {
56 | if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
57 | const stream = await navigator.mediaDevices.getUserMedia({
58 | 'audio': false,
59 | 'video': {facingMode: 'environment'}
60 | });
61 | (window).stream = stream;
62 | this.videoElement.srcObject = stream;
63 | return new Promise(resolve => {
64 | this.videoElement.onloadedmetadata = () => {
65 | resolve([this.videoElement.videoWidth,
66 | this.videoElement.videoHeight]);
67 | };
68 | });
69 | }
70 |
71 | return null;
72 | }
73 |
74 | /**
75 | * Adjusts the video element width and height to align with the native
76 | * screen aspect ratio while also constraining it to the amount of pixel
77 | * we use for our training data.
78 | *
79 | * @param width The video element native width.
80 | * @param height The video element native height.
81 | */
82 | setupVideoDimensions(width: number, height: number) {
83 | this.aspectRatio = width / height;
84 |
85 | if (width >= height) {
86 | this.videoElement.height = VIDEO_PIXELS;
87 | this.videoElement.width = this.aspectRatio * VIDEO_PIXELS;
88 | } else {
89 | this.videoElement.width = VIDEO_PIXELS;
90 | this.videoElement.height = VIDEO_PIXELS / this.aspectRatio;
91 | }
92 | }
93 |
94 | pauseCamera() {
95 | if (!game.cameraPaused) {
96 | this.videoElement.pause();
97 | game.cameraPaused = true;
98 | }
99 | }
100 |
101 | unPauseCamera() {
102 | if (game.cameraPaused) {
103 | this.videoElement.play();
104 | game.cameraPaused = false;
105 | }
106 | }
107 |
108 | /**
109 | * Adjusts the camera CSS to flip the display since we are viewing the
110 | * camera on a desktop where we want the camera to be mirrored.
111 | */
112 | setFrontFacingCamera() {
113 | addClass(this.videoElement, CSS_CLASSES.CAMERA_FRONT_FACING);
114 | }
115 |
116 | /**
117 | * Takes a snapshot of the camera feed and converts it
118 | * to an image via a canvas element.
119 | * @returns The snapshot as an image node.
120 | */
121 | snapshot() {
122 | this.snapShotCanvas.height = this.videoElement.height;
123 | this.snapShotCanvas.width = this.videoElement.width;
124 | let ctx = this.snapShotCanvas.getContext('2d');
125 | ctx.drawImage(this.videoElement, 0, 0, this.snapShotCanvas.width,
126 | this.snapShotCanvas.height);
127 | let img = new Image();
128 | img.src = this.snapShotCanvas.toDataURL('image/png').replace('image/png',
129 | 'image/octet-stream');
130 | return img;
131 | }
132 | }
133 |
134 | export let camera = new Camera();
135 |
--------------------------------------------------------------------------------
/src/js/classes.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | /**
20 | * Adds a class to the provided element
21 | *
22 | * @param el The HTMLElement to apply the class to.
23 | * @param className The class name to add to the element.
24 | */
25 | function addClass(el: HTMLElement, className: string) {
26 | if (el.classList) {
27 | el.classList.add(className);
28 | } else {
29 | if (!hasClass(el, className)) {
30 | el.className += ' ' + className;
31 | }
32 | }
33 | }
34 |
35 | /**
36 | * Removes a class from the provided element
37 | *
38 | * @param el The HTMLElement to remove the class from.
39 | * @param className The class name to be removed from the element.
40 | */
41 | function removeClass(el: HTMLElement, className: string) {
42 | if (el.classList) {
43 | el.classList.remove(className);
44 | } else {
45 | el.className = el.className.replace(new RegExp('(^|\\b)' +
46 | className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
47 | }
48 | }
49 |
50 | /**
51 | * Checks to see if the provided class exists on the element
52 | *
53 | * @param el The HTMLElement to check.
54 | * @param className The class name to check for.
55 | */
56 | function hasClass(el: HTMLElement, className: string) {
57 | if (el.classList) {
58 | return el.classList.contains(className);
59 | } else {
60 | return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
61 | }
62 | }
63 |
64 | export {addClass, removeClass, hasClass};
65 |
--------------------------------------------------------------------------------
/src/js/index.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | import {ui} from './ui';
20 |
21 | /**
22 | * Ensures no media stream tracks are active and initializes our UI.
23 | *
24 | * @async
25 | */
26 | async function init() {
27 | if ((window).stream) {
28 | let trackArr = (window).stream.getTracks();
29 | for (const track of trackArr) {
30 | track.stop();
31 | }
32 | }
33 |
34 | ui.init();
35 | }
36 |
37 | init();
38 |
--------------------------------------------------------------------------------
/src/js/mobilenet.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | import * as tfc from '@tensorflow/tfjs-core';
20 | import {loadFrozenModel, FrozenModel} from '@tensorflow/tfjs-converter';
21 | import {SCAVENGER_CLASSES} from './scavenger_classes';
22 | import { isLangJa } from './utils';
23 |
24 |
25 | type TensorMap = {[name: string]: tfc.Tensor};
26 |
27 | const ROOT_PATH = isLangJa() ? '../' : '';
28 | const MODEL_FILE_URL = ROOT_PATH + 'model/tensorflowjs_model.pb';
29 | const WEIGHT_MANIFEST_FILE_URL = ROOT_PATH + 'model/weights_manifest.json';
30 | const INPUT_NODE_NAME = 'input';
31 | const OUTPUT_NODE_NAME = 'final_result';
32 | const PREPROCESS_DIVISOR = tfc.scalar(255 / 2);
33 |
34 |
35 | export class MobileNet {
36 |
37 | model: FrozenModel;
38 |
39 | async load() {
40 | this.model = await loadFrozenModel(
41 | MODEL_FILE_URL,
42 | WEIGHT_MANIFEST_FILE_URL
43 | );
44 | }
45 |
46 | dispose() {
47 | if (this.model) {
48 | this.model.dispose();
49 | }
50 | }
51 | /**
52 | * Infer through MobileNet, assumes variables have been loaded. This does
53 | * standard ImageNet pre-processing before inferring through the model. This
54 | * method returns named activations as well as softmax logits.
55 | *
56 | * @param input un-preprocessed input Array.
57 | * @return The softmax logits.
58 | */
59 | predict(input: tfc.Tensor): tfc.Tensor1D {
60 | const preprocessedInput = tfc.div(
61 | tfc.sub(input.asType('float32'), PREPROCESS_DIVISOR),
62 | PREPROCESS_DIVISOR);
63 | const reshapedInput =
64 | preprocessedInput.reshape([1, ...preprocessedInput.shape]);
65 | const dict: TensorMap = {};
66 | dict[INPUT_NODE_NAME] = reshapedInput;
67 | return this.model.execute(dict, OUTPUT_NODE_NAME) as tfc.Tensor1D;
68 | }
69 |
70 | getTopKClasses(predictions: tfc.Tensor1D, topK: number) {
71 | const values = predictions.dataSync();
72 | predictions.dispose();
73 |
74 | let predictionList = [];
75 | for (let i = 0; i < values.length; i++) {
76 | predictionList.push({value: values[i], index: i});
77 | }
78 | predictionList = predictionList.sort((a, b) => {
79 | return b.value - a.value;
80 | }).slice(0, topK);
81 |
82 | return predictionList.map(x => {
83 | return {label: SCAVENGER_CLASSES[x.index], value: x.value};
84 | });
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/js/share.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | import {isLangJa} from './utils';
20 |
21 | const SELECTORS = {
22 | SHARE_LINK_EL: '.social-share-link',
23 | SHARE_LINK_ALL_ITEMS_TWITTER: '.view__found-all-items__social__tritter--js',
24 | SHARE_LINK_X_ITEMS_TWITTER: '.view__found-x-items__social__tritter--js'
25 | };
26 |
27 | /** Handles events and UI elements related to sharing. */
28 | export class Share {
29 | shareLinks: NodeListOf;
30 | shareLinkAllItemsTwitter: HTMLLinkElement;
31 | shareLinkXItemsTwitter: HTMLLinkElement;
32 |
33 | constructor() {
34 | this.shareLinks = document.querySelectorAll(SELECTORS.SHARE_LINK_EL);
35 | this.shareLinkAllItemsTwitter =
36 | document.querySelector(SELECTORS.SHARE_LINK_ALL_ITEMS_TWITTER);
37 | this.shareLinkXItemsTwitter =
38 | document.querySelector(SELECTORS.SHARE_LINK_X_ITEMS_TWITTER);
39 | }
40 |
41 | /**
42 | * Registers a click event for all sharing elements that open the share link
43 | * in a new window centered on the screen.
44 | */
45 | initShareElements() {
46 | if (!!this.shareLinks) {
47 | for (let i = 0; i < this.shareLinks.length; i++) {
48 | let shareEl = this.shareLinks[i];
49 | shareEl.addEventListener('click', (e: Event) => {
50 | e.preventDefault();
51 | const left = screen.width / 2 - (600 / 2);
52 | const top = screen.height / 2 - (600 / 2);
53 | window.open(shareEl.href, '',
54 | 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,left=' +
55 | left + ',top=' + top + ',height=600,width=600');
56 | });
57 | }
58 | }
59 | }
60 |
61 | /**
62 | * Updates the twitter sharing link text to include the emojis the user has
63 | * found.
64 | * @param emojiList The list of emojis the user has found.
65 | */
66 | setTwitterShareLinks(emojiList: string) {
67 | let encodedEmojiList = encodeURIComponent(emojiList);
68 | const shareHref = isLangJa() ? (
69 | `https://twitter.com/intent/tweet?text=${encodedEmojiList}を発見しました!` +
70 | 'あなたは何個見つけられるかな?さっそくプレイしてみよう!' +
71 | '&hashtags=AIExperiments,tensorflowjs') : (
72 | `https://twitter.com/intent/tweet?text=I%20found%20${encodedEmojiList}` +
73 | '%20in%20the%20real%20world.%20How%20many%20can%20you%20find%3F' +
74 | '%20Start%20your%20search%20at&hashtags=AIExperiments,tensorflowjs' +
75 | '&url=https%3A%2F%2Fg.co%2Femojiscavengerhunt');
76 | this.shareLinkAllItemsTwitter.href = shareHref;
77 | this.shareLinkXItemsTwitter.href = shareHref;
78 | }
79 | }
80 |
81 | export let share = new Share();
82 |
--------------------------------------------------------------------------------
/src/js/speech_sprite_timestamps.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the 'License');
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an 'AS IS' BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | export const SPEECH_SPRITE_TIMESTAMPS: {[key: string]: Array} = {
20 | 'baby bottle': [0, 1.935],
21 | 'backpack': [2.5, 4.858],
22 | 'banana': [5, 7.727],
23 | 'baseball': [8, 10.792],
24 | 'basketball': [11.5, 13.984],
25 | 'bathtub': [14, 16.836],
26 | 'bed': [17.5, 19.541],
27 | 'beer': [20.1, 22.581],
28 | 'bicycle': [24, 25.810],
29 | 'bird': [26.5, 28.620],
30 | 'book': [30, 31.579],
31 | 'bowl': [33, 34.599],
32 | 'bread': [36, 37.614],
33 | 'broccoli': [39, 40.783],
34 | 'building': [42, 43.714],
35 | 'burrito': [44.5, 46.811],
36 | 'bus': [48, 49.762],
37 | 'cabinet': [50.5, 52.729],
38 | 'camera': [54, 55.671],
39 | 'candle': [57, 58.664],
40 | 'car': [60, 61.569],
41 | 'cassette': [63, 64.719],
42 | 'cat': [66, 67.586],
43 | 'cellphone': [69, 70.725],
44 | 'clock': [72, 73.683],
45 | 'coat': [75, 76.585],
46 | 'cup': [78, 79.645],
47 | 'display': [81, 82.751],
48 | 'dog': [84, 85.666],
49 | 'donut': [87, 88.637],
50 | 'door': [90, 91.596],
51 | 'envelope': [93, 94.863],
52 | 'fish': [96, 97.752],
53 | 'flashlight': [99, 100.894],
54 | 'flower': [102, 103.735],
55 | 'found 0': [105, 107.338],
56 | 'found 10': [109, 112.676],
57 | 'found 1': [114, 116.303],
58 | 'found 2': [118, 120.273],
59 | 'found 3': [122, 124.303],
60 | 'found 4': [126, 128.309],
61 | 'found 5': [130, 132.344],
62 | 'found 6': [134, 136.389],
63 | 'found 7': [138, 140.351],
64 | 'found 8': [142, 144.318],
65 | 'found 9': [146, 148.228],
66 | 'fries': [150, 151.712],
67 | 'frying pan': [153, 155.085],
68 | 'glove': [157, 158.619],
69 | 'guitar': [160, 161.703],
70 | 'hamburger': [163, 164.785],
71 | 'hammer': [166, 167.676],
72 | 'hand': [169, 170.683],
73 | 'hat': [172, 173.573],
74 | 'headphones': [175, 176.945],
75 | 'hotdog': [178, 179.777],
76 | 'house': [181, 182.808],
77 | 'icecream': [184, 185.899],
78 | 'jack o lantern': [187, 189.218],
79 | 'keyboard': [191, 192.792],
80 | 'key': [194, 195.630],
81 | 'laptop': [197, 198.851],
82 | 'lemon': [200, 201.685],
83 | 'light bulb': [203, 204.840],
84 | 'lipstick': [206, 207.791],
85 | 'lock': [209, 210.621],
86 | 'magnifying glass': [212, 214.424],
87 | 'mailbox': [216, 218.052],
88 | 'microphone': [220, 221.944],
89 | 'motor scooter': [223, 225.167],
90 | 'mouse': [227, 228.787],
91 | 'mushroom': [230, 231.759],
92 | 'newspaper': [233, 234.901],
93 | 'orange': [236, 237.777],
94 | 'pants': [239, 240.852],
95 | 'piano': [242, 243.768],
96 | 'pizza': [245, 246.681],
97 | 'plate': [248, 249.668],
98 | 'plug': [251, 252.632],
99 | 'printer': [254, 255.632],
100 | 'radio': [257, 258.801],
101 | 'ramen': [260, 261.666],
102 | 'sax': [263, 264.808],
103 | 'scarf': [266, 267.766],
104 | 'scissors': [269, 270.808],
105 | 'screw': [272, 273.657],
106 | 'shirt': [275, 276.645],
107 | 'shoe': [278, 279.646],
108 | 'soccer ball': [281, 282.881],
109 | 'sock': [284, 285.548],
110 | 'sofa': [287, 288.711],
111 | 'spoon': [290, 291.703],
112 | 'strawberry': [293, 294.889],
113 | 'sunglasses': [296, 298.119],
114 | 'sushi': [300, 301.703],
115 | 'taco': [303, 304.775],
116 | 'timeup': [306, 307.781],
117 | 'toilet': [309, 310.698],
118 | 'traffic light': [312, 314.001],
119 | 'trash can': [316, 317.942],
120 | 'tree': [319, 320.657],
121 | 'truck': [322, 323.647],
122 | 'tv': [325, 326.737],
123 | 'umbrella': [328, 329.726],
124 | 'wallet': [331, 332.693],
125 | 'watch': [334, 335.719],
126 | 'wine': [337, 338.575]
127 | };
128 |
129 | export const SPEECH_SPRITE_TIMESTAMPS_JA: {[key: string]: Array} = {
130 | 'baby bottle': [0, 2.142],
131 | 'backpack': [4, 6.208],
132 | 'banana': [8, 9.855],
133 | 'baseball': [11, 13.233],
134 | 'basketball': [15, 17.473],
135 | 'bathtub': [19, 20.94],
136 | 'bed': [22, 23.806],
137 | 'beer': [25, 26.836],
138 | 'bicycle': [28, 29.978],
139 | 'bird': [31, 32.71],
140 | 'book': [34, 35.72],
141 | 'bowl': [37, 38.828],
142 | 'bread': [40, 41.703],
143 | 'broccoli': [43, 45.183],
144 | 'building': [47, 48.705],
145 | 'burrito': [50, 51.923],
146 | 'bus': [53, 54.749],
147 | 'cabinet': [56, 58.085],
148 | 'camera': [60, 61.873],
149 | 'candle': [63, 64.936],
150 | 'car': [66, 67.866],
151 | 'cassette': [69, 70.975],
152 | 'cat': [72, 73.728],
153 | 'cellphone': [75, 77.341],
154 | 'clock': [79, 80.847],
155 | 'coat': [82, 83.857],
156 | 'cup': [85, 86.858],
157 | 'display': [88, 90.089],
158 | 'dog': [92, 93.699],
159 | 'donut': [95, 96.958],
160 | 'door': [98, 99.692],
161 | 'envelope': [101, 102.991],
162 | 'fish': [104, 105.861],
163 | 'flashlight': [107, 109.52],
164 | 'flower': [111, 112.726],
165 | 'found 0': [114, 116.426],
166 | 'found 10': [118, 120.383],
167 | 'found 1': [122, 124.398],
168 | 'found 2': [126, 128.278],
169 | 'found 3': [130, 132.435],
170 | 'found 4': [134, 136.364],
171 | 'found 5': [138, 140.272],
172 | 'found 6': [142, 144.369],
173 | 'found 7': [146, 148.425],
174 | 'found 8': [150, 152.368],
175 | 'found 9': [154, 156.369],
176 | 'fries': [158, 160.357],
177 | 'frying pan': [162, 164.062],
178 | 'glove': [166, 167.988],
179 | 'guitar': [169, 170.866],
180 | 'hamburger': [172, 174.216],
181 | 'hammer': [176, 177.956],
182 | 'hand': [179, 180.582],
183 | 'hat': [182, 183.842],
184 | 'headphones': [185, 187.091],
185 | 'hotdog': [189, 191.216],
186 | 'house': [193, 194.663],
187 | 'icecream': [196, 198.314],
188 | 'jack o lantern': [200, 202.342],
189 | 'keyboard': [204, 206.089],
190 | 'key': [208, 209.733],
191 | 'laptop': [211, 213.354],
192 | 'lemon': [215, 216.852],
193 | 'light bulb': [218, 219.967],
194 | 'lipstick': [221, 222.971],
195 | 'lock': [224, 225.853],
196 | 'magnifying glass': [227, 229.145],
197 | 'mailbox': [231, 233.231],
198 | 'microphone': [235, 236.854],
199 | 'motor scooter': [238, 240.179],
200 | 'mouse': [242, 243.858],
201 | 'mushroom': [245, 246.882],
202 | 'newspaper': [248, 250.003],
203 | 'orange': [252, 253.92],
204 | 'pants': [255, 256.848],
205 | 'piano': [258, 259.842],
206 | 'pizza': [261, 262.728],
207 | 'plate': [264, 265.822],
208 | 'plug': [267, 268.868],
209 | 'printer': [270, 271.947],
210 | 'radio': [273, 274.874],
211 | 'ramen': [276, 277.959],
212 | 'sax': [279, 281.055],
213 | 'scarf': [283, 284.99],
214 | 'scissors': [286, 287.854],
215 | 'screw': [289, 290.725],
216 | 'shirt': [292, 293.77],
217 | 'shoe': [295, 296.747],
218 | 'soccer ball': [298, 300.388],
219 | 'sock': [302, 303.992],
220 | 'sofa': [305, 306.901],
221 | 'spoon': [308, 309.983],
222 | 'strawberry': [311, 312.815],
223 | 'sunglasses': [314, 316.171],
224 | 'sushi': [318, 319.794],
225 | 'taco': [321, 322.905],
226 | 'timeup': [324, 326.045],
227 | 'toilet': [328, 329.856],
228 | 'traffic light': [331, 333.159],
229 | 'trash can': [335, 336.963],
230 | 'tree': [338, 339.576],
231 | 'truck': [341, 342.958],
232 | 'tv': [344, 345.874],
233 | 'umbrella': [347, 348.736],
234 | 'wallet': [350, 351.859],
235 | 'watch': [353, 355.078],
236 | 'wine': [357, 358.838]
237 | };
238 |
--------------------------------------------------------------------------------
/src/js/utils.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | /**
20 | * Checks if the current platform is iOS.
21 | *
22 | * @returns true if the platform is iOS, false otherwise.
23 | */
24 | function isIOS() {
25 | return /iPhone|iPad|iPod/i.test(navigator.userAgent);
26 | }
27 |
28 | /**
29 | * Checks if the current platform is Android.
30 | *
31 | * @returns true if the platform is Android, false otherwise.
32 | */
33 | function isAndroid() {
34 | return /Android/i.test(navigator.userAgent);
35 | }
36 |
37 | /**
38 | * Checks if the current platform is a mobile device.
39 | *
40 | * @returns true if the platform is a mobile device, false otherwise.
41 | */
42 | function isMobile() {
43 | return isIOS() || isAndroid();
44 | }
45 |
46 | /**
47 | * Checks if the current environment is Chrome.
48 | *
49 | * @returns true if the current environment is Chrome, false otherwise.
50 | */
51 | function isChrome() {
52 | return navigator.userAgent.indexOf('Chrome') !== -1;
53 | }
54 |
55 | /**
56 | * Checks if the current environment is Chrome and the platform is iOS.
57 | *
58 | * @returns true if the current environment is Chrome + iOS, false otherwise.
59 | */
60 | function isChromeIOS() {
61 | return isIOS() && /CriOS/i.test(navigator.userAgent);
62 | }
63 |
64 | /**
65 | * Gets the value of the requested query param.
66 | * @param query The query param to check for.
67 | */
68 | function getQueryParam(query: string) {
69 | if ('URLSearchParams' in (window)) {
70 | let params = (new URL(document.URL)).searchParams;
71 | return params.get(query);
72 | } else {
73 | if (!(window).location.search) {
74 | return undefined;
75 | }
76 | let m = new RegExp(query +
77 | '=([^&]*)').exec((window).location.search.substring(1));
78 | if (!m) {
79 | return undefined;
80 | }
81 | return decodeURIComponent(m[1]);
82 | }
83 | }
84 |
85 | /**
86 | * Detects if the document language is Japanese.
87 | * @returns Whether the document language is Japanese.
88 | */
89 | function isLangJa() {
90 | return document.documentElement.lang === 'ja'
91 | }
92 |
93 | export {getQueryParam, isMobile, isIOS, isAndroid, isChrome, isChromeIOS,
94 | isLangJa};
95 |
96 |
--------------------------------------------------------------------------------
/src/sass/camera.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | $c-camera-capture-flash: rgb(0, 253, 36);
20 | $c-camera-capture-bg: rgba(0, 253, 36, .4);
21 |
22 | @keyframes flash-animation {
23 | from { opacity: 0 }
24 | to { opacity: 1; }
25 | }
26 |
27 | .camera__capture-wrapper {
28 | width: 100%;
29 | height: 100%;
30 | position: absolute;
31 | overflow: hidden;
32 | transition: border-width .1s ease-in-out;
33 | z-index: 2;
34 |
35 | &.capture {
36 | border: black solid;
37 | border-width: 90px 30px 30px 30px;
38 | }
39 |
40 | .camera__capture-flash {
41 | position: absolute;
42 | top: 0;
43 | left: 0;
44 | bottom: 0;
45 | right: 0;
46 | z-index: $zindex-2--camera-flash-layer;
47 |
48 | &.flash {
49 | background: $c-camera-capture-flash;
50 | animation-name: flash-animation;
51 | animation-duration: .1s;
52 |
53 | &.freeze {
54 | mix-blend-mode: multiply;
55 | }
56 | }
57 | }
58 | }
59 |
60 | .camera__element {
61 | height: auto;
62 | left: 50%;
63 | min-height: 100%;
64 | min-width: 100%;
65 | overflow: hidden;
66 | position: absolute;
67 | top: 50%;
68 | transform: translateX(-50%) translateY(-50%);
69 | width: auto;
70 | z-index: 1;
71 |
72 | &.camera-front-facing {
73 | transform: translateX(-50%) translateY(-50%) scale(-1, 1);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/sass/main.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 | @import 'vars';
19 | @import 'mixins';
20 | @import 'ui';
21 | @import 'camera';
22 |
--------------------------------------------------------------------------------
/src/sass/mixins.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | // see https://css-tricks.com/conditional-media-query-mixins/
20 |
21 | @mixin bp($point) {
22 | @if $point == s {
23 | @media #{$screen-s} {
24 | @content;
25 | }
26 | }
27 | @if $point == m {
28 | @media #{$screen-m} {
29 | @content;
30 | }
31 | }
32 | @if $point == l {
33 | @media #{$screen-l} {
34 | @content;
35 | }
36 | } @else if $point == ls {
37 | @media #{$screen-ls} {
38 | @content;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/sass/vars.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * https://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * =============================================================================
17 | */
18 |
19 | /*
20 | * Media Breakpoints
21 | */
22 |
23 | // Small devices (tablets, 600px and up).
24 | $screen-s: '(min-width: 600px)';
25 | // Medium devices (desktops, 1024px and up).
26 | $screen-m: '(min-width: 1440px)';
27 | // Large devices (large desktops, 1200px and up).
28 | $screen-l: '(min-width: 1600px)';
29 | // Landscape mode
30 | $screen-ls: '(max-height: 500px)';
31 |
32 | /*
33 | * Colors
34 | */
35 |
36 | $c-red: #f13c3c;
37 | $c-pink: #e61bd5;
38 | $c-purple: #7c2aa7;
39 | $c-grey: #a99ca8;
40 | $c-focus-outline: #a41698;
41 |
42 | $c-countdown-pink: #e61bd5;
43 | $c-countdown-yellow: #f0bc08;
44 | $c-countdown-green: #50d22c;
45 | $c-countdown-red: #f13c3c;
46 | $c-about-bg-red: #f74d4d;
47 | $c-info-timer-flash: #f8ff00;
48 |
49 | $c-white: #fff;
50 |
51 | /*
52 | * Font Stacks
53 | */
54 |
55 | $display-font: 'Changa One', 'M PLUS 1p', sans-serif;
56 | $body-font: 'Roboto', 'Noto Sans JP', arial, sans-serif;
57 |
58 | /*
59 | * Transition curves
60 | */
61 |
62 | $material-ease-out: cubic-bezier(0, 0, .2, 1);
63 |
--------------------------------------------------------------------------------
/training/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM tensorflow/tensorflow:1.13.1-py3
2 | # Replace this line with `tensorflow/tensorflow:1.13.1-gpu-py3`
3 | # and run with `docker --gpus` when you use GPUs.
4 |
5 | LABEL maintainer="Shuhei Iitsuka "
6 |
7 | RUN apt update
8 |
9 | RUN apt install -y curl
10 |
11 | RUN pip3 install -U pip
12 |
13 | RUN pip3 install keras==2.2.2 tensorflow_hub==0.1.1 h5py==2.8.0
14 |
15 | RUN pip3 install --no-deps tensorflowjs==0.8.6
16 |
17 | WORKDIR /
18 |
19 | RUN curl -O https://raw.githubusercontent.com/tensorflow/tensorflow/v1.7.1/tensorflow/examples/image_retraining/retrain.py
20 |
21 | CMD python3 /retrain.py \
22 | --image_dir /data/images \
23 | --how_many_training_steps=4000 \
24 | --eval_step_interval=100 \
25 | --architecture mobilenet_0.25_224 \
26 | --output_graph /data/graph.pb \
27 | --summaries_dir /data/summaries \
28 | --output_labels /data/output_labels.txt \
29 | --bottleneck_dir /data/bottleneck/ \
30 | --intermediate_store_frequency 1000 \
31 | --intermediate_output_graphs_dir /data/intermediate \
32 | --saved_model_dir /data/saved_model && \
33 | echo 'export const SCAVENGER_CLASSES: {[key: number]: string} = {' > /data/scavenger_classes.ts && \
34 | awk '{print NR-1 ": '\''" $0 "'\'',"}' /data/output_labels.txt >> /data/scavenger_classes.ts && \
35 | echo '}' >> /data/scavenger_classes.ts && \
36 | python3 -m tensorflowjs.converters.converter \
37 | --input_format=tf_saved_model \
38 | --output_node_names='final_result' \
39 | --saved_model_tags=serve \
40 | /data/saved_model/ \
41 | /data/saved_model_web/
42 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "noImplicitAny": true,
5 | "sourceMap": true,
6 | "removeComments": true,
7 | "preserveConstEnums": true,
8 | "declaration": true,
9 | "target": "es5",
10 | "lib": ["es2015", "dom"],
11 | "outDir": "./dist",
12 | "noUnusedLocals": true,
13 | "noImplicitReturns": true,
14 | "noImplicitThis": true,
15 | "alwaysStrict": true,
16 | "noUnusedParameters": false,
17 | "pretty": true,
18 | "noFallthroughCasesInSwitch": true,
19 | "allowUnreachableCode": false,
20 | "experimentalDecorators": true,
21 | "forceConsistentCasingInFileNames": true
22 | },
23 | "include": [
24 | "src/js/"
25 | ],
26 | "exclude": [
27 | "node_modules/",
28 | "dist/"
29 | ]
30 | }
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [true, "check-space"],
5 | "eofline": true,
6 | "forin": true,
7 | "indent": [true, "spaces"],
8 | "jsdoc-format": true,
9 | "label-position": true,
10 | "no-arg": true,
11 | "no-conditional-assignment": true,
12 | "no-construct": true,
13 | "no-debugger": true,
14 | "no-duplicate-variable": true,
15 | "no-empty": true,
16 | "no-inferrable-types": true,
17 | "no-internal-module": true,
18 | "no-shadowed-variable": true,
19 | "no-switch-case-fall-through": true,
20 | "no-trailing-whitespace": true,
21 | "no-unused-expression": true,
22 | "no-use-before-declare": true,
23 | "no-var-keyword": true,
24 | "quotemark": [true, "single"],
25 | "radix": true,
26 | "semicolon": [true, "always"],
27 | "switch-default": true,
28 | "triple-equals": [true, "allow-null-check"],
29 | "variable-name": [true, "check-format", "ban-keywords"],
30 | "max-line-length": [true, 80]
31 | }
32 | }
--------------------------------------------------------------------------------