Kaynağa Gözat

Merge remote-tracking branch 'origin/master' into dev-frontend

panqiuyao 11 ay önce
ebeveyn
işleme
abc835e6d0

+ 6 - 3
python/services/SegmentService.py

@@ -58,7 +58,9 @@ class SegmentService:
                     # 哪些图片已经有抠图
                     for x_file in os.listdir(file_path):
                         x_file_name, x_file_e = os.path.splitext(x_file)
+                        print("x_file_name",x_file_name)
                         if x_file_e == ".png":
+                            # continue
                             _is_cutout.append(x_file_name)
         # ===============================================================
         for file in os.listdir(root_path):
@@ -72,6 +74,8 @@ class SegmentService:
                         f = False
                         break
                 if f:
+                    if "已扣图" in file_path:
+                        continue
                     print("遍历文件夹", file_path)
                     self.check_need_cutout_images(file_path, need_cutout_images)
 
@@ -87,10 +91,9 @@ class SegmentService:
                     break
             if not f:
                 continue
-            need_cutout = False if file_name in _is_cutout else True
+            # need_cutout = False if file_name in _is_cutout else True
             # if os.path.exists("{}/{}.png".format(root_path, file_name)):
             #     need_cutout = False
-
             # 图片进行处理
             need_cutout_images.append(
                 {
@@ -99,7 +102,7 @@ class SegmentService:
                     "file_path": file_path,
                     "file": file,
                     "root_path": root_path,
-                    "need_cutout": need_cutout,
+                    "need_cutout": True,
                 }
             )
         return need_cutout_images

+ 4 - 0
python/services/deal_cutout.py

@@ -279,8 +279,12 @@ class DealModelForm:
                     file_name = generate["file_name"]
                     file_e = generate["file_e"]
                     if result_image_pil.mode == "RGBA":
+                        if os.path.exists(f"{save_path}/{file_name}.png"):
+                            break
                         result_image_pil.save(f"{save_path}/{file_name}.png")
                     else:
+                        if os.path.exists(f"{save_path}/{file_name}.jpg"):
+                            break
                         result_image_pil.save(f"{save_path}/{file_name}.jpg")
                     break
         is_finished = (