Upload 7 files
Browse files- classes.json +1 -0
- group1-shard1of4.bin +3 -0
- group1-shard2of4.bin +3 -0
- group1-shard3of4.bin +3 -0
- group1-shard4of4.bin +3 -0
- index.html +49 -0
- model.json +0 -0
classes.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"Long Standing Retinal VascularOcclusion": 0, "Macular Edema Related to Retinal Vein Occlusion": 1, "Retinal Artery Occlusion": 2, "Normal": 3}
|
group1-shard1of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6890cd2ea23c50e412e7c775e24160fdb78b64da7780fbee97a573d85779ee7b
|
| 3 |
+
size 4194304
|
group1-shard2of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b704a9bbfe1e7c399248c5de12db901b63fdbe4839403ecf8552f2d30e495950
|
| 3 |
+
size 4194304
|
group1-shard3of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b2f8e200ae7290e1727680f876ac3d0ad84a4c7ff12761ef2ebd6dc3bd9d8c7
|
| 3 |
+
size 4194304
|
group1-shard4of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87e951de3a9b12f0bb96fdcff2c8915d785de82c8789f19ac50e90a98079ceb9
|
| 3 |
+
size 3384452
|
index.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
|
| 5 |
+
</head>
|
| 6 |
+
<body>
|
| 7 |
+
|
| 8 |
+
Make sure to run this via a server
|
| 9 |
+
|
| 10 |
+
<br>
|
| 11 |
+
<input accept="image/*" type='file' id="input_button" />
|
| 12 |
+
|
| 13 |
+
<br>
|
| 14 |
+
<img id="img1" src="./image.jpg" style="width: 300px " />
|
| 15 |
+
<br> <br>
|
| 16 |
+
<button onclick="predict()">predict</button>
|
| 17 |
+
<br>
|
| 18 |
+
<p id="result"> </p>
|
| 19 |
+
|
| 20 |
+
<script>
|
| 21 |
+
|
| 22 |
+
let image = document.getElementById('img1');
|
| 23 |
+
let input_button = document.getElementById('input_button');
|
| 24 |
+
|
| 25 |
+
input_button.onchange = evt => {
|
| 26 |
+
const [file] = input_button.files
|
| 27 |
+
if (file) {
|
| 28 |
+
image.src = URL.createObjectURL(file)
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
async function predict() {
|
| 33 |
+
var model = await tf.loadGraphModel('./model.json');
|
| 34 |
+
|
| 35 |
+
let example = tf.browser.fromPixels(document.getElementById("img1") , 3 ).cast('float32');
|
| 36 |
+
console.log( example.shape )
|
| 37 |
+
example = example.reshape([1,example.shape[0], example.shape[1] ,example.shape[2]]);
|
| 38 |
+
|
| 39 |
+
let prediction = await model.predict(example);
|
| 40 |
+
let class_scores = await prediction.data();
|
| 41 |
+
let max_score_id = class_scores.indexOf(Math.max(...class_scores));
|
| 42 |
+
let classes = [ "Long Standing Retinal VascularOcclusion" , "Macular Edema Related to Retinal Vein Occlusion" , "Retinal Artery Occlusion" , "Normal" , ] ;
|
| 43 |
+
|
| 44 |
+
console.log(class_scores);
|
| 45 |
+
document.getElementById("result").innerHTML = classes[max_score_id].toString();
|
| 46 |
+
}
|
| 47 |
+
</script>
|
| 48 |
+
</body>
|
| 49 |
+
</html>
|
model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|