get rid of random module
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import traceback
|
import traceback
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import random
|
|
||||||
import cv2
|
import cv2
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from utils import iter_utils
|
from utils import iter_utils
|
||||||
@@ -119,7 +118,8 @@ class SampleGeneratorFace(SampleGeneratorBase):
|
|||||||
idx = shuffle_idxs.pop()
|
idx = shuffle_idxs.pop()
|
||||||
if samples[idx] != None:
|
if samples[idx] != None:
|
||||||
if len(shuffle_idxs_2D[idx]) == 0:
|
if len(shuffle_idxs_2D[idx]) == 0:
|
||||||
shuffle_idxs_2D[idx] = random.sample( range(len(samples[idx])), len(samples[idx]) )
|
a = shuffle_idxs_2D[idx] = [ *range(len(samples[idx])) ]
|
||||||
|
np.random.shuffle (a)
|
||||||
|
|
||||||
idx2 = shuffle_idxs_2D[idx].pop()
|
idx2 = shuffle_idxs_2D[idx].pop()
|
||||||
sample = samples[idx][idx2]
|
sample = samples[idx][idx2]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import traceback
|
import traceback
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import random
|
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
from utils import iter_utils
|
from utils import iter_utils
|
||||||
@@ -58,7 +57,8 @@ class SampleGeneratorImageTemporal(SampleGeneratorBase):
|
|||||||
for n_batch in range(self.batch_size):
|
for n_batch in range(self.batch_size):
|
||||||
|
|
||||||
if len(shuffle_idxs) == 0:
|
if len(shuffle_idxs) == 0:
|
||||||
shuffle_idxs = random.sample( range(samples_sub_len), samples_sub_len )
|
shuffle_idxs = [ *range(samples_sub_len) ]
|
||||||
|
np.random.shuffle (shuffle_idxs)
|
||||||
|
|
||||||
idx = shuffle_idxs.pop()
|
idx = shuffle_idxs.pop()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user