Cloth Segmentation

This repo contains code and a pre-trained model for clothes segmentation.
Alternatives To Cloth Segmentation
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Transformers112,668641,86913 hours ago114July 18, 2023865apache-2.0Python
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
Stable Diffusion Webui104,033
15 hours ago2January 17, 20221,522agpl-3.0Python
Stable Diffusion web UI
Pytorch71,2303,3416,72813 hours ago37May 08, 202312,813otherPython
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Keras59,44757813 hours ago80June 27, 2023100apache-2.0Python
Deep Learning for humans
Real Time Voice Cloning47,152
7 days ago168otherPython
Clone a voice in 5 seconds to generate arbitrary speech in real-time
2 days ago8September 21, 2021223agpl-3.0Python
YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
Annotated_deep_learning_paper_implementations36,223111 days ago78September 24, 202227mitJupyter Notebook
🧑‍🏫 60 Implementations/tutorials of deep learning papers with side-by-side notes 📝; including transformers (original, xl, switch, feedback, vit, ...), optimizers (adam, adabelief, sophia, ...), gans(cyclegan, stylegan2, ...), 🎮 reinforcement learning (ppo, dqn), capsnet, distillation, ... 🧠
Made With Ml34,217
4 days ago5May 15, 20194mitJupyter Notebook
Learn how to design, develop, deploy and iterate on production-grade ML applications.
Gfpgan32,185919 days ago11September 20, 2022271otherPython
GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration.
a month ago2February 28, 2022446otherPython
🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time
Alternatives To Cloth Segmentation
Select To Compare

Alternative Project Comparisons

Clothes Segmentation using U2NET

Python 3.8 License: MIT Open In Colab

This repo contains training code, inference code and pre-trained model for Cloths Parsing from human portrait. Here clothes are parsed into 3 category: Upper body(red), Lower body(green) and Full body(yellow)

Sample 000 Sample 024 Sample 018

This model works well with any background and almost all poses. For more samples visit

Techinal details

  • U2NET : This project uses an amazing U2NET as a deep learning model. Instead of having 1 channel output from u2net for typical salient object detection task it outputs 4 channels each respresting upper body cloth, lower body cloth, fully body cloth and background. Only categorical cross-entropy loss is used for a given version of the checkpoint.

  • Dataset : U2net is trained on 45k images iMaterialist (Fashion) 2019 at FGVC6 dataset. To reduce complexity, I have clubbed the original 42 categories from dataset labels into 3 categories (upper body, lower body and full body). All images are resized into square \_()_/ 768 x 768 px for training. (This experiment was conducted with 768 px but around 384 px will work fine too if one is retraining on another dataset).


  • For training this project requires,
    •   PyTorch > 1.3.0
    •   tensorboardX
    •   gdown
  • Download dataset from this link, extract all items.
  • Set path of train folder which contains training images and train.csv which is label csv file in options/
  • To port original u2net of all layer except last layer please run python and it will generate weights after model surgey in prev_checkpoints folder.
  • You can explore various options in options/ like checkpoint saving folder, logs folder etc.
  • For single gpu set distributed = False in options/, for multi gpu set it to True.
  • For single gpu run python
  • For multi gpu run
     python -m torch.distributed.launch --nnodes=1 --node_rank=0 --nproc_per_node=4 --use_env
    Here command is for single node, 4 gpu. Tested only for single node.
  • You can watch loss graphs and samples in tensorboard by running tensorboard command in log folder.


  • Download pretrained model from this link(165 MB) in trained_checkpoint folder.
  • Put input images in input_images folder
  • Run python for inference.
  • Output will be saved in output_images


  • Inference in colab from here Open In Colab


  • U2net model is from original u2net repo. Thanks to Xuebin Qin for amazing repo.
  • Complete repo follows structure of Pix2pixHD repo
Popular Deep Learning Projects
Popular Pytorch Projects
Popular Machine Learning Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Deep Learning
Image Segmentation