Skip to content

Commit b8b8002

Browse files
Merge pull request #11 from Anantha-Rao12/master
Added blood smear images
2 parents ffc5668 + d8fae39 commit b8b8002

35 files changed

+79
-11
lines changed

DeleMa_Detect/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [On Desktop](#on-desktop)
1010
- [On Mobile](#on-mobile)
1111
- [Running DeleMa Detect Locally](#running-delema-detect-locally)
12+
- [Sample Blood Smear Images](#sample-blood-smear-images)
1213
- [Contact Us](#contact-us)
1314

1415
# DeleMa Detect Documentation
@@ -170,6 +171,10 @@ Activate the Virtual Environment by running the following.
170171

171172
<br><br>
172173

174+
# Sample BLood Smear Images
175+
176+
We have added upto 20 blood smear images for testing purposes at ```./uploads/```. There are two directories called ```Parasitized``` and ```Uninfected```, each containing upto 10 images. These can be downloaded and tested by running the application locally or on our Heroku platform.
177+
173178
---
174179

175180
## Contact Us

DeleMa_Detect/app.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import glob
66
import re
77
import numpy as np
8+
import time
89

910
# Keras utils
1011
import tensorflow as tf
@@ -21,14 +22,18 @@
2122
app = Flask(__name__)
2223

2324
# Model saved with Keras.save()
24-
MODEL_PATH='./model/VGG_94.52_11102020_8 49.h5'
25+
#MODEL_PATH='./model/custom_cnn_lenet_val_9539_oct_24_1100.h5'
26+
#MODEL_PATH='./model/VGG_94.52_11102020_8 49.h5'
27+
28+
MODEL_PATH = './model/model.h5'
29+
input_size=(100,100)
30+
2531
model = load_model(MODEL_PATH)
2632
probability = 0.3
27-
target_size = (100,100)
2833

29-
def model_predict(img_path,model_path):
34+
def model_predict(img_path,model_path,input_size):
3035

31-
img = image.load_img(img_path,target_size=(target_size))
36+
img = image.load_img(img_path,target_size=input_size)
3237
img_array = image.img_to_array(img)
3338
img_array = np.expand_dims(img_array,axis=0) # changes input shape to a tensor (1,160,160,3)
3439
#img_array = preprocess_input(img_array) # preprocess input based on mobilenet_v2 conventions
@@ -51,20 +56,26 @@ def upload():
5156

5257
# Save the file to ./uploads
5358
basepath = os.path.dirname(__file__)
59+
60+
# Append timestamp to ensure unique filename
5461
file_path = os.path.join(
55-
basepath, 'uploads', secure_filename(f.filename))
62+
basepath, 'uploads', secure_filename(f.filename + str(int(time.time()))))
5663
f.save(file_path)
5764

5865
# Make prediction
59-
prediction = model_predict(file_path, MODEL_PATH)
66+
prediction = model_predict(file_path, MODEL_PATH, input_size)
6067

6168
# Process your result for human
6269
# Preserve the 0- and 1- prefixes
6370
if prediction <= probability:
6471
result = f"1-The Image looks Parasitized.\nThe probability that the blood smear is uninfected is {prediction:.3} "
6572
else:
6673
result=f"0-The Image looks Uninfected.\nThe probability that the blood smear is uninfected is {prediction:.3} "
67-
74+
75+
76+
# Delete the file
77+
os.remove(file_path)
78+
6879
return result
6980
return None
7081

File renamed without changes.

DeleMa_Detect/requirements.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,48 @@ google-auth-oauthlib==0.4.1
1212
google-pasta==0.2.0
1313
greenlet==0.4.17
1414
grpcio==1.32.0
15+
h5py==2.10.0
16+
idna==2.10
17+
itsdangerous==1.1.0
18+
Jinja2==2.11.2
19+
Keras-Preprocessing==1.1.2
20+
Markdown==3.3
21+
MarkupSafe==1.1.1
22+
numpy==1.18.5
23+
oauthlib==3.1.0
24+
opt-einsum==3.3.0
25+
Pillow==7.2.0
26+
protobuf==3.13.0
27+
pyasn1==0.4.8
28+
pyasn1-modules==0.2.8
29+
requests==2.24.0
30+
requests-oauthlib==1.3.0
31+
rsa==4.6
32+
six==1.15.0
33+
tensorboard==2.3.0
34+
tensorboard-plugin-wit==1.7.0
35+
tensorflow==2.3.1
36+
tensorflow-estimator==2.3.0
37+
termcolor==1.1.0
38+
urllib3==1.25.10
39+
Werkzeug==1.0.1
40+
wrapt==1.12.1
41+
zope.event==4.5.0
42+
zope.interface==5.1.2
43+
absl-py==0.10.0
44+
astunparse==1.6.3
45+
cachetools==4.1.1
46+
certifi==2020.6.20
47+
chardet==3.0.4
48+
click==7.1.2
49+
Flask==1.1.2
50+
gast==0.3.3
51+
gevent==20.9.0
52+
google-auth==1.22.1
53+
google-auth-oauthlib==0.4.1
54+
google-pasta==0.2.0
55+
greenlet==0.4.17
56+
grpcio==1.32.0
1557
gunicorn==20.0.4
1658
h5py==2.10.0
1759
idna==2.10

DeleMa_Detect/static/css/main.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
background-color: #333333;
99
}
1010

11+
.navbar-brand {
12+
font-size: 4vmin;
13+
}
14+
1115
.card {
1216
height: 600px;
1317
margin-bottom: 60px;
@@ -135,6 +139,9 @@ h3 span {
135139
height: 100%;
136140
}
137141

142+
a {
143+
white-space: nowrap;
144+
}
138145

139146
/* Footer */
140147

DeleMa_Detect/templates/base.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@
2626
<meta name="msapplication-TileColor" content="#00aba9">
2727
<meta name="msapplication-config" content="{{ url_for('static', filename='favicon/browserconfig.xml') }}">
2828
<meta name="theme-color" content="#ffffff">
29+
30+
<meta name="author" content="Anantha Rao, Purva Parmar">
31+
<meta name="description" content="Malaria Diagnosis from Blood Smear Images">
32+
<meta name="keywords" content="DeleMa Detect, Malaria Diagnosis, Deep Learning, iGEM, IISER Pune">
2933
</head>
3034

3135
<body>
3236
<nav class="navbar navbar-dark">
3337
<div class="container justify-content-end">
34-
<a class="navbar-brand" href="#">DeleMa Detect</a>
38+
<a class="navbar-brand" href="#">DeleMa Detect | iGEM IISER Pune 2020</a>
3539
</div>
3640
</nav>
3741
<div class="container">
@@ -47,8 +51,7 @@
4751
<footer class="footer">
4852
<div class="container-fluid pb-5 text-center">
4953
<div class="credits">
50-
<p class="github">Server Developed by Anantha Rao (<a href="https://github.com/Anantha-Rao12" target="_blank" rel="noopener noreferrer"><svg class="github-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg> Anantha-Rao12</a>)</p>
51-
<p class="github">Designed by Purva Parmar (<a href="https://github.com/TheReconPilot" target="_blank" rel="noopener noreferrer"><svg class="github-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg> TheReconPilot</a>)</p>
54+
<p class="github">Designed and Developed by Anantha Rao (<a href="https://github.com/Anantha-Rao12" target="_blank" rel="noopener noreferrer"><svg class="github-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg> Anantha-Rao12</a>) and Purva Parmar (<a href="https://github.com/TheReconPilot" target="_blank" rel="noopener noreferrer"><svg class="github-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg> TheReconPilot</a>)</p>
5255
<p>As a part of iGEM IISER Pune 2020</p>
5356
</div>
5457
<div class="row align-items-center">

DeleMa_Detect/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h2>About DeleMa Detect</h2>
4040

4141
<p>This is a part of iGEM IISER Pune '20 Project. More details can be found on our <a href="https://2020.igem.org/Team:IISER-Pune-India" target="_blank" rel="noopener noreferrer">Wiki Page</a>.</p>
4242

43-
<p>This Demo Web App is a part of DeleMa Detect, a deep learning framework for malaria diagnosis. Information about the Software and the usage protocol can be found on the <a href="https://2020.igem.org/Team:IISER-Pune-India/DeLeMa_Detect" target="_blank" rel="noopener noreferrer">DeleMa Detect Wiki Page</a>.</p>
43+
<p>This Demo Web App is a part of DeleMa Detect, a deep learning framework for malaria diagnosis. Information about the Software and the usage protocol can be found on the <a href="https://2020.igem.org/Team:IISER-Pune-India/Software" target="_blank" rel="noopener noreferrer">DeleMa Detect Wiki Page</a>.</p>
4444

4545
<p>The Server Code can be found on <a href="https://github.com/igemsoftware2020/IISER-Pune-India" target="_blank" rel="noopener noreferrer">iGEM IISER Pune's GitHub Repo</a>.</p>
4646
</div>
1.47 KB
Loading
1.28 KB
Loading

0 commit comments

Comments
 (0)