Commit 5b53d8a
Sample single scale per GPU in LSJ data augmentation.
Summary:
Code for sampling only one scale per minibatch in the LSJ data augmentation. `dataloader.train.mode` can be set to `per_image` to sample a separate scale for every image, `per_gpu` to sample a scale for each GPU in each minibatch, or `per_batch` to sample a single scale across all GPUs for each minibatch. Padding up to 1024x1024 is removed so that small scales can run faster.
The implementation follows that from [A Multigrid Method for Efficiently Training Video Models](https://openaccess.thecvf.com/content_CVPR_2020/papers/Wu_A_Multigrid_Method_for_Efficiently_Training_Video_Models_CVPR_2020_paper.pdf]): the batch sampler samples scales in the desired mode, then for each image returns a tuple `(index, scale)`. The dataset's `__getitem__` is modified to take such a tuple as input instead of just an index.
When sampled this way:
1) Padding is slightly different; it is done by the model (as is true for non-LSJ data augmentation) and not the augmentation. This means padding occurs after horizontal flipping instead of before, and uses a slightly different value (0.0 after normalization, instead of 128 before normalization).
2) Grouping by aspect ratio is turned off, since it is now detrimental.
Reviewed By: vaibhava0
Differential Revision: D29506785
fbshipit-source-id: b252f21668f1508618d127133b64e28b17f48fd61 parent 0954ef3 commit 5b53d8a
File tree
2 files changed
+63
-41
lines changed- detectron2/data
- transforms
2 files changed
+63
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
115 | 144 | | |
116 | 145 | | |
117 | 146 | | |
| |||
157 | 186 | | |
158 | 187 | | |
159 | 188 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 189 | + | |
178 | 190 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 191 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
| 209 | + | |
211 | 210 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
217 | 219 | | |
218 | | - | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | | - | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
223 | 230 | | |
224 | 231 | | |
225 | 232 | | |
| |||
279 | 286 | | |
280 | 287 | | |
281 | 288 | | |
282 | | - | |
| 289 | + | |
| 290 | + | |
283 | 291 | | |
284 | 292 | | |
285 | | - | |
| 293 | + | |
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| 297 | + | |
289 | 298 | | |
290 | 299 | | |
291 | 300 | | |
292 | 301 | | |
293 | 302 | | |
294 | | - | |
| 303 | + | |
295 | 304 | | |
296 | 305 | | |
297 | 306 | | |
| |||
301 | 310 | | |
302 | 311 | | |
303 | 312 | | |
304 | | - | |
| 313 | + | |
305 | 314 | | |
306 | 315 | | |
307 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
308 | 322 | | |
309 | 323 | | |
310 | 324 | | |
311 | 325 | | |
312 | | - | |
| 326 | + | |
313 | 327 | | |
314 | 328 | | |
315 | 329 | | |
316 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
317 | 335 | | |
318 | 336 | | |
319 | 337 | | |
| |||
0 commit comments