Closed blaine141 closed 3 months ago
Would you mind sharing your measurement code so we compare apples to apples?
Looks like OpenCV function CopyMakeBorder
always creates copy of image.
import cv2 as cv
import numpy as np
import time
img = np.empty([512, 512, 3], dtype=np.uint8)
res = cv.copyMakeBorder(img, 0, 0, 0, 0, cv.BORDER_CONSTANT, value=0)
id(res), id(img), id(res) == id(img)
# (140702040314624, 140702040316144, False)
I have discovered that PadIfNeeded has some bug slowing it down. I have an application where I had PadIfNeeded just in case. It never had to pad any of my samples as they were all big enough, but still introduced a 150ms delay in the augmentation. I imagine it should not take 150ms to just check the dimensions of the input. Here is the Augmentation I am using. With PadIfNeeded it takes 0.25 seconds. Without PadIfNeeded it takes 0.1 seconds.
I haven't looked that much into the issue since I don't need PadIfNecessary, just thought I'd share.