diff --git a/.gitignore b/.gitignore index d6b1547..29784c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .vscode/ -*/__pycache__/ +*__pycache__* *tex Images/TrainingImages/ Model/bottleneck/ diff --git a/Logic/TrashRecognition/ImageClassification.py b/Logic/TrashRecognition/ImageClassification.py index 72b29d3..ebd1686 100644 --- a/Logic/TrashRecognition/ImageClassification.py +++ b/Logic/TrashRecognition/ImageClassification.py @@ -199,7 +199,7 @@ if __name__ == "__main__": if 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) # for i in top_k: diff --git a/Logic/TrashRecognition/__pycache__/ImageClassification.cpython-36.pyc b/Logic/TrashRecognition/__pycache__/ImageClassification.cpython-36.pyc deleted file mode 100644 index 0abd905..0000000 Binary files a/Logic/TrashRecognition/__pycache__/ImageClassification.cpython-36.pyc and /dev/null differ diff --git a/UI/grid.py b/UI/grid.py index 3326b18..f1f2bdc 100644 --- a/UI/grid.py +++ b/UI/grid.py @@ -100,18 +100,16 @@ class House: def find_trash_file(self): - # trash_files_list = [] from os.path import sep # culture and os invariant separator file_names = [(join(f"Images{sep}TestImages", f)) for f in listdir(f"Images{sep}TestImages") 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] + from Logic.TrashRecognition.ImageClassification import classify_file + if file_name in recognized_trash: rt = recognized_trash[file_name] return (file_name, rt[0], rt[1]) @@ -119,16 +117,6 @@ class House: classification = classify_file(file_dir=file_name) recognized_trash[file_name] = (classification[1], classification[2]) 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): self.empty = False @@ -136,19 +124,6 @@ class House: classification = self.find_trash_file() self.trash = self.trash_dict[classification[1]] 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): for day in self.DAYS: