aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--file-tagger.py4
-rw-r--r--gui.py23
2 files changed, 19 insertions, 8 deletions
diff --git a/file-tagger.py b/file-tagger.py
index 92eb023..0cf1f76 100644
--- a/file-tagger.py
+++ b/file-tagger.py
@@ -77,7 +77,7 @@ def walk(args):
tags_predict.update(predict_image(model, raw, args["predict_images_top"]))
img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)
if not args["predict_images_skip_detail"]:
- pool = ThreadPool(max(1, os.cpu_count() - 2), 1000)
+ pool = ThreadPool(max(1, os.cpu_count() - 2), 10000)
for _ in range(4):
if img.shape[0] > img.shape[1]:
detail = image_resize(img.copy(), height=(args["predict_images_detail_factor"] * MODEL_DIMENSIONS))
@@ -85,7 +85,7 @@ def walk(args):
detail = image_resize(img.copy(), width=(args["predict_images_detail_factor"] * MODEL_DIMENSIONS))
for x in range(0, detail.shape[0], int(MODEL_DIMENSIONS/2)):
for y in range(0, detail.shape[1], int(MODEL_DIMENSIONS/2)):
- pool.add_task(predict_partial, tags_predict, model, detail.copy(), x, y, args["predict_images_top"])
+ pool.add_task(predict_partial, tags_predict, model, detail, x, y, args["predict_images_top"])
img = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)
pool.wait_completion()
tags_sorted = [tag[0] for tag in sorted(tags_predict, key=lambda tag: tag[1], reverse=True)]
diff --git a/gui.py b/gui.py
index 78f3926..f20801e 100644
--- a/gui.py
+++ b/gui.py
@@ -14,7 +14,10 @@ class GuiMain(object):
self.__file_dir = StringVar(self.__master, value=args["file_dir"])
self.__predict_images = BooleanVar(self.__master, value=args["predict_images"])
self.__predict_images_top = StringVar(self.__master, value=str(args["predict_images_top"]))
+ self.__predict_images_skip_detail = BooleanVar(self.__master, value=args["predict_images_skip_detail"])
+ self.__predict_images_detail_factor = StringVar(self.__master, value=str(args["predict_images_detail_factor"]))
self.__gui_tag = BooleanVar(self.__master, value=args["gui_tag"])
+ self.__gui_image_length = StringVar(self.__master, value=str(args["gui_image_length"]))
self.__open_system = BooleanVar(self.__master, value=args["open_system"])
self.__skip_prompt = BooleanVar(self.__master, value=args["skip_prompt"])
self.__index = StringVar(self.__master, value=str(args["index"]))
@@ -30,12 +33,17 @@ class GuiMain(object):
Checkbutton(self.__master, text="Use prediction for image tagging", variable=self.__predict_images).grid(row=2, column=0, columnspan=4, sticky=W)
Label(self.__master, text="Number of top results:").grid(row=3, column=0)
Entry(self.__master, textvariable=self.__predict_images_top, validate='all', validatecommand=(validate_number, '%P')).grid(row=3, column=1, columnspan=1)
- Checkbutton(self.__master, text="Show GUI for tagging", variable=self.__gui_tag).grid(row=4, column=0, columnspan=4, sticky=W)
- Checkbutton(self.__master, text="Open all files with system default", variable=self.__open_system).grid(row=5, column=0, columnspan=4, sticky=W)
- Checkbutton(self.__master, text="Skip prompt for file tags", variable=self.__skip_prompt).grid(row=6, column=0, columnspan=4, sticky=W)
- Label(self.__master, text="Start at index:").grid(row=7, column=0)
- Entry(self.__master, textvariable=self.__index, validate='all', validatecommand=(validate_number, '%P')).grid(row=7, column=1, columnspan=1)
- Button(self.__master, text="Start", command=self.__master.destroy).grid(row=8, column=0, columnspan=4)
+ Checkbutton(self.__master, text="Skip detail scan in image prediction", variable=self.__predict_images_skip_detail).grid(row=4, column=0, columnspan=4, sticky=W)
+ Label(self.__master, text="Width factor for detail scan:").grid(row=5, column=0)
+ Entry(self.__master, textvariable=self.__predict_images_detail_factor, validate='all', validatecommand=(validate_number, '%P')).grid(row=5, column=1, columnspan=1)
+ Checkbutton(self.__master, text="Show GUI for tagging", variable=self.__gui_tag).grid(row=6, column=0, columnspan=4, sticky=W)
+ Label(self.__master, text="Image GUI preview size:").grid(row=7, column=0)
+ Entry(self.__master, textvariable=self.__gui_image_length, validate='all', validatecommand=(validate_number, '%P')).grid(row=7, column=1, columnspan=1)
+ Checkbutton(self.__master, text="Open all files with system default", variable=self.__open_system).grid(row=8, column=0, columnspan=4, sticky=W)
+ Checkbutton(self.__master, text="Skip prompt for file tags", variable=self.__skip_prompt).grid(row=9, column=0, columnspan=4, sticky=W)
+ Label(self.__master, text="Start at index:").grid(row=10, column=0)
+ Entry(self.__master, textvariable=self.__index, validate='all', validatecommand=(validate_number, '%P')).grid(row=10, column=1, columnspan=1)
+ Button(self.__master, text="Start", command=self.__master.destroy).grid(row=11, column=0, columnspan=4)
def loop(self):
self.__master.mainloop()
@@ -44,7 +52,10 @@ class GuiMain(object):
self.__args["file_dir"] = self.__file_dir.get()
self.__args["predict_images"] = self.__predict_images.get()
self.__args["predict_images_top"] = int(self.__predict_images_top.get())
+ self.__args["predict_images_skip_detail"] = self.__predict_images_skip_detail.get()
+ self.__args["predict_images_detail_factor"] = int(self.__predict_images_detail_factor.get())
self.__args["gui_tag"] = self.__gui_tag.get()
+ self.__args["gui_image_length"] = int(self.__gui_image_length.get())
self.__args["open_system"] = self.__open_system.get()
self.__args["skip_prompt"] = self.__skip_prompt.get()
self.__args["index"] = int(self.__index.get())