(self, wsi, tiles, resize_to=224)
| 448 | |
| 449 | class BagOfTiles(Dataset): |
| 450 | def __init__(self, wsi, tiles, resize_to=224): |
| 451 | self.wsi = wsi |
| 452 | self.tiles = tiles |
| 453 | |
| 454 | self.roi_transforms = transforms.Compose( |
| 455 | [ |
| 456 | # As we can't be sure that the input tile dimensions are all consistent, we resize |
| 457 | # them to a commonly used size before feeding them to the model. |
| 458 | # Note: assumes a square image. |
| 459 | transforms.Resize(resize_to), |
| 460 | # Turn the PIL image into a (C x H x W) float tensor in the range [0.0, 1.0] |
| 461 | transforms.ToTensor(), |
| 462 | ] |
| 463 | ) |
| 464 | |
| 465 | def __len__(self): |
| 466 | return len(self.tiles) |
nothing calls this directly
no outgoing calls
no test coverage detected