Skip to content

TonyAssi/Segment-Body

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Segment Body

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.

Installation

pip install -r requirements.txt

Usage

Import module

from SegBody import segment_body

Import PIL and open image

from PIL import Image
image = Image.open('image.jpg')

Body

Segment body with face

  • img input image of type PIL
seg_img, seg_mask = segment_body(image)
seg_img.save('segmented_img.png')
seg_mask.save('segmented_mask.png')

Segment body without face

  • img input image of type PIL
  • face Boolean, True by default
seg_img, seg_mask = segment_body(image, face=False)
seg_img.save('segmented_img.png')
seg_mask.save('segmented_mask.png')

Torso

Import module

from SegBody import segment_torso

Segment torso

  • img input image of type PIL
seg_img, seg_mask = segment_torso(image)
seg_img.save('torso_img.png')
seg_mask.save('torso_mask.png')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages