abakirci commited on
Commit
88e2a01
1 Parent(s): 3bb01e4

Upload 4 files

Browse files

This project focuses on the application of Convolutional Neural Networks (CNN) and Transfer Learning techniques to classify malaria from cell images. In this project, we develop a CNN model by using Transfer Learning to leverage knowledge from pre-trained networks with a dataset specifically compiled for malaria-infected and uninfected blood smear images. The objective is to accurately distinguish between infected and uninfected cells, thereby assisting in rapid and efficient malaria diagnosis.

Files changed (4) hide show
  1. app.py +46 -0
  2. malaria.jpeg +0 -0
  3. model_malaria_detection.h5 +3 -0
  4. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from tensorflow.keras.models import load_model
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ model = load_model("model_malaria_detection.h5")
7
+
8
+ def process_image(img):
9
+ img = img.convert("RGB")
10
+ img = img.resize((50,50))
11
+ img = np.array(img)
12
+ if img.ndim == 2:
13
+ img = np.stack((img,)*3, axis=-1)
14
+ img = img/255.0
15
+ img = np.expand_dims(img, axis=0)
16
+ return img
17
+
18
+ st.title("MALARIA RECOGNITION")
19
+ st.divider()
20
+
21
+ col1, col2, col3 = st.columns([1,2,1])
22
+ with col2:
23
+ st.image("malaria.jpeg")
24
+ st.divider()
25
+
26
+ st.success("Upload your malaria image from blood cell and classify the images with the following labels: Uninfected and Parasitized with CNN deep learning.")
27
+ st.divider()
28
+
29
+ st.write("Upload your image and see the results")
30
+ st.divider()
31
+
32
+ file = st.file_uploader("Choose an image", type=["jpg", "jpeg", "png", "webp"])
33
+
34
+ if file is not None:
35
+ img = Image.open(file)
36
+ st.image(img, caption="Uploaded image")
37
+ image = process_image(img)
38
+ prediction = model.predict(image)
39
+ predicted_class = np.round(prediction)
40
+ predicted_class = int(predicted_class.flatten())
41
+
42
+
43
+
44
+ class_names = {0:"Parasitized", 1:"Uninfected"}
45
+
46
+ st.write(f"Predicted Malaria Type: {class_names[predicted_class]}")
malaria.jpeg ADDED
model_malaria_detection.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35a2f3b6e2c895b7c2cc86ec5a2bc9028d1359f8ee3924a6f2597b51a309a1e1
3
+ size 67088408
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ tensorflow