-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
143 lines (109 loc) · 5.65 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import tkinter as tk
from tkinter import Message ,Text
from PIL import Image, ImageTk
import pandas as pd
import tkinter.ttk as ttk
import tkinter.font as font
import tkinter.messagebox as tm
import matplotlib.pyplot as plt
import csv
import numpy as np
from PIL import Image, ImageTk
from tkinter import filedialog
import tkinter.messagebox as tm
import train as tr
import resnettraining as tr1
import densenetraining as tr2
import test as pre
bgcolor="#032174"
bgcolor1="#0492C2"
fgcolor="#FFFFFF"
accuracy=[]
def Home():
global window
def clear():
print("Clear1")
txt.delete(0,'end')
txt1.delete(0, 'end')
window = tk.Tk()
window.title("Hybrid Cucumber Leaf Disease Detection Using Machine Learning")
window.geometry('1280x720')
window.configure(background=bgcolor)
#window.attributes('-fullscreen', True)
window.grid_rowconfigure(0, weight=1)
window.grid_columnconfigure(0, weight=1)
message1 = tk.Label(window, text="Hybrid Cucumber Leaf Disease Detection" ,bg=bgcolor ,fg=fgcolor ,width=50 ,height=3,font=('times', 30, ))
message1.place(x=20, y=20)
lbl = tk.Label(window, text="Select Dataset Folder",width=20 ,height=2 ,fg=fgcolor ,bg=bgcolor ,font=('times', 15, ' bold ') )
lbl.place(x=100, y=200)
txt = tk.Entry(window,width=20,bg="white" ,fg="black",font=('times', 15, ' bold '))
txt.place(x=400, y=215)
lbl1 = tk.Label(window, text="Select Image",width=20 ,height=2 ,fg=fgcolor ,bg=bgcolor ,font=('times', 15, ' bold ') )
lbl1.place(x=100, y=300)
txt1 = tk.Entry(window,width=20,bg="white" ,fg="black",font=('times', 15, ' bold '))
txt1.place(x=400, y=315)
def browse():
path=filedialog.askdirectory()
print(path)
txt.insert('end',path)
if path !="":
print(path)
else:
tm.showinfo("Input error", "Select Train Dataset")
def browse1():
path=filedialog.askopenfilename()
print(path)
txt1.insert('end',path)
if path !="":
print(path)
else:
tm.showinfo("Input error", "Select Train Dataset")
def Trainprocess():
sym=txt.get()
if sym!="":
macc=tr.process(sym)
accuracy.append(macc)
tm.showinfo("Output", "Training finished successfully")
else:
tm.showinfo("Input error", "Select Train Dataset")
def Trainprocess1():
sym=txt.get()
if sym!="":
racc=tr1.process(sym)
accuracy.append(racc)
tm.showinfo("Output", "Training finished successfully")
else:
tm.showinfo("Input error", "Select Train Dataset")
def Trainprocess2():
sym=txt.get()
if sym!="":
dacc=tr2.process(sym)
accuracy.append(dacc)
tm.showinfo("Output", "Training finished successfully")
else:
tm.showinfo("Input error", "Select Train Dataset")
def Predictprocess():
sym=txt1.get()
if sym!="":
res,conf=pre.process(sym)
tm.showinfo("Output", "Predicted as "+str(res)+" With Confidance of "+str(conf))
else:
tm.showinfo("Input error", "Select Input Image")
browse = tk.Button(window, text="Browse", command=browse ,fg=fgcolor ,bg=bgcolor1 ,width=10 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
browse.place(x=650, y=200)
browse1 = tk.Button(window, text="Browse", command=browse1 ,fg=fgcolor ,bg=bgcolor1 ,width=10 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
browse1.place(x=650, y=300)
clearButton = tk.Button(window, text="Clear", command=clear ,fg=fgcolor ,bg=bgcolor1 ,width=10 ,height=2 ,activebackground = "Red" ,font=('times', 15, ' bold '))
clearButton.place(x=850, y=200)
RFbutton = tk.Button(window, text="MobileNET", command=Trainprocess ,fg=fgcolor ,bg=bgcolor1 ,width=20 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
RFbutton.place(x=80, y=450)
RFbutton1 = tk.Button(window, text="RESNET", command=Trainprocess1 ,fg=fgcolor ,bg=bgcolor1 ,width=20 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
RFbutton1.place(x=280, y=450)
RFbutton2 = tk.Button(window, text="DENSENET", command=Trainprocess2 ,fg=fgcolor ,bg=bgcolor1 ,width=20 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
RFbutton2.place(x=480, y=450)
DCbutton = tk.Button(window, text="PREDICT", command=Predictprocess ,fg=fgcolor ,bg=bgcolor1 ,width=20 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
DCbutton.place(x=680, y=450)
quitWindow = tk.Button(window, text="Quit", command=window.destroy ,fg=fgcolor ,bg=bgcolor1 ,width=15 ,height=2, activebackground = "Red" ,font=('times', 15, ' bold '))
quitWindow.place(x=880, y=450)
window.mainloop()
Home()