rambo 11 달 전
부모
커밋
e3582a21f8
2개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 5
      python/services/SegmentService.py
  2. 2 2
      python/services/deal_cutout.py

+ 7 - 5
python/services/SegmentService.py

@@ -58,9 +58,10 @@ 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)
+                            # continue
+                            _is_cutout.append(x_file_name)
         # ===============================================================
         for file in os.listdir(root_path):
             file_path = "{}/{}".format(root_path, file)
@@ -73,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)
 
@@ -88,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(
                 {
@@ -100,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

+ 2 - 2
python/services/deal_cutout.py

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