Skip to content

TonyAssi/Segment-Clothing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Segment Clothing

Segment clothing with 1 line of code.

Takes in a PIL image and outputs a PIL image of segmented clothing. Built on top of 🤗 Tranformers using the mattmdjaga/segformer_b2_clothes image segmentation model.

Try out the Web Demo: Hugging Face Spaces

Installation

pip install -r requirements.txt

Usage

Import module

from SegCloth import segment_clothing

Import PIL and open image

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

Segment Clothing

  • img input image of type PIL
result = segment_clothing(img=image)
result.save('segmented.png')

You can also explicitly specify which clothes to segment

  • img input image of type PIL
  • clothes list of strings. by default ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"]
result = segment_clothing(img=image, clothes= ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"])
result.save('segmented.png')

About

Segment clothing with 1 line of code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages