Spaces:
Running
Running
Upload 6 files
Browse files- .gitattributes +1 -0
- deploypalm.py +36 -0
- model/keras_metadata.pb +3 -0
- model/saved_model.pb +3 -0
- model/variables/variables.data-00000-of-00001 +3 -0
- model/variables/variables.index +0 -0
- requirements.txt +5 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
|
deploypalm.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import streamlit as st
|
3 |
+
import cv2
|
4 |
+
from PIL import Image
|
5 |
+
import numpy as np
|
6 |
+
import tensorflow as tf
|
7 |
+
from tensorflow.keras.applications.resnet50 import preprocess_input
|
8 |
+
from tensorflow.keras.preprocessing.image import img_to_array
|
9 |
+
|
10 |
+
st.title('Palm Identification')
|
11 |
+
st.markdown("This is a Deep Learning application to identify if a satellite image clip contains Palm trees.\n")
|
12 |
+
st.markdown('The predicting result will be "Palm", or "Others".')
|
13 |
+
st.markdown('You can click "Brows files" multiple times until adding all images before generating prediction.\n')
|
14 |
+
|
15 |
+
uploaded_file = st.file_uploader("Upload an image file", type="jpg")
|
16 |
+
st.image(uploaded_file, width=100)
|
17 |
+
|
18 |
+
img_height = 224
|
19 |
+
img_width = 224
|
20 |
+
class_names = ['Palm', 'Others']
|
21 |
+
|
22 |
+
model = tf.keras.models.load_model('model')
|
23 |
+
|
24 |
+
if uploaded_file is not None:
|
25 |
+
Generate_pred = st.button("Generate Prediction")
|
26 |
+
if Generate_pred:
|
27 |
+
for file in uploaded_file:
|
28 |
+
img = Image.open(file)
|
29 |
+
img_array = img_to_array(img)
|
30 |
+
img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
|
31 |
+
processed_image = preprocess_input(img_array)
|
32 |
+
|
33 |
+
predictions = model.predict(processed_image)
|
34 |
+
score = predictions[0]
|
35 |
+
st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
|
36 |
+
|
model/keras_metadata.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d8b6371fb7409bdd4f970bd53d6cc15e0576b6ece8155c7e9593d5324db2a3c
|
3 |
+
size 370284
|
model/saved_model.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:779521e443d6d027759ec02710fe3e442f4a7f14417214fd9b931346ed5d9bcc
|
3 |
+
size 3104543
|
model/variables/variables.data-00000-of-00001
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b7b5cf3d81abb23710aee1acdc90e4bca5aaa5d86c2dca96be6d643a51490f33
|
3 |
+
size 119665107
|
model/variables/variables.index
ADDED
Binary file (21.3 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
opencv-python-headless
|
3 |
+
Pillow
|
4 |
+
tensorflow
|
5 |
+
numpy
|