Spaces:
Runtime error
Runtime error
Commit ·
28349ee
1
Parent(s): 25cb6f6
add random seed
Browse files
src/__pycache__/js.cpython-310.pyc
DELETED
|
Binary file (1.19 kB)
|
|
|
src/__pycache__/style.cpython-310.pyc
DELETED
|
Binary file (652 Bytes)
|
|
|
src/__pycache__/user.cpython-310.pyc
DELETED
|
Binary file (932 Bytes)
|
|
|
src/__pycache__/utils.cpython-310.pyc
DELETED
|
Binary file (1.19 kB)
|
|
|
src/utils.py
CHANGED
|
@@ -11,6 +11,8 @@ def load_example_images(class_idx, data_dir, max_images=16):
|
|
| 11 |
path = os.path.join(data_dir, 'images', str(class_idx))
|
| 12 |
images = os.listdir(path)
|
| 13 |
# pick max_images random images
|
|
|
|
|
|
|
| 14 |
ids = np.random.choice(len(images), max_images, replace=False)
|
| 15 |
images = [os.path.join(path, images[id]) for id in ids]
|
| 16 |
return images
|
|
|
|
| 11 |
path = os.path.join(data_dir, 'images', str(class_idx))
|
| 12 |
images = os.listdir(path)
|
| 13 |
# pick max_images random images
|
| 14 |
+
# set random seed using time
|
| 15 |
+
np.random.seed(int(time.time()))
|
| 16 |
ids = np.random.choice(len(images), max_images, replace=False)
|
| 17 |
images = [os.path.join(path, images[id]) for id in ids]
|
| 18 |
return images
|