Original Images | Contrast Enhancement |
---|
Output Pascal Model | Binary Image-Input Model | Inference Result |
---|
- train.py
- dataset.ipynb
- dataset_and_train.ipynb
- simple_extractor.py(inference)
- requirements.txt
- evaluate.py
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 | step2 | step3 | step4 | step5 |
---|
- 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
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
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.
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'