Transform image to Tensor. Required key: 'img'. Modifies key: 'img'. Args: results (dict): contain all information about training.
| 449 | |
| 450 | |
| 451 | class ToUNTensor: |
| 452 | """Transform image to Tensor. |
| 453 | |
| 454 | Required key: 'img'. Modifies key: 'img'. |
| 455 | |
| 456 | Args: |
| 457 | results (dict): contain all information about training. |
| 458 | """ |
| 459 | |
| 460 | def __call__(self, results): |
| 461 | results['image'] = torch.as_tensor(np.ascontiguousarray(results['image'].transpose(2, 0, 1))) |
| 462 | # results['image'] = F.to_tensor(results['image']) |
| 463 | return results |
| 464 | |
| 465 | |
| 466 | class NormalizeTensor: |