Skip to content

Commit

Permalink
added sync for val batches
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxTeselkin committed Jul 4, 2023
1 parent 9d4387d commit b87b4c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions train/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,15 @@ def update_globals(new_dataset_ids):
train_batches_gallery = GridGallery(
columns_number=3,
show_opacity_slider=False,
enable_zoom=True,
)
train_batches_gallery_f = Field(train_batches_gallery, "Train batches visualization")
train_batches_gallery_f.hide()
val_batches_gallery = GridGallery(
columns_number=2,
show_opacity_slider=False,
enable_zoom=True,
sync_views=True,
)
val_batches_gallery_f = Field(val_batches_gallery, "Model predictions visualization")
val_batches_gallery_f.hide()
Expand Down Expand Up @@ -1130,22 +1133,25 @@ def train_batch_watcher_func():

# visualize model predictions
for i in range(4):
val_batch_labels_id, val_batch_preds_id = None, None
labels_path = os.path.join(local_artifacts_dir, f"val_batch{i}_labels.jpg")
if os.path.exists(labels_path):
remote_labels_path = os.path.join(remote_images_path, f"val_batch{i}_labels.jpg")
tf_labels_info = api.file.upload(team_id, labels_path, remote_labels_path)
val_batches_gallery.append(
val_batch_labels_id = val_batches_gallery.append(
image_url=tf_labels_info.full_storage_url,
title="labels",
)
preds_path = os.path.join(local_artifacts_dir, f"val_batch{i}_pred.jpg")
if os.path.exists(preds_path):
remote_preds_path = os.path.join(remote_images_path, f"val_batch{i}_pred.jpg")
tf_preds_info = api.file.upload(team_id, preds_path, remote_preds_path)
val_batches_gallery.append(
val_batch_preds_id = val_batches_gallery.append(
image_url=tf_preds_info.full_storage_url,
title="predictions",
)
if val_batch_labels_id and val_batch_preds_id:
val_batches_gallery.sync_images([[val_batch_labels_id, val_batch_preds_id]])
if i == 0:
val_batches_gallery_f.show()

Expand Down

0 comments on commit b87b4c8

Please sign in to comment.