(img, prediction, size=128)
| 120 | crop = torch.cat((crop, one[:, :, i*size:(i+1)*size, j*size:(j+1)*size]), dim=0) |
| 121 | return crop |
| 122 | def crop_concat_back(img, prediction, size=128): |
| 123 | shape = img.shape |
| 124 | for i in range(shape[2]//size+1): |
| 125 | for j in range(shape[3]//size+1): |
| 126 | if j == 0: |
| 127 | crop = prediction[(i*(shape[3]//size+1)+j)*shape[0]:(i*(shape[3]//size+1)+j+1)*shape[0], :, :, :] |
| 128 | else: |
| 129 | crop = torch.cat((crop, prediction[(i*(shape[3]//size+1)+j)*shape[0]:(i*(shape[3]//size+1)+j+1)*shape[0], :, :, :]), dim=3) |
| 130 | if i == 0: |
| 131 | crop_concat = crop |
| 132 | else: |
| 133 | crop_concat = torch.cat((crop_concat, crop), dim=2) |
| 134 | return crop_concat[:, :, :shape[2], :shape[3]] |
| 135 | |
| 136 | def min_max(array): |
| 137 | return (array - array.min()) / (array.max() - array.min()) |
nothing calls this directly
no outgoing calls
no test coverage detected