Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions avae/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ def load_config_params(
# if no config file is provided, start from default and update with command line arguments
params = {}

command_line_params = set()

# check for command line input values and overwrite config file values
# we're using sys args because click has populated defaults from confing
if sys_args is not None:
Expand All @@ -337,6 +339,7 @@ def load_config_params(
continue
name = arg[2:].split("=")[0]
if name in local_args.keys():
command_line_params.add(name)
# overwrite config file value with command line argument value
# but only if its on system args (click has defaults)
if name in params.keys():
Expand Down Expand Up @@ -372,7 +375,11 @@ def load_config_params(
if type(val) == pathlib.Path:
# turn relative paths to absolute
params[key] = str(val.absolute())
if 'vis' in key and params['vis_all'] is not None:
if (
'vis' in key
and params['vis_all'] is not None
and key not in command_line_params
):
# set visualisation to vis_all if it is not set, except for vis_z_n_int and vis_pose_class
if key in [
'vis_all',
Expand All @@ -385,7 +392,11 @@ def load_config_params(
logging.warning(
f"Visualisation parameter 'vis_all' is overriding {key} to {params['vis_all']}"
)
if 'freq' in key and params['freq_all'] is not None:
if (
'freq' in key
and params['freq_all'] is not None
and key not in command_line_params
):
# set frequency to freq_all if it is not set
if key in ['freq_all']:
continue
Expand Down
2 changes: 1 addition & 1 deletion avae/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def load_data(

logging.info("\n")
logging.info("############################################### DATA")
logging.info(f"Loading data...")
logging.info("Loading data...\n")

# read the class list, if not provided all classes in the dataset will be used as default
if classes is not None:
Expand Down
14 changes: 10 additions & 4 deletions avae/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ def save_imshow_png(
if not os.path.exists("plots"):
os.mkdir("plots")

fig, _ = plt.subplots(figsize=(10, 10))
plt.imshow(array, cmap=cmap, vmin=min, vmax=max) # channels last

plt.savefig("plots/" + fname)
height, width = array.shape[:2]
if width >= height:
image_figure_size = (10, 10 * height / width)
else:
image_figure_size = (10 * width / height, 10)
fig, ax = plt.subplots(figsize=image_figure_size)
ax.imshow(array, cmap=cmap, vmin=min, vmax=max) # channels last
ax.axis("off")
fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
fig.savefig("plots/" + fname, bbox_inches="tight", pad_inches=0)

if writer:
writer.add_figure(figname, fig, epoch)
Expand Down
Loading
Loading