Move data into config
This commit is contained in:
parent
6fdeec0030
commit
e50087be55
2 changed files with 15 additions and 20 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import random
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
DATA = sorted(Path("/mnt/wsl/PHYSICALDRIVE1/data/unsplash").glob("*.jpg"))
|
DATA = sorted(Path("/mnt/wsl/PHYSICALDRIVE1/data/unsplash").glob("*.jpg"))
|
||||||
|
|
@ -9,10 +10,18 @@ LOGS_PATH = Path("/home/andras/projects/bipolaroid/logs")
|
||||||
RUNS_PATH = Path("/home/andras/projects/bipolaroid/runs")
|
RUNS_PATH = Path("/home/andras/projects/bipolaroid/runs")
|
||||||
|
|
||||||
|
|
||||||
for path in [
|
for path in [CACHE_PATH, MODELS_PATH, LOGS_PATH, RUNS_PATH]:
|
||||||
CACHE_PATH,
|
|
||||||
MODELS_PATH,
|
|
||||||
LOGS_PATH,
|
|
||||||
RUNS_PATH
|
|
||||||
]:
|
|
||||||
path.mkdir(exist_ok=True, parents=True)
|
path.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
|
|
||||||
|
length = len(DATA)
|
||||||
|
indices = list(range(length))
|
||||||
|
|
||||||
|
random.seed(42)
|
||||||
|
random.shuffle(indices)
|
||||||
|
|
||||||
|
train_indices = indices[: int(length * TRAIN_SIZE)]
|
||||||
|
test_indices = indices[int(length * TRAIN_SIZE) :]
|
||||||
|
|
||||||
|
TRAIN_DATA = [DATA[i] for i in train_indices]
|
||||||
|
TEST_DATA = [DATA[i] for i in test_indices]
|
||||||
|
|
|
||||||
14
src/data.py
14
src/data.py
|
|
@ -1,14 +0,0 @@
|
||||||
import random
|
|
||||||
from config import DATA, TRAIN_SIZE
|
|
||||||
|
|
||||||
random.seed(42)
|
|
||||||
length = len(DATA)
|
|
||||||
indices = list(range(length))
|
|
||||||
|
|
||||||
random.shuffle(indices)
|
|
||||||
|
|
||||||
train_indices = indices[: int(length * TRAIN_SIZE)]
|
|
||||||
test_indices = indices[int(length * TRAIN_SIZE) :]
|
|
||||||
|
|
||||||
TRAIN_DATA = [DATA[i] for i in train_indices]
|
|
||||||
TEST_DATA = [DATA[i] for i in test_indices]
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue