Defines the transformations that should be applied to test PIL image for input into the network dimension -> tensorize -> color adj Arguments: resize (int): input dimension to SSD rgb_means ((int,int,int)): average RGB of the dataset (104,117,123)
| 271 | |
| 272 | |
| 273 | class ValTransform: |
| 274 | """ |
| 275 | Defines the transformations that should be applied to test PIL image |
| 276 | for input into the network |
| 277 | |
| 278 | dimension -> tensorize -> color adj |
| 279 | |
| 280 | Arguments: |
| 281 | resize (int): input dimension to SSD |
| 282 | rgb_means ((int,int,int)): average RGB of the dataset |
| 283 | (104,117,123) |
| 284 | swap ((int,int,int)): final order of channels |
| 285 | |
| 286 | Returns: |
| 287 | transform (transform) : callable transform to be applied to test/val |
| 288 | data |
| 289 | """ |
| 290 | |
| 291 | def __init__(self, rgb_means=None, std=None, swap=(2, 0, 1)): |
| 292 | self.means = rgb_means |
| 293 | self.swap = swap |
| 294 | self.std = std |
| 295 | |
| 296 | # assume input is cv2 img for now |
| 297 | def __call__(self, img, res, input_size): |
| 298 | img, _ = preproc(img, input_size, self.means, self.std, self.swap) |
| 299 | return img, np.zeros((1, 5)) |
no outgoing calls
no test coverage detected