Skip to content

Commit

Permalink
remove directories creation in utils.py path, but create directories …
Browse files Browse the repository at this point in the history
…in executable file path
  • Loading branch information
RocketFlash committed Aug 29, 2019
1 parent 0689e76 commit 5cf1178
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
3 changes: 0 additions & 3 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ def __init__(self, cfg_file):
self.l_model = []

self.encodings_path = params['encodings_path']
self.configs_path = params['configs_path']
self.plots_path = params['plots_path']
self.tensorboard_log_path = params['tensorboard_log_path']
self.weights_save_path = params['weights_save_path']

os.makedirs(self.encodings_path, exist_ok=True)
os.makedirs(self.configs_path, exist_ok=True)
os.makedirs(self.plots_path, exist_ok=True)
os.makedirs(self.tensorboard_log_path, exist_ok=True)
os.makedirs(self.weights_save_path, exist_ok=True)
Expand Down Expand Up @@ -235,7 +233,6 @@ def predict(self, image):
else:
img = image
img = cv2.resize(img, (self.input_shape[0], self.input_shape[1]))
print(img.shape)
encoding = self.base_model.predict(np.expand_dims(img, axis=0))
distances = self.calculate_distances(encoding)
max_element = np.argmin(distances)
Expand Down
14 changes: 4 additions & 10 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,13 @@ def parse_net_params(filename='configs/road_signs.yml'):

params = {k: v for k, v in cfg.items() if k not in ['optimizer']}

current_directory = os.path.dirname(os.path.abspath(__file__))
print(current_directory)
params['encodings_path'] = os.path.join(current_directory,
cfg['encodings_path'],
params['encodings_path'] = os.path.join(cfg['encodings_path'],
cfg['project_name'])
params['plots_path'] = os.path.join(current_directory,
cfg['plots_path'],
params['plots_path'] = os.path.join(cfg['plots_path'],
cfg['project_name'])
params['tensorboard_log_path'] = os.path.join(current_directory,
cfg['tensorboard_log_path'],
params['tensorboard_log_path'] = os.path.join(cfg['tensorboard_log_path'],
cfg['project_name'])
params['weights_save_path'] = os.path.join(current_directory,
cfg['weights_save_path'],
params['weights_save_path'] = os.path.join(cfg['weights_save_path'],
cfg['project_name'])

if 'dataset_path' in cfg:
Expand Down

0 comments on commit 5cf1178

Please sign in to comment.