Skip to content
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

Merged
merged 6 commits into from
Jun 17, 2024

Conversation

marinabar
Copy link
Contributor

@marinabar marinabar commented Jun 13, 2024

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 filesmin.png, mean.png, and max.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 Reviewable

@marinabar marinabar requested a review from aliberts June 13, 2024 16:48
@aliberts aliberts marked this pull request as ready for review June 13, 2024 17:19
@aliberts aliberts added 🐛 Bug Something isn't working ✨ Enhancement New feature or request 🗃️ Dataset Something dataset-related and removed 🐛 Bug Something isn't working labels Jun 13, 2024
Copy link
Collaborator

@aliberts aliberts left a 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:

    1. Run the script and ensure there are no errors
    1. Check that the files and folders have been created (in outputs/image_transforms)

tf = get_image_transforms(**kwargs)
transformed_frame = tf(original_frame)
to_pil(transformed_frame).save(output_dir_single / "max.png", quality=100)

Copy link
Collaborator

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?

Suggested change
# 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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f98c9a7 done

Copy link
Collaborator

@aliberts aliberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aliberts aliberts merged commit e28fa23 into main Jun 17, 2024
6 checks passed
@aliberts aliberts deleted the user/marinabar/2024_06_13_min_max_transforms_visualize branch June 17, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗃️ Dataset Something dataset-related ✨ Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants