-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
395 lines (371 loc) · 16.4 KB
/
index.html
File metadata and controls
395 lines (371 loc) · 16.4 KB
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<! doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AI Handwriting Classifier - Neural Network Digit Recognition</title>
<link rel="stylesheet" href="css/style.css">
<meta name="description" content="Advanced handwriting digit classifier using TensorFlow.js and deep convolutional neural networks">
<meta property="og:title" content="AI Handwriting Classifier">
<meta property="og: type" content="website">
<meta property="og:url" content="">
<meta property="og: image" content="">
<meta property="og:image:alt" content="AI Handwriting Recognition">
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="icon.png">
<link rel="manifest" href="site.webmanifest">
<meta name="theme-color" content="#6366f1">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<!-- TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@4.1.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-vis@1.5.1"></script>
</head>
<body>
<!-- Background Animation -->
<div class="animated-background">
<div class="gradient-orb orb-1"></div>
<div class="gradient-orb orb-2"></div>
<div class="gradient-orb orb-3"></div>
</div>
<!-- Header -->
<header class="header">
<div class="container">
<div class="logo">
<svg width="40" height="40" viewBox="0 0 40 40" fill="none">
<rect width="40" height="40" rx="10" fill="url(#gradient)"/>
<path d="M12 20L18 26L28 14" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="gradient" x1="0" y1="0" x2="40" y2="40">
<stop offset="0%" stop-color="#6366f1"/>
<stop offset="100%" stop-color="#8b5cf6"/>
</linearGradient>
</defs>
</svg>
<h1>AI Handwriting Classifier</h1>
</div>
<div class="header-stats">
<div class="stat-item">
<span class="stat-label">Model Status</span>
<span class="stat-value" id="modelStatus">Initializing...</span>
</div>
<button class="btn btn-icon hidden" id="toggleVisorBtn" title="Toggle Training Graphs">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="20" x2="18" y2="10"></line>
<line x1="12" y1="20" x2="12" y2="4"></line>
<line x1="6" y1="20" x2="6" y2="14"></line>
</svg>
<span>Show Graphs</span>
</button>
</div>
</div>
</header>
<!-- Main Content -->
<main class="main-content">
<div class="container">
<!-- Welcome Section (before training) -->
<section class="section welcome-section" id="welcomeSection">
<div class="card glass-card welcome-card">
<div class="card-body text-center">
<div class="welcome-icon">
<svg width="120" height="120" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M12 2L2 7l10 5 10-5-10-5z"></path>
<path d="M2 17l10 5 10-5"></path>
<path d="M2 12l10 5 10-5"></path>
</svg>
</div>
<h2>Welcome to AI Handwriting Classifier</h2>
<p class="welcome-description">
This application uses a Deep Convolutional Neural Network (CNN) to recognize handwritten digits (0-9).
<br>The model will be trained on the MNIST dataset with <strong>5,500 training samples</strong> and <strong>1,000 test samples</strong>.
<br>Features <strong>3 convolutional layers</strong> with increasing filter depths (32→64→128) for superior accuracy.
</p>
<div class="welcome-features">
<div class="feature-item">
<span class="feature-icon">🧠</span>
<strong>Deep Learning</strong>
<p>3 Convolutional Layers</p>
</div>
<div class="feature-item">
<span class="feature-icon">⚡</span>
<strong>Fast Training</strong>
<p>~2-3 minutes</p>
</div>
<div class="feature-item">
<span class="feature-icon">🎯</span>
<strong>High Accuracy</strong>
<p>~96-98% accuracy</p>
</div>
</div>
<div class="model-info">
<h3>Model Architecture</h3>
<div class="architecture-summary">
<span class="layer-badge">Input (28×28)</span>
<span class="arrow">→</span>
<span class="layer-badge">Conv2D (32)</span>
<span class="arrow">→</span>
<span class="layer-badge">Pool</span>
<span class="arrow">→</span>
<span class="layer-badge">Conv2D (64)</span>
<span class="arrow">→</span>
<span class="layer-badge">Pool</span>
<span class="arrow">→</span>
<span class="layer-badge">Conv2D (128)</span>
<span class="arrow">→</span>
<span class="layer-badge">Dense (256)</span>
<span class="arrow">→</span>
<span class="layer-badge">Dense (128)</span>
<span class="arrow">→</span>
<span class="layer-badge">Dense (64)</span>
<span class="arrow">→</span>
<span class="layer-badge">Output (10)</span>
</div>
</div>
<button class="btn btn-primary btn-large" id="startTrainingBtn">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="5 3 19 12 5 21 5 3"></polygon>
</svg>
Start Training
</button>
</div>
</div>
</section>
<!-- Training Progress Section -->
<section class="section training-section hidden" id="trainingSection">
<div class="card glass-card">
<div class="card-header">
<h2>🧠 Training Neural Network</h2>
<p>Training a deep convolutional neural network on the MNIST dataset</p>
</div>
<div class="card-body">
<div class="progress-container">
<div class="progress-info">
<span class="progress-label">Training Progress</span>
<span class="progress-percentage" id="progressPercentage">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" id="progressFill"></div>
</div>
<div class="training-stats">
<div class="training-stat">
<span class="stat-icon">📊</span>
<span class="stat-text">Epoch: <strong id="currentEpoch">0/10</strong></span>
</div>
<div class="training-stat">
<span class="stat-icon">🎯</span>
<span class="stat-text">Accuracy: <strong id="currentAccuracy">0%</strong></span>
</div>
<div class="training-stat">
<span class="stat-icon">📉</span>
<span class="stat-text">Loss: <strong id="currentLoss">-</strong></span>
</div>
<div class="training-stat">
<span class="stat-icon">✅</span>
<span class="stat-text">Val Accuracy: <strong id="currentValAccuracy">0%</strong></span>
</div>
</div>
</div>
<div class="loader-container">
<div class="neural-loader">
<div class="neural-node"></div>
<div class="neural-node"></div>
<div class="neural-node"></div>
<div class="neural-node"></div>
</div>
<p class="loader-text">Training in progress... Please wait</p>
</div>
</div>
</div>
</section>
<!-- Drawing and Prediction Section -->
<section class="section drawing-section hidden" id="drawingSection">
<div class="grid-layout">
<!-- Drawing Canvas Card -->
<div class="card glass-card canvas-card">
<div class="card-header">
<h2>✍️ Draw a Digit (0-9)</h2>
<p>Draw any digit in the canvas below</p>
</div>
<div class="card-body">
<div class="canvas-container">
<canvas id="canvas" width="280" height="280"></canvas>
<div class="canvas-overlay" id="canvasOverlay">
<div class="overlay-content">
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<path d="M12 5v14M5 12h14" stroke-width="2" stroke-linecap="round"></path>
</svg>
<p>Start drawing here</p>
</div>
</div>
</div>
<!-- Pen Size Control -->
<div class="pen-size-control">
<label for="penSize">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 20h9M16. 5 3. 5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>
</svg>
Pen Size: <strong id="penSizeValue">24</strong>px
</label>
<input type="range" id="penSize" min="4" max="40" value="24" step="2">
<div class="pen-preview">
<div class="pen-preview-dot" id="penPreview"></div>
</div>
</div>
<div class="canvas-controls">
<button class="btn btn-primary" id="classifyBtn" disabled>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="9 11 12 14 22 4"></polyline>
<path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path>
</svg>
Classify Digit
</button>
<button class="btn btn-secondary" id="clearBtn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 6h18"></path>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
Clear Canvas
</button>
</div>
</div>
</div>
<!-- Prediction Results Card -->
<div class="card glass-card prediction-card">
<div class="card-header">
<h2>🎯 Prediction Results</h2>
<p>AI confidence scores for each digit</p>
</div>
<div class="card-body">
<div class="prediction-result" id="predictionResult">
<div class="result-placeholder">
<svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<circle cx="12" cy="12" r="10"></circle>
<path d="M12 6v6l4 2"></path>
</svg>
<p>Draw a digit and click "Classify" to see predictions</p>
</div>
</div>
<div class="predictions-list hidden" id="predictionsList">
<div class="predicted-digit" id="predictedDigit">-</div>
<div class="confidence-bars" id="confidenceBars">
<!-- Generated dynamically -->
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Model Architecture Section -->
<section class="section architecture-section hidden" id="architectureSection">
<div class="card glass-card">
<div class="card-header">
<h2>🏗️ Neural Network Architecture</h2>
<p>Deep Convolutional Neural Network (CNN) with 3 conv layers</p>
</div>
<div class="card-body">
<div class="architecture-visual">
<div class="layer-item">
<div class="layer-icon input-layer">INPUT</div>
<div class="layer-info">
<strong>Input Layer</strong>
<span>28×28×1</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon conv-layer">CONV</div>
<div class="layer-info">
<strong>Conv2D + ReLU</strong>
<span>32 filters, 3×3</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon pool-layer">POOL</div>
<div class="layer-info">
<strong>MaxPooling2D</strong>
<span>2×2</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon conv-layer">CONV</div>
<div class="layer-info">
<strong>Conv2D + ReLU</strong>
<span>64 filters, 3×3</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon pool-layer">POOL</div>
<div class="layer-info">
<strong>MaxPooling2D</strong>
<span>2×2</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon conv-layer">CONV</div>
<div class="layer-info">
<strong>Conv2D + ReLU</strong>
<span>128 filters, 3×3</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon dense-layer">FLATTEN</div>
<div class="layer-info">
<strong>Flatten</strong>
<span>1152 units</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon dense-layer">DENSE</div>
<div class="layer-info">
<strong>Dense + ReLU</strong>
<span>256 units</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon dense-layer">DENSE</div>
<div class="layer-info">
<strong>Dense + ReLU</strong>
<span>128 units</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon dense-layer">DENSE</div>
<div class="layer-info">
<strong>Dense + ReLU</strong>
<span>64 units</span>
</div>
</div>
<div class="layer-arrow">→</div>
<div class="layer-item">
<div class="layer-icon output-layer">OUTPUT</div>
<div class="layer-info">
<strong>Dense + Softmax</strong>
<span>10 classes</span>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</main>
<!-- Hidden canvas for image processing -->
<img id="canvasimg" style="display: none;" alt="Canvas capture" src="">
<!-- Toast Notifications -->
<div class="toast-container" id="toastContainer"></div>
<!-- Scripts -->
<script src="/js/data.js" type="module"></script>
<script src="/js/app.js" type="module"></script>
</body>
</html>