You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems to_deterministic uses single random seed among multi-times call, but NOT inside a batch:
import time
import random
import os
import glob
import cv2
import numpy as np
import imgaug as ia
import imgaug.augmenters as iaa
if __name__ == "__main__":
iapipline = \
iaa.Sequential([
iaa.Resize((0.8, 1.2), interpolation="linear"),
iaa.CenterPadToFixedSize(224, 128),
iaa.CenterCropToFixedSize(224, 128)
]).to_deterministic()
src_image_paths = glob.glob(os.path.join("pgs/cases/*.jpg"))
src_image_nps = [cv2.imread(e) for e in src_image_paths]
src_image_nps = np.stack(src_image_nps)
# every image in src_image_nps will use different random
rr = iapipline(images=src_image_nps)
rr = []
# only in this way will every image use the same random
for i in range(len(src_image_nps)):
rr.append(iapipline(image=src_image_nps[i]))
How to set the same random inside a batch?
The text was updated successfully, but these errors were encountered:
Seems
to_deterministic
uses single random seed among multi-times call, but NOT inside a batch:How to set the same random inside a batch?
The text was updated successfully, but these errors were encountered: