-
Notifications
You must be signed in to change notification settings - Fork 1
/
vis.html
87 lines (67 loc) · 2.38 KB
/
vis.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HS CNN</title>
<meta name="author" content="syt123450 / https://github.com/syt123450">
<script src="three.min.js"></script>
<script src="tween.min.js"></script>
<script src="tf.min.js"></script>
<script src="TrackballControls.js"></script>
<script src="tensorspace.min.js"></script>
<script src="jquery.min.js"></script>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#container {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="container"></div>
<script>
$(function() {
let modelContainer = document.getElementById( "container" );
let model = new TSP.models.Sequential(modelContainer);
model.add(new TSP.layers.GreyscaleInput({ shape: [ 272, 462, 2] }));
//model.add(new TSP.layers.GrayscaleInput({ shape: [ 272, 462,2] }));
model.add(new TSP.layers.Conv2d({ kernelSize: [7,7], filters: 4, strides: 1 , padding: 'same'}));
model.add(new TSP.layers.Pooling2d({ poolSize: [3, 3], strides: [3, 3] }));
model.add(new TSP.layers.Conv2d({ kernelSize: [7,7], filters: 16, strides: 1 }));
model.add(new TSP.layers.Pooling2d({ poolSize: [3, 3], strides: [3, 3] }));
model.add(new TSP.layers.Conv2d({ kernelSize: [7,7], filters: 32, strides: 1 }));
model.add(new TSP.layers.Pooling2d({ poolSize: [3, 3], strides: [3, 3] }));
model.add(new TSP.layers.Conv2d({ kernelSize: [7,7], filters: 64, strides: 1 }));
model.add(new TSP.layers.Flatten( { shape : [ 3840 ] } ));
model.add(new TSP.layers.Dense( { shape : [ 84 ] ,initStatus: "open" } ));
model.add(new TSP.layers.Dense( { shape : [ 20 ],initStatus: "open" } ));
model.add( new TSP.layers.Output1d({
units : 2,
outputs: ["Normal", "Abnormal"]
}) );
model.load({
type: "tensorflow",
url: 'latest_hybrid/model.json'
});
model.init( function() {
console.log("Model Loaded");
$.ajax({
url: "latest_hybrid/hybrid_1.json",
type: 'GET',
async: true,
dataType: 'json',
success: function (data) {
model.predict( data );
}
});
} );
});
</script>
</body>
</html>