Skip to content

Commit 73e84f5

Browse files
authored
Update README.md
1 parent dbe2335 commit 73e84f5

File tree

1 file changed

+48
-25
lines changed

1 file changed

+48
-25
lines changed

README.md

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,98 @@
11
[![Build Status](https://github.com/code-dot-org/ml-activities/actions/workflows/deploy.yml/badge.svg?branch=main)](https://github.com/code-dot-org/ml-activities/actions/workflows/deploy.yml)
22

33

4-
# AI for Oceans
4+
# **AI for Oceans**
55

6-
This is the repo for AI for Oceans from Code.org.
6+
This is the repo for **AI for Oceans** from Code.org.
77

8-
Like the Dance Party repo, it is a standalone repo that is published as an NPM package, and consumed by the main repo.
8+
Like the Dance Party repo, it is a standalone repo that is published as an [NPM package](https://www.npmjs.com/package/@code-dot-org/ml-activities), and consumed by the [main repo](https://github.com/code-dot-org/code-dot-org).
99

10-
AI for Oceans was produced for the Hour of Code in 2019. It provides the student experience for the 5 interactive levels in the AI for Oceans script at https://studio.code.org/s/oceans.
10+
**AI for Oceans** was produced for the Hour of Code in 2019. This module provides the student experience for the 5 interactive levels in the **AI for Oceans** script at https://studio.code.org/s/oceans.
1111

1212
# Design notes
1313

1414
## Modes
1515

16-
These 5 levels are invoked with a "mode" parameter:
16+
These 5 levels are invoked with a "mode" (stored internally as `appMode`) parameter:
1717

18-
### fishvtrash
18+
### `fishvtrash`
1919

2020
The user trains the AI to differentiate between fish versus trash, and then examine the results.
2121

22-
### creaturesvtrashdemo
22+
### `creaturesvtrashdemo`
2323

2424
Next, the concept of non-fish sea creatures is introduced to show that AI is only as good as its training. In this mode, the experience is abbreviated: the user doesn't do training, but rather the mode demonstrates what happens when fish-specific training encounters non-fish.
2525

26-
### creaturesvtrash
26+
### `creaturesvtrash`
2727

2828
In this mode, the user trains the AI again, but this time encountering fish, non-fish creatures, and trash.
2929

30-
### short
30+
### `short`
3131

3232
In this mode, the user chooses from one of six adjectives and then categorizes fish based on that. The AI is trained on which fish fit into this arbitrary category or not, and then demonstrates this training.
3333

34-
### long
34+
### `long`
3535

3636
In this mode, the user chooses from one of fifteen adjectives. With more subjectivity in this list, the user can explore more subtle implications of training and recognition.
3737

38+
## ML technology
3839

3940
Adapted from content at https://code.org/oceans:
4041

41-
Levels 2-4 use a pretrained model provided by the [TensorFlow](https://www.tensorflow.org/) [MobileNet](https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md) project. A MobileNet model is a [convolutional neural network](https://developers.google.com/machine-learning/practica/image-classification/convolutional-neural-networks) that has been trained on [ImageNet](http://www.image-net.org/), a dataset of over 14 million images hand-annotated with words such as "balloon" or "strawberry". In order to customize this model with the labeled training data the student generates in this activity, we use a technique called [Transfer Learning](https://en.wikipedia.org/wiki/Transfer_learning). Each image in the training dataset is fed to MobileNet, as pixels, to obtain a list of annotations that are most likely to apply to it. Then, for a new image, we feed it to MobileNet and compare its resulting list of annotations to those from the training dataset. We classify the new image with the same label (such as "fish" or "not fish") as the images from the training set with the most similar results.
42+
> Levels 2-4 (`fishvtrash`, `creaturesvtrashdemo`, `creaturesvtrash`) use a pretrained model provided by the [TensorFlow](https://www.tensorflow.org/) [MobileNet](https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md) project. A MobileNet model is a [convolutional neural network](https://developers.google.com/machine-learning/practica/image-classification/convolutional-neural-networks) that has been trained on [ImageNet](http://www.image-net.org/), a dataset of over 14 million images hand-annotated with words such as "balloon" or "strawberry". In order to customize this model with the labeled training data the student generates in this activity, we use a technique called [Transfer Learning](https://en.wikipedia.org/wiki/Transfer_learning). Each image in the training dataset is fed to MobileNet, as pixels, to obtain a list of annotations that are most likely to apply to it. Then, for a new image, we feed it to MobileNet and compare its resulting list of annotations to those from the training dataset. We classify the new image with the same label (such as "fish" or "not fish") as the images from the training set with the most similar results.
4243

43-
Levels 6-8 use a [Support-Vector Machine](https://en.wikipedia.org/wiki/Support-vector_machine) (SVM). We look at each component of the fish (such as eyes, mouth, body) and assemble all of the metadata for the components (such as number of teeth, body shape) into a vector of numbers for each fish. We use these vectors to train the SVM. Based on the training data, the SVM separates the "space" of all possible fish into two parts, which correspond to the classes we are trying to learn (such as "blue" or "not blue").
44+
> Levels 6-8 (`short`, `long`) use a [Support-Vector Machine](https://en.wikipedia.org/wiki/Support-vector_machine) (SVM). We look at each component of the fish (such as eyes, mouth, body) and assemble all of the metadata for the components (such as number of teeth, body shape) into a vector of numbers for each fish. We use these vectors to train the SVM. Based on the training data, the SVM separates the "space" of all possible fish into two parts, which correspond to the classes we are trying to learn (such as "blue" or "not blue").
4445
45-
## Screens
46+
## Scenes
4647

47-
The AI for Oceans script forms a linear narrative structure. The app is designed to deliver the interactive levels for this script, one mode at a time, with no need to persist data to the browser or server between each level.
48+
The **AI for Oceans** script presents a linear narrative structure. The app is designed to deliver the interactive levels for this script, one mode at a time, with no need to persist data to the browser or server between each level.
4849

49-
The app itself contains a variety of "scenes", with each mode using a different subset. The scenes are as follows:
50+
The app itself contains a variety of "scenes", with each mode using a different subset. The scenes (known as `currentMode` internally) are as follows:
51+
52+
### `loading`
53+
54+
<img width="1512" alt="loading" src="https://user-images.githubusercontent.com/2205926/165215465-9433a9eb-7114-4a50-8dfd-bac8d39e5837.png">
5055

51-
### loading
5256

5357
A simple loading screen.
5458

55-
### words
59+
### `words`
60+
61+
<img width="1512" alt="words" src="https://user-images.githubusercontent.com/2205926/165215477-045f46b3-1706-499d-a04e-892dd924157c.png">
62+
63+
64+
Select adjectives for the `short` & `long` modes.
65+
66+
### `train`
67+
68+
<img width="1512" alt="train" src="https://user-images.githubusercontent.com/2205926/165215505-c37975a2-29f5-4126-a19e-0311e113d4d2.png">
5669

57-
Select adjectives for the short & long modes.
5870

59-
### train
71+
The user trains the AI by choosing one of two options (true or false) for each item (fish, non-fish sea creatures, trash).
6072

61-
The user trains the AI by choosing one of two options for each item (fish, non-fish sea creatures, trash).
73+
### `predict`
6274

63-
### predict
75+
<img width="1512" alt="predict" src="https://user-images.githubusercontent.com/2205926/165215521-033e4ff4-cda6-475f-8f78-9ceaf91fcaa2.png">
6476

65-
The user watches AI categorizing items, one at a time.
77+
The user watches A.I. (the "bot") categorizing items, one at a time.
6678

67-
### pond
79+
### `pond`
80+
81+
<img width="1512" alt="pond-true" src="https://user-images.githubusercontent.com/2205926/165215549-926a481a-87e7-496c-86b3-cedb99a7ec38.png">
82+
83+
<img width="1512" alt="pond-false" src="https://user-images.githubusercontent.com/2205926/165215539-928a1381-ee55-461b-bd13-e3ede88bbe04.png">
6884

6985
The user shows the results of the predictions. The user can toggle between the matching & non-matching sets. In short & long, the user can click each item to view additional information about the AI's recognition.
7086

87+
In the `short` and `long` modes, the pond also has a metapanel which can show general information about the ML processing, or, when a fish is selected, specific information about that fish's categorization:
88+
89+
<img width="1512" alt="pond_info" src="https://user-images.githubusercontent.com/2205926/165217317-fa752d7e-1b8c-4755-9014-e6fa19df645b.png">
90+
91+
<img width="1512" alt="pond_fishinfo" src="https://user-images.githubusercontent.com/2205926/165217326-c041e226-0f05-4e9c-87bb-37981b9efc23.png">
92+
7193
## Graphics & UI
7294

73-
The app uses two layers in the DOM. Underneath, a canvas provides the background and all the sprites. On top, a regular DOM uses HTML elements to provide the user interface.
95+
The app uses two layers in the DOM. Underneath, a canvas provides the background and all the sprites. On top, a regular DOM uses HTML elements to provide the user interface. The HTML interface is implemented in React.
7496

7597
The app is fully responsive by scaling the canvas and also scaling the size of the HTML elements correspondingly. The UI simply shrinks to match the underlying canvas.
7698

@@ -94,12 +116,13 @@ See the implementation at https://github.com/code-dot-org/ml-activities/blob/mai
94116

95117
This simple system enabled the team to add a detailed narrative voice to the script, and allowed a variety of team members to contribute text.
96118

119+
# Additional information
120+
97121
## Common operations
98122

99123
The documentation for common operations for AI Lab is comprehensive and should apply to this project too: https://github.com/code-dot-org/ml-playground#common-operations
100124

101125

102-
103126
## Getting started
104127

105128
Steps to get up and running:

0 commit comments

Comments
 (0)