Skip to content

Commit

Permalink
feat(chore): add traintest dir
Browse files Browse the repository at this point in the history
  • Loading branch information
saeranv committed Apr 25, 2021
1 parent 18fac3b commit cea9225
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ dmypy.json
# Pyre type checker
.pyre/

# Git
.git-credentials
/.git-credentials

# Honeybee/Ladybug data
/run
/models
Expand Down
11 changes: 4 additions & 7 deletions deeprad/preprocess_traintest.py → deeprad/make_traintest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Preprocess raw outputs from GH for train/test dataset."""
"""Preprocess raw outputs from GHOUT_DIR for train/test dataset."""
import os
import numpy as np

Expand All @@ -11,12 +11,10 @@
DEEPRAD_TRAINTEST_DIR = utils.DEEPRAD_TRAINTEST_DIR


def load_img_gray(img_fpath):
return cv2.imread(img_fpath, cv2.)
def preprocess_img(img_fpath: str) -> np.ndarray:
"""Preprocess image for traintest."""


def preprocess_img(img_fpath):
pass
print(img_fpath)


def main():
Expand All @@ -42,7 +40,6 @@ def main():
# add as channels

# save new images
# delete all raw images

pass

Expand Down
12 changes: 10 additions & 2 deletions deeprad/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ def to_poly_np(poly_sh):
return np.array(poly_sh.exterior.xy)


def load_img_gray(img_fpath: str) -> np.ndarray:
return cv2.imread(img_fpath, cv2.IMREAD_GRAYSCALE)


def load_img_rgb(img_fpath: str) -> np.ndarray:
return cv2.imread(img_fpath, cv2.COLOR_BGR2RGB)


def extract_floorplan_ids(data_num, target_data_dir=None, verbose=True):
"""Safely extract root model directories for polygon extraction."""

Expand Down Expand Up @@ -97,8 +105,8 @@ def load_floorplan_data(targ_id_dirs, data_num):

idx += 1
hdict_arr[idx] = hdict
src_img_arr[idx] = cv2.imread(targ_src_fpath, cv2.COLOR_BGR2RGB)
label_img_arr[idx] = cv2.imread(targ_label_fpath, cv2.IMREAD_GRAYSCALE)
src_img_arr[idx] = koad_img_rgb(targ_src_fpath)
label_img_arr[idx] = load_img_gray(targ_label_fpath)
targ_id_dir_arr[idx] = targ_id_dir
null_lst.append(targ_id_dirs[i] + '\n')

Expand Down

0 comments on commit cea9225

Please sign in to comment.