---
# System prepended metadata

title: DeepLab Parameters

---

DeepLab Parameters
=====

### `atrous_rates` and `output_stride`
when you divide  `output_stride` by 2, `atrous_rates` must double their values

Examples:
```
--atrous_rates=6
--atrous_rates=12
--atrous_rates=18   
--output_stride=16
```

```
--atrous_rates=12
--atrous_rates=24
--atrous_rates=36   
--output_stride=8
```

The less `output_stride` the better accuracy


Can be different while training and while inferencing


##### Unanswered questions:
1. How does it influence training speed/inference speed?
1. How does it influence video memory?
1.


### `train_crop_size`
`train_crop_size` is [height, width]

`train_crop_size` and `eval_crop_size`
MUST always be bigger than the biggest image in the dataset



### `decoder_output_stride`
`decoder_output_stride`
> Adds the decoder to obtain sharper segmentation results

> For `xception_65`, use `decoder_output_stride = 4`

> For `mobilenet_v2`, use `decoder_output_stride = None`.


improves segmentation map the less the value the better segmentation map

examples:



DeepLab Training
====

from /models/research/ run
```
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
```


--------

### tfrecord creation process

deeplab/train.py has a parameter  `--dataset_dir`
it must be a path to tfrecord of your dataset

Follow the next steps to create one:

```
python3 deeplab/datasets/build_voc2012_data.py \
--image_folder=/path/to/images \
--list_folder=/path/to/list_folder \
--output_dir=/pat/to/tfrecord \
--semantic_segmentation_folder=/path/to/segmaps \
--image_format="jpg"
```   

`image_folder` contains ALL dataset images in `image_format` format

`semantic_segmentation_folder` contains ALL dataset labels as images in .png format.

`list_folder` must contain .txt files to group dataset splits (train, val, trainval, test, whateveryouwant)

Each .txt split file is composed of image names


### Example:
 you have 10 images
```
/path/to/image_folder/1.jpg
/path/to/image_folder/2.jpg
...
/path/to/image_folder/10.jpg
```

For each image you have a segmentation map.
```
/path/to/semantic_segmentation_folder/1.png
/path/to/semantic_segmentation_folder/2.png
...
/path/to/semantic_segmentation_folder/10.png
```

You want to use first 6 images for training, 7th and 8th images for validation, and 9th and 10th for testing

You would create 3 files
```
/path/to/list_folder/train.txt
/path/to/list_folder/val.txt
/path/to/list_folder/test.txt
```

train.txt would look like this:
```
1
2
3
4
5
6
```

and val.txt would look like this:
```
7
8
```

and test.txt would look like this:
```
9
10
```

--------------------

in deeplab/datasets segmentation_dataset.py create DatasetDescriptor. It will be passed as  `--dataset="yourdatasetname"` to /deeplab/train.py

--------------



_PROB_OF_FLIP in deeplab/input_preprocess.py


comment “logits” in utils/train_utils.py to restore model


train_crop_size is Image crop size [height, width]



always —fine_tune_batch_norm=True?


to train from scratch
--initialize_last_layer=False --last_layers_contain_logits_only=True


to continue trainig:
--initialize_last_layer=True --last_layers_contain_logits_only=False


create backups manualy


ALWAYS SPECIFY decoder_output_stride
