sifaaral commited on
Commit
fe28201
·
verified ·
1 Parent(s): a097b8a

Upload 3 files

Browse files
Files changed (3) hide show
  1. GTSRB.h5 +3 -0
  2. app.py +54 -0
  3. requirements.txt +7 -0
GTSRB.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ec409c510979705fdbbce91748e1b0dd459c89d248f44691edd67ddddd211c4
3
+ size 21203088
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import cv2
4
+ from tensorflow.keras.models import load_model
5
+ from tensorflow.keras.preprocessing import image
6
+
7
+ # Modeli yükle
8
+ model = load_model('GTSRB.h5')
9
+
10
+ # Sınıfları tanımlayın (örnek)
11
+ class_names = [
12
+ 'Speed limit (20km/h)', 'Speed limit (30km/h)', 'Speed limit (50km/h)',
13
+ 'Speed limit (60km/h)', 'Speed limit (70km/h)', 'Speed limit (80km/h)',
14
+ 'End of speed limit (80km/h)', 'Speed limit (100km/h)', 'Speed limit (120km/h)',
15
+ 'No passing', 'No passing veh over 3.5 tons', 'Right-of-way at intersection',
16
+ 'Priority road', 'Yield', 'Stop', 'No vehicles', 'Veh > 3.5 tons prohibited',
17
+ 'No entry', 'General caution', 'Dangerous curve left', 'Dangerous curve right',
18
+ 'Double curve', 'Bumpy road', 'Slippery road', 'Road narrows on the right',
19
+ 'Road work', 'Traffic signals', 'Pedestrians', 'Children crossing',
20
+ 'Bicycles crossing', 'Beware of ice/snow', 'Wild animals crossing',
21
+ 'End speed + passing limits', 'Turn right ahead', 'Turn left ahead',
22
+ 'Ahead only', 'Go straight or right', 'Go straight or left', 'Keep right',
23
+ 'Keep left', 'Roundabout mandatory', 'End of no passing',
24
+ 'End no passing veh > 3.5 tons'
25
+ ]
26
+
27
+ st.title("Trafik İşareti Tanıma Uygulaması")
28
+
29
+ # Resim yükleme
30
+ uploaded_file = st.file_uploader("Resim yükleyin", type=["jpg", "png", "jpeg"])
31
+
32
+ if uploaded_file is not None:
33
+ # Resmi yükle
34
+ img = image.load_img(uploaded_file, target_size=(32, 32))
35
+ st.image(img, caption='Yüklenen Resim', use_column_width=True)
36
+
37
+ # Resmi diziye dönüştür
38
+ img_array = image.img_to_array(img)
39
+ img_array = np.expand_dims(img_array, axis=0) / 255.0 # Normalizasyon
40
+
41
+ # Tahmin yap
42
+ predictions = model.predict(img_array)
43
+ predicted_class = np.argmax(predictions, axis=1)
44
+ st.write(f"Tahmin Edilen Sınıf: {class_names[predicted_class[0]]}")
45
+
46
+ # Kamera ile resim çekme
47
+ st.write("Alternatif olarak kamera ile resim çekebilirsiniz.")
48
+
49
+ # Kamera girdisi (Bu kısım tarayıcıda çalışmayabilir, yerine yerel bir çözüm gerekebilir)
50
+ if st.button("Kameradan Resim Çek"):
51
+ st.warning("Bu özellik tarayıcı desteklemiyor. Lütfen bir resim yükleyin.")
52
+
53
+ # Uygulamayı çalıştırmak için terminalde şu komutu kullanın:
54
+ # streamlit run your_script_name.py
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ tensorflow
3
+ PIL
4
+ numpy
5
+ scikit-learn
6
+ os
7
+ pickle