This commit is contained in:
Maciej Sobkowiak 2019-06-10 00:53:00 +02:00
commit 232b4af77d
4 changed files with 5 additions and 30 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
.vscode/ .vscode/
*/__pycache__/ *__pycache__*
*tex *tex
Images/TrainingImages/ Images/TrainingImages/
Model/bottleneck/ Model/bottleneck/

View File

@ -199,7 +199,7 @@ if __name__ == "__main__":
if args.output_layer: if args.output_layer:
output_layer = args.output_layer output_layer = args.output_layer
classify(model_file=model_file, label_file=label_file, input_height=input_height, input_width=input_width, classify_files(model_file=model_file, label_file=label_file, input_height=input_height, input_width=input_width,
input_mean=input_mean, input_std=input_std, input_layer=input_layer, output_layer=output_layer) input_mean=input_mean, input_std=input_std, input_layer=input_layer, output_layer=output_layer)
# for i in top_k: # for i in top_k:

View File

@ -100,18 +100,16 @@ class House:
def find_trash_file(self): def find_trash_file(self):
# trash_files_list = []
from os.path import sep # culture and os invariant separator from os.path import sep # culture and os invariant separator
file_names = [(join(f"Images{sep}TestImages", f)) file_names = [(join(f"Images{sep}TestImages", f))
for f in listdir(f"Images{sep}TestImages") for f in listdir(f"Images{sep}TestImages")
if isfile(join(f"Images{sep}TestImages", f))] if isfile(join(f"Images{sep}TestImages", f))]
# #filter names
# for f in file_names:
# if trash[2] in f:
# trash_files_list.append(f)
file_name = file_names[rd.randint(0,len(file_names)) - 1] file_name = file_names[rd.randint(0,len(file_names)) - 1]
from Logic.TrashRecognition.ImageClassification import classify_file from Logic.TrashRecognition.ImageClassification import classify_file
if file_name in recognized_trash: if file_name in recognized_trash:
rt = recognized_trash[file_name] rt = recognized_trash[file_name]
return (file_name, rt[0], rt[1]) return (file_name, rt[0], rt[1])
@ -119,16 +117,6 @@ class House:
classification = classify_file(file_dir=file_name) classification = classify_file(file_dir=file_name)
recognized_trash[file_name] = (classification[1], classification[2]) recognized_trash[file_name] = (classification[1], classification[2])
return classification return classification
# trash_files_list = []
# # filter names
# for f in trash_files:
# if trash[2] in f[1]:
# trash_files_list.append(f[0])
# f = rd.randint(0,len(trash_files_list))
# return trash_files_list[f-1]
def generate_trash(self): def generate_trash(self):
self.empty = False self.empty = False
@ -136,19 +124,6 @@ class House:
classification = self.find_trash_file() classification = self.find_trash_file()
self.trash = self.trash_dict[classification[1]] self.trash = self.trash_dict[classification[1]]
self.trash_file = classification[0] self.trash_file = classification[0]
# num = rd.randint(1, 4)
# if num == 1:
# self.trash = self.paper
# self.trash_file = self.find_trash_file(self.trash)
# elif num == 2:
# self.trash = self.glass
# self.trash_file = self.find_trash_file(self.trash)
# elif num == 3:
# self.trash = self.metal
# self.trash_file = self.find_trash_file(self.trash)
# elif num == 4:
# self.trash = self.plastic
# self.trash_file = self.find_trash_file(self.trash)
def get_day_of_week(self, d: int): def get_day_of_week(self, d: int):
for day in self.DAYS: for day in self.DAYS: