Skip to content

An out-of-box Human Parsing Representation Extractor on Binary images.

License

Notifications You must be signed in to change notification settings

NahidEbrahimian/Human-Parsing-on-Binary-Image

 
 

Repository files navigation

Self-Correction-Human-Parsing-on-Binary-Images

Original Imagesoriginal Contrast Enhancementenhancment
Output Pascal Modelpascal model Binary Image-Input Modelinput images Inference Resultmodel inference
  • train.py
  • dataset.ipynb
  • dataset_and_train.ipynb
  • simple_extractor.py(inference)
  • requirements.txt
  • evaluate.py

Dataset

Dataset name: bodies-at-rest

Github repository: https://github.com/Healthcare-Robotics/bodies-at-rest

We used real dataset of bodies-at-rest dataset that contains 20 human participants (10M/10F) with 1K labeled real pressure images.

  • prepairing binary images dataset:

For preparing dataset, we used pascal pretrained model that implemented for RGB images. The Pascal Person Part has 7 labels, including 'Background', 'Head', 'Torso', 'Upper Arms', 'Lower Arms', 'Upper Legs', 'Lower Legs'.

The steps for preparing the database are as follows

1- Extraction of image field of dataset pickle file

2- Improve image contrast

3- Create segmented images using pascal model

4- Convert segmented images using pascal model to binary images

5- Creating labels of binary images that contains 7 classes

For prepairing binary images dataset, you can clone this repositiry and run dataset.ipynb file.

step1 16 step216 (1) step316 (1) step416 (2) step516
  • In this step you need trained models to prepaire dataset. If you have trouble downloading models, you can download manually using this link: Trained Models

Instalation

1- Clone this repository using the following command:

https://github.com/NahidEbrahimian/Human-Parsing-on-Binary-Image

2- In ./Human-Parsing-on-Binary-Images directory, run the following command to install requirements:

pip install -r requirements.txt

Train

1- Clone this repository using the following command:

https://github.com/NahidEbrahimian/Human-Parsing-on-Binary-Image

There are two solutions for training:

1- You can run dataset_and_train.ipynb file for both prepairing dataset and training

2- Afther prepairing dataset, run the following command:

%cd ./Human-Parsing-on-Binary-Image
!python train.py --data-dir ./dataset/dataset --num-classes 7 --batch-size 3 --imagenet-pretrain ./pretrain_model/resnet101-imagenet.pth
  • Used wandb in training pocess.

Inference

1- For inference, first download pretrained model on binary images from this link and put in ./log directory: download model

2- Put your binary images in ./input directory

3- Run the following command:

!python simple_extractor.py --dataset 'pascal' --model-restore "./log/checkpoint_40.pth.tar" --input-dir './input' --output-dir './output'

About

An out-of-box Human Parsing Representation Extractor on Binary images.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 58.0%
  • Python 37.5%
  • Cuda 2.7%
  • C++ 1.5%
  • Shell 0.3%
  • Dockerfile 0.0%