|
@@ -92,14 +92,17 @@ def remove(
|
|
mask = detect.predict(model, np.array(img)).convert("L")
|
|
mask = detect.predict(model, np.array(img)).convert("L")
|
|
|
|
|
|
if alpha_matting:
|
|
if alpha_matting:
|
|
- cutout = alpha_matting_cutout(
|
|
|
|
- img,
|
|
|
|
- mask,
|
|
|
|
- alpha_matting_foreground_threshold,
|
|
|
|
- alpha_matting_background_threshold,
|
|
|
|
- alpha_matting_erode_structure_size,
|
|
|
|
- alpha_matting_base_size,
|
|
|
|
- )
|
|
|
|
|
|
+ try:
|
|
|
|
+ cutout = alpha_matting_cutout(
|
|
|
|
+ img,
|
|
|
|
+ mask,
|
|
|
|
+ alpha_matting_foreground_threshold,
|
|
|
|
+ alpha_matting_background_threshold,
|
|
|
|
+ alpha_matting_erode_structure_size,
|
|
|
|
+ alpha_matting_base_size,
|
|
|
|
+ )
|
|
|
|
+ except:
|
|
|
|
+ cutout = naive_cutout(img, mask)
|
|
else:
|
|
else:
|
|
cutout = naive_cutout(img, mask)
|
|
cutout = naive_cutout(img, mask)
|
|
|
|
|