-
Notifications
You must be signed in to change notification settings - Fork 641
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
added visualization for min and max transforms #271
added visualization for min and max transforms #271
Conversation
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.
Thanks!
Left one addition for you.
Also, can you add a test for this script?
The test would be:
-
- Run the script and ensure there are no errors
-
- Check that the files and folders have been created (in
outputs/image_transforms
)
- Check that the files and folders have been created (in
tf = get_image_transforms(**kwargs) | ||
transformed_frame = tf(original_frame) | ||
to_pil(transformed_frame).save(output_dir_single / "max.png", quality=100) | ||
|
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.
Could you add this one as well?
# Apply mean transformation | |
mean_value = (min_value + max_value) / 2 | |
kwargs = { | |
f"{transform}_weight": cfg[f"{transform}"].weight, | |
f"{transform}_min_max": (mean_value, mean_value), | |
} | |
tf = get_image_transforms(**kwargs) | |
transformed_frame = tf(original_frame) | |
to_pil(transformed_frame).save(output_dir_single / "mean.png", quality=100) |
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.
f98c9a7 done
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, thanks!
What this does
Allows to visualize maximum and minimum transformations that could be applied to your dataset given a specified min_max range. Saves three additional files
min.png
,mean.png
, andmax.png
for each transform.How it was tested
Unit test added :
test_visualize_image_transforms.py
pytest tests/test_visualize_image_transforms.py
How to checkout & try? (for the reviewer)
You can run the script on any config parameters. For example
python lerobot/scripts/visualize_image_transforms.py training.image_transforms.contrast=(0.5, 0.5)
This change is