nyomanyudisdeveloper commited on
Commit
ccad2f4
·
verified ·
1 Parent(s): a33db09
Files changed (10) hide show
  1. .gitattributes +1 -0
  2. app.py +10 -0
  3. dict_butterfly_index.json +77 -0
  4. eda.py +27 -0
  5. eda1.jpg +0 -0
  6. eda2.jpg +0 -0
  7. eda3.jpeg +3 -0
  8. model_after.h5 +3 -0
  9. predict.py +38 -0
  10. requirements.txt +9 -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
+ eda3.jpeg filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import eda
3
+ import predict
4
+
5
+ navigation = st.sidebar.selectbox('Pilih Halaman:', {'EDA':'eda','Prediction':'pred'})
6
+
7
+ if navigation == 'EDA':
8
+ eda.run()
9
+ else:
10
+ predict.run()
dict_butterfly_index.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "0": "ADONIS",
3
+ "1": "AFRICAN GIANT SWALLOWTAIL",
4
+ "2": "AMERICAN SNOOT",
5
+ "3": "AN 88",
6
+ "4": "APPOLLO",
7
+ "5": "ATALA",
8
+ "6": "BANDED ORANGE HELICONIAN",
9
+ "7": "BANDED PEACOCK",
10
+ "8": "BECKERS WHITE",
11
+ "9": "BLACK HAIRSTREAK",
12
+ "10": "BLUE MORPHO",
13
+ "11": "BLUE SPOTTED CROW",
14
+ "12": "BROWN SIPROETA",
15
+ "13": "CABBAGE WHITE",
16
+ "14": "CAIRNS BIRDWING",
17
+ "15": "CHECQUERED SKIPPER",
18
+ "16": "CHESTNUT",
19
+ "17": "CLEOPATRA",
20
+ "18": "CLODIUS PARNASSIAN",
21
+ "19": "CLOUDED SULPHUR",
22
+ "20": "COMMON BANDED AWL",
23
+ "21": "COMMON WOOD-NYMPH",
24
+ "22": "COPPER TAIL",
25
+ "23": "CRECENT",
26
+ "24": "CRIMSON PATCH",
27
+ "25": "DANAID EGGFLY",
28
+ "26": "EASTERN COMA",
29
+ "27": "EASTERN DAPPLE WHITE",
30
+ "28": "EASTERN PINE ELFIN",
31
+ "29": "ELBOWED PIERROT",
32
+ "30": "GOLD BANDED",
33
+ "31": "GREAT EGGFLY",
34
+ "32": "GREAT JAY",
35
+ "33": "GREEN CELLED CATTLEHEART",
36
+ "34": "GREY HAIRSTREAK",
37
+ "35": "INDRA SWALLOW",
38
+ "36": "IPHICLUS SISTER",
39
+ "37": "JULIA",
40
+ "38": "LARGE MARBLE",
41
+ "39": "MALACHITE",
42
+ "40": "MANGROVE SKIPPER",
43
+ "41": "MESTRA",
44
+ "42": "METALMARK",
45
+ "43": "MILBERTS TORTOISESHELL",
46
+ "44": "MONARCH",
47
+ "45": "MOURNING CLOAK",
48
+ "46": "ORANGE OAKLEAF",
49
+ "47": "ORANGE TIP",
50
+ "48": "ORCHARD SWALLOW",
51
+ "49": "PAINTED LADY",
52
+ "50": "PAPER KITE",
53
+ "51": "PEACOCK",
54
+ "52": "PINE WHITE",
55
+ "53": "PIPEVINE SWALLOW",
56
+ "54": "POPINJAY",
57
+ "55": "PURPLE HAIRSTREAK",
58
+ "56": "PURPLISH COPPER",
59
+ "57": "QUESTION MARK",
60
+ "58": "RED ADMIRAL",
61
+ "59": "RED CRACKER",
62
+ "60": "RED POSTMAN",
63
+ "61": "RED SPOTTED PURPLE",
64
+ "62": "SCARCE SWALLOW",
65
+ "63": "SILVER SPOT SKIPPER",
66
+ "64": "SLEEPY ORANGE",
67
+ "65": "SOOTYWING",
68
+ "66": "SOUTHERN DOGFACE",
69
+ "67": "STRAITED QUEEN",
70
+ "68": "TROPICAL LEAFWING",
71
+ "69": "TWO BARRED FLASHER",
72
+ "70": "ULYSES",
73
+ "71": "VICEROY",
74
+ "72": "WOOD SATYR",
75
+ "73": "YELLOW SWALLOW TAIL",
76
+ "74": "ZEBRA LONG WING"
77
+ }
eda.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def run():
4
+ # Note : For EDA I Only use Image from notebook EDA because it will too large to upload all image
5
+ st.title('Classify Species Butterfly(EDA)')
6
+ st.image('https://t3.ftcdn.net/jpg/04/85/05/98/360_F_485059889_IxZNo1zBe86JC6SBfz8e1AT8fpCACilB.jpg')
7
+ st.write('This page is made by Yudis Aditya')
8
+ st.markdown('---')
9
+
10
+ st.write('In this page, I want to show visualization about my dataset image so i can make better plan to create my model')
11
+ st.link_button('Link dataset','https://www.kaggle.com/datasets/phucthaiv02/butterfly-image-classification')
12
+
13
+ st.write('## 1. Identify Class Balance')
14
+ st.image('eda1.jpg')
15
+ st.write("From here we know that label in folder image train has 75 label/class. And from graph 'Top 5 Species' we can know that my dataset image is not balance because has different size for each class. I must do data balancing before model training")
16
+
17
+ st.write('## 2. Visualize Image Size')
18
+ st.image('eda2.jpg')
19
+ st.write("From analyze above we can know that my dataset image has same size (224 x 224). It's already good for model training for classify image.")
20
+
21
+ st.write('## 3.Visualize Sampling of Images')
22
+ st.image('eda3.jpeg')
23
+ st.write("These list image above are sample for every class/label. From my first impression to clasify species butterfly it's already good because to do that color is important indergredients. And filter image on edge will not work because it depend on colors.")
24
+
25
+
26
+ if __name__ == '__main__':
27
+ run()
eda1.jpg ADDED
eda2.jpg ADDED
eda3.jpeg ADDED

Git LFS Details

  • SHA256: d83da3c887146a6330a2a4b61fa1f16f64069921a84b1095d2be5492595cb364
  • Pointer size: 132 Bytes
  • Size of remote file: 1.24 MB
model_after.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c338b4ec3178dbc383d4b80181936f80fd1722b10b0b89aa508cf5f810f05296
3
+ size 17904512
predict.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import json
4
+ import pickle
5
+ import numpy as np
6
+ import tensorflow as tf
7
+ from keras.models import load_model
8
+
9
+ model = load_model("model_after.h5")
10
+
11
+ with open('dict_butterfly_index.json','r') as file_2:
12
+ dict_butterfly_index = json.load(file_2)
13
+
14
+ def run():
15
+ with st.form('prediction_form'):
16
+ st.write('Personal Information')
17
+ uploaded = st.file_uploader(label='Input File Image',type=['png','jpg'])
18
+
19
+
20
+ submitted = st.form_submit_button()
21
+
22
+ st.write("Result Prediction")
23
+ if submitted:
24
+ img = tf.keras.utils.load_img(uploaded, target_size=(224, 224))
25
+ x = tf.keras.utils.img_to_array(img)/255
26
+
27
+
28
+ x = np.expand_dims(x, axis=0)
29
+ images = np.vstack((x,x))
30
+ classes = model.predict(images, batch_size=10)
31
+ idx = np.argmax(classes[0])
32
+ st.write(f"The predictions is = {dict_butterfly_index[str(idx)]}")
33
+ st.image(img,caption="Uploaded Image", use_column_width=True)
34
+
35
+
36
+
37
+ if __name__ == '__main__':
38
+ run()
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ seaborn
4
+ matplotlib
5
+ numpy
6
+ scikit-learn
7
+ plotly
8
+ cv2
9
+ tensorflow