| 27 | |
| 28 | class Settings(object): |
| 29 | def __init__(self, |
| 30 | dataset=None, |
| 31 | data_dir=None, |
| 32 | label_file=None, |
| 33 | resize_h=300, |
| 34 | resize_w=300, |
| 35 | mean_value=[127.5, 127.5, 127.5], |
| 36 | apply_distort=True, |
| 37 | apply_expand=True, |
| 38 | ap_version='11point'): |
| 39 | self._dataset = dataset |
| 40 | self._ap_version = ap_version |
| 41 | self._data_dir = data_dir |
| 42 | if 'pascalvoc' in dataset: |
| 43 | self._label_list = [] |
| 44 | label_fpath = os.path.join(data_dir, label_file) |
| 45 | for line in open(label_fpath): |
| 46 | self._label_list.append(line.strip()) |
| 47 | |
| 48 | self._apply_distort = apply_distort |
| 49 | self._apply_expand = apply_expand |
| 50 | self._resize_height = resize_h |
| 51 | self._resize_width = resize_w |
| 52 | self._img_mean = np.array(mean_value)[:, np.newaxis, np.newaxis].astype( |
| 53 | 'float32') |
| 54 | self._expand_prob = 0.5 |
| 55 | self._expand_max_ratio = 4 |
| 56 | self._hue_prob = 0.5 |
| 57 | self._hue_delta = 18 |
| 58 | self._contrast_prob = 0.5 |
| 59 | self._contrast_delta = 0.5 |
| 60 | self._saturation_prob = 0.5 |
| 61 | self._saturation_delta = 0.5 |
| 62 | self._brightness_prob = 0.5 |
| 63 | self._brightness_delta = 0.125 |
| 64 | |
| 65 | @property |
| 66 | def dataset(self): |