Segment body (with or without face) Segment torso
Takes in a PIL image and outputs the segmented body and mask. Built on top of 🤗 Tranformers using the mattmdjaga/segformer_b2_clothes image segmentation model.
pip install -r requirements.txt
Import module
from SegBody import segment_body
Import PIL and open image
from PIL import Image
image = Image.open('image.jpg')
Segment body with face
seg_img, seg_mask = segment_body(image)
seg_img.save('segmented_img.png')
seg_mask.save('segmented_mask.png')
Segment body without face
seg_img, seg_mask = segment_body(image, face=False)
seg_img.save('segmented_img.png')
seg_mask.save('segmented_mask.png')
Import module
from SegBody import segment_torso
Segment torso
seg_img, seg_mask = segment_torso(image)
seg_img.save('torso_img.png')
seg_mask.save('torso_mask.png')