-
Notifications
You must be signed in to change notification settings - Fork 0
/
machineLearning.html
274 lines (232 loc) · 11.6 KB
/
machineLearning.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<!DOCTYPE html>
<html lang="en" id = "html"></html>
<script src = "JavaScript/jquery-3.4.1.js"></script>
<script src = "JavaScript/tf.min.js"></script>
<script>
$(function(){
$("header").load("header.html");
$("head").load("head.html");
$("footer").load("footer.html");
});
</script>
<head>
</head>
<style>
img{
position: relative;
border: solid black 1px;
}
.image-view, img{
height: 450px;
width: 800px;
max-width: 800px;
max-height: 450px;
}
</style>
<body hidden>
<header></header>
<script>
boxWidth = 0;
if (window.matchMedia('(max-width: 1300px)').matches) {
boxWidth = 40;
} else {
boxWidth = 44;
}
</script>
<div id = "content" >
<div id = "top">
<h1 class="header">Machine Learning Projects </h1>
<p class="notice" > * These projects use machine learning which is very cpu intensive. Some projects may not run on mobile devices</p>
<br>
</div>
</div>
<!-- <main id = "content" >
<div id="main-title-holder">
<h1 id="mainTitle">Jon's Portfolio </h1>
<img id = "profilePicture" src="Images/profile.jpg" alt="Image of Jon Menard" hidden>
</div>
</main> -->
<main class= "gameHolder" >
<section class="sectionContainer">
<div class="textHolder">
<h3>1. Evolutionary AI (Genetic Algorithm)</h3>
<strong>Description: </strong>
This is an example of an extremely simple artificial intelligence. Using a ranking system, the top half of dots from the previous
generation are duplicated and passed on to the next generation. Each dot's instruction is then mutated based off how well they did,
and another attempt to reach the destination is attempted. The process is repeated endlessly. A perfect result will never be achieved,
since mutation will always occur. Over time the dots should make progress towards the destination, however because of how simple this algorithm
is, it is possible for a solution to never happen. This algorithm is often refered to as the Genetic Algorithm<br><br>
<strong>Instructions: </strong>
In order to run a simulation, press Start. Clicking and dragging will draw rectangles that the dots must avoid. Pressing Undo will remove the last
object drawn. Reset clears the entire screen. Pressing Stop will pause the simulation. Show More and Show Less will toggle the amount of generations
that are run in the background before another one is shown.
</div>
<div id="aiContainer">
<div id="ai">
<div id="aiInformation">Generation: 0</div>
<div id="aiButtons">
<button class = "aiButton" id= "start">Start</button>
<button class = "aiButton" id= "stop">Stop</button>
<button class = "aiButton" id= "resetAI">Reset</button>
<button class = "aiButton" id= "remove">Undo</button>
<button class = "aiButton" id= "show">Show Less</button>
<button class = "aiButton" id= "less">Show More</button>
</div>
<canvas id = "screen" height="600px" width="600px"></canvas>
<script src = "JavaScript/ai.js"></script>
</div>
</div>
</section>
<section class="sectionContainer">
<div class = "textHolder" >
<h3>2. ML Car Detector (Supervised Learning)</h3>
<strong>About:</strong> Detect if a car is in an image using my trained machine learning model. Drag or drop an image
to see if the model predicts the presence of a car in the image. The model was trainied using a 40,000 image dataset hand sorted by myself.
The dataset is still in progress and the model will be re-trained once it is complete. The dataset and model training source code can be found on my <a class="whiteHref" href = "https://github.com/jonmenard/mlCarDetector" >github page</a>
</div>
<div id="formContainer" class="ui massive white segment">
<form class="ui massive form" action = "/uploadfile" method="post" id="mlImageForm">
<h2 class="ui dividing">Upload Images to Analyze</h2>
<div class="ui icon input">
<div id="drop-region">
<div class="drop-message">
Drag & Drop Images or Click to Upload
</div>
<div id="image-preview">
<!-- <div class = "image-view">
<img src="00_7c1f7804-bb196f49.jpg" alt="Girl in a jacket">
<div class = "imgResult">
</div>
<div class = "overlay">
</div>
<div class = "feedback">
<button class="feedbackButton wrong" value="22_75844058-fe62-4697-ae4f-ab3886414e49.jpg">
Wrong
</button>
<button class="feedbackButton correct" value="22_75844058-fe62-4697-ae4f-ab3886414e49.jpg">
Correct
</button>
</div>
</div> -->
</div>
</div>
</div>
</form>
</div>
</section>
<section class="sectionContainer">
<div class="textHolder">
<h3>3. Self Driving Car (Reinforcement Learning)</h3>
<strong>Description: </strong> A Self-Driving Car trainied using Reinforcement Learning
</div>
<div id="gameContainer" >
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas" style="margin:auto" width=5962 height=3353></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-fullscreen-button"></div>
</div>
</div>
<script>
var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
}
var buildUrl = "./machineLearning/selfDrivingCar/Build";
var loaderUrl = buildUrl + "/WEB_GL2.loader.js";
var config = {
dataUrl: buildUrl + "/WEB_GL2.data",
frameworkUrl: buildUrl + "/WEB_GL2.framework.js",
codeUrl: buildUrl + "/WEB_GL2.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "Unity Technologies",
productName: "UnityEnvironment",
productVersion: "1.0",
matchWebGLToCanvasSize: false,
// showBanner: unityShowBanner,
};
// By default Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
container.className = "unity-mobile";
// Avoid draining fillrate performance on mobile devices,
// and default/override low DPI mode on mobile browsers.
config.devicePixelRatio = 0;
unityShowBanner('WebGL builds are not supported on mobile devices.');
} else {
config.devicePixelRatio = 0;
canvas.style.width = 1920
canvas.style.height = 1080
}
loadingBar.style.display = "block";
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
</div>
</section>
</main>
<footer></footer>
</body>
<script type="module" src = "JavaScript/carDetector.js"></script>
<script>
$(function(){
$("#machineLearning").before()
});
$("#mlImageForm").css("width", boxWidth * 24 + 10 );
function reSizeALL(){
let flappyBackgroundCanvas = document.getElementById("unity-canvas");
flappyBackgroundCanvas.style.maxHeight = "1000px"
flappyBackgroundCanvas.style.maxWidth = "1500px"
// unityInstance.SetFullscreen(1);
}
window.addEventListener("load", reSizeALL);
</script>
</html>