浏览代码

add more models

Daniel Gatis 3 年之前
父节点
当前提交
84a21b4175
共有 2 个文件被更改,包括 37 次插入15 次删除
  1. 1 1
      rembg/bg.py
  2. 36 14
      rembg/session_cloth.py

+ 1 - 1
rembg/bg.py

@@ -120,7 +120,7 @@ def remove(
                     alpha_matting_background_threshold,
                     alpha_matting_erode_size,
                 )
-            except:
+            except ValueError:
                 cutout = naive_cutout(img, mask)
 
         else:

+ 36 - 14
rembg/session_cloth.py

@@ -6,28 +6,50 @@ from scipy.special import log_softmax
 
 from .session_base import BaseSession
 
-# fmt: off
 pallete1 = [
-      0,   0,   0, # background
-    255, 255, 255, # upper body
-      0,   0,   0, # lower body
-      0,   0,   0, # full body
+    0,
+    0,
+    0,
+    255,
+    255,
+    255,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
 ]
 
 pallete2 = [
-      0,   0,   0, # background
-      0,   0,   0, # upper body
-    255, 255, 255, # lower body
-      0,   0,   0, # full body
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    255,
+    255,
+    255,
+    0,
+    0,
+    0,
 ]
 
 pallete3 = [
-      0,   0,   0, # background
-      0,   0,   0, # upper body
-      0,   0,   0, # lower body
-    255, 255, 255, # full body
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    255,
+    255,
+    255,
 ]
-# fmt: on
 
 
 class ClothSession(BaseSession):