I’m having problems to cut holes on the images in a grid.

I have imported the images with size 224 as follows:

`data = ImageDataBunch.from_folder(path = path,train="train" , valid = "validation", ds_tfms=tfms, size=224, num_workers=16, bs = 64).normalize(imagenet_stats)`

I want to cut square holes of size 56x56 (basically divide my 224 size image in 16 squares and randomly cut some of them).

But as we can see in the red highlighted partS, some cuts are not fitting the 56x56 square size.

Also, since i cut the holes with probability 50%, about half of the image should be cut, but it appears that more than half is always being cut.

I suppose this is happening because the cuts are being made before the image is resized to 224 size (originally the images are from variate size).

If that’s the case, I probably would want to change the order of the transformation, right?

` cutoutgrids = TfmPixel(_cutoutgrids, order=20) `

I tried to change it (order = 1, 20, 30, 50 ,…) but none of them solved the problem. I thought all transformations were done after the resizing.

Here’s the transformation I defined in case you want to check:

```
def _cutoutgrids(x, patch_size:uniform_int=32, p_cut = 0.5):
"Divides the image in a grid and cut some parts"
h,w = x.shape[1:]
for i in range(int(w/patch_size)):
for j in range(int(h/patch_size)):
if np.random.uniform() < p_cut:
y1 = j*patch_size
y2 = y1 + patch_size
x1 = i*patch_size
x2 = x1 + patch_size
x[0, y1:y2, x1:x2] = 0.540202
x[1, y1:y2, x1:x2] = 0.544406
x[2, y1:y2, x1:x2] = 0.514351
return x
cutoutgrids = TfmPixel(_cutoutgrids, order=20)
tfms = [cutoutgrids(patch_size=(56,56))]
tfms = [tfms, []]
```