-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto Visualization #26
base: main
Are you sure you want to change the base?
Conversation
auto_run.py
Outdated
directory = os.listdir(os.path.join(base_dir, sub_dir)) | ||
weight_file = [f for f in directory if (f.endswith(".hdf5"))] | ||
for name in weight_file: | ||
match = re.search('hpe_epoch(\d+)', name) | ||
if match: | ||
epoch.append((match.group(1), sub_dir)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend dictionary here
directory = os.listdir(os.path.join(base_dir, sub_dir)) | |
weight_file = [f for f in directory if (f.endswith(".hdf5"))] | |
for name in weight_file: | |
match = re.search('hpe_epoch(\d+)', name) | |
if match: | |
epoch.append((match.group(1), sub_dir)) | |
epochs = {} | |
directory = os.listdir(os.path.join(base_dir, sub_dir)) | |
weight_file = [f for f in directory if (f.endswith(".hdf5"))] | |
for name in weight_file: | |
match = re.search('^hpe_epoch(\d+)', name) | |
if match: | |
epochs[match.group] = sub_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah good suggestion :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we planning on using auto_run.py as a callback function for after each epoch or run only at the end for all epochs?
|
||
# Get predicted keypoints from last hourglass (eval.num_hg_blocks-1) | ||
keypoints = eval.heatmaps_to_keypoints(predict_heatmaps[eval.num_hg_blocks-1, 0, :, :, :]) | ||
print(keypoints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to print the keypoints here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emmm, not necessary when we are running multiple models but it's very useful when we want to dig into one image. The key point np.array tells us which joint the model is seeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a callback function. We are running this at the very end. Enabling a callback function would significantly increase our running time.
output_dim=OUTPUT_DIM, | ||
num_hg_blocks=eval.num_hg_blocks, | ||
shuffle=False, | ||
batch_size=len(test_df), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only ever plan on passing the representative set, then this fine, but if we pass a test_df
of the scale similar to our test set then it won't fit in memory. Will have to visualize in batches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just past in the representative set for quick comparisons. It takes about 40 mins to run 10 epochs on the representative set for each model.
x.append(keypoints[i,0]) | ||
y.append(keypoints[i,1]) | ||
plt.scatter(x,y) | ||
plt.imshow(img) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are running this on all our models, then we may want to save these images to disk, we also may want to visualize the representative set rather than just generator[168]
if '_hg_' in sub_dir and sub_dir not in models and sub_dir not in output_models: | ||
models.append(sub_dir) | ||
epoch = find_epochs(DEFAULT_MODEL_BASE_DIR, sub_dir, epoch, models) | ||
for (n_epoch, model_file) in epoch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the models make large progress at the beginning and less so near the end, and because loading/visualizing takes some time, we may want to limit the epochs we visualize. So for example, only visualize epochs: [1,2,3,4,5,10,20,30,40]
or something along those lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a very good point! I'll look into it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
auto_run.py is an extension of Julian's run_evaluation.py. It automatically runs the representative set for all models that are contained in a path and subdirectories within the path.
Small changes in constants.py to work with os.path.join().