Metadata-Version: 2.1
Name: people-segmentation
Version: 0.0.2
Summary: High quality model for people segmentation.
Home-page: https://github.com/ternaus/people_segmentation
Author: Vladimir Iglovikov
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: albumentations
Requires-Dist: iglovikov-helper-functions
Requires-Dist: pytorch-lightning
Requires-Dist: pytorch-toolbelt
Requires-Dist: segmentation-models-pytorch
Requires-Dist: torch
Requires-Dist: tqdm
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'

# Binary segmentation of people

![](https://habrastorage.org/webt/bc/eg/g8/bcegg8zdgd-co-lip6hxn976jdm.jpeg)

## Data

### Train set:

* Mapillary Vistas Commercial 1.2 (train)
* COCO (train)
* Pascal VOC (train)
* [Human Matting](https://www.kaggle.com/laurentmih/aisegmentcom-matting-human-datasets/)

### Validation set:
* Mapillary Vistas Commercial 1.2 (val)
* COCO (val)
* Pascal VOC (val)
* Supervisely

To convert datasets to the format:

```
training
    coco
    matting_humans
    pascal_voc
    vistas

validation
    coco
    pascal_voc
    supervisely
    vistas
```
use this set of [scipts](https://github.com/ternaus/iglovikov_helper_functions/tree/master/iglovikov_helper_functions/data_processing/prepare_people_segmentation).

## Training

### Define the config.
Example at [people_segmentation/configs](people_segmentation/configs)

You can enable / disable datasets that are used for training and validation.

### Define the environmental variable `TRAIN_PATH` that points to the folder with train dataset.
Example:
```bash
export TRAIN_PATH=<path to the tranining folder>
```

### Define the environmental variable `VAL_PATH` that points to the folder with validation dataset.
Example:
```bash
export VAL_PATH=<path to the validation folder>
```

### Run training
```
python -m people_segmentation.train -c <path to config>
```

You can check the loss and validation curves for the configs from [people_segmentation/configs](people_segmentation/configs)
at [W&B dashboard](https://wandb.ai/ternaus/people_segmentation-people_segmentation)

### Run Inference

```bash
python -m torch.distributed.launch --nproc_per_node=<num_gpu> people_segmentation/inference.py \
                                   -i <path to images> \
                                   -c <path to config> \
                                   -w <path to weights> \
                                   -o <output-path> \
                                   --fp16
```


