Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Pilosov, PhD
120175b2d9 dont need this many animations 2024-02-23 16:45:32 +00:00
Michael Pilosov, PhD
ffcee4e8b1 image resolution saving default 2024-02-23 16:45:22 +00:00
Michael Pilosov, PhD
d5463951cf update compositing for redone images 2024-02-23 16:44:54 +00:00
4 changed files with 13 additions and 7 deletions

View File

@ -25,7 +25,7 @@ class SaveImageCallback(Callback):
# else:
# version = 0
fname = Path(pl_module.trainer.logger.log_dir) / Path(f"e{epoch:04d}")
create_circle(pl_module, fname=fname)
create_circle(pl_module, fname=fname, dpi=300, figsize=(6, 6))
# Make sure to set it back to train mode
pl_module.train()

View File

@ -61,7 +61,7 @@ def create_circle(
def plot_preds(
preds, rgb_values, fname: str, roll: bool = False, dpi: int = 150, figsize=(3, 3)
preds, rgb_values, fname: str, roll: bool = False, dpi: int = 300, figsize=(6, 6)
):
if isinstance(preds, torch.Tensor):
preds = preds.detach().cpu().numpy()

View File

@ -8,7 +8,7 @@ from lightning_sdk import Machine, Studio # noqa: F401
# consistency of randomly sampled experiments.
seed(19920921)
NUM_JOBS = 100
NUM_JOBS = 50
# reference to the current studio
# if you run outside of Lightning, you can pass the Studio name

View File

@ -55,13 +55,19 @@ def create_grid_composite(
# Save the composite image
composite.write_to_file(output_file)
x = pyvips.Image.thumbnail(output_file, 1080 * 4)
x.write_to_file("out_sm.png")
x.write_to_file(output_file.replace(".png", "_pre.png"))
print(output_file)
if __name__ == "__main__":
# Example usage
directory = "/teamspace/studios/this_studio/out_sortcolors/umap/" # Change to your directory path
# experiment = "umap"
experiment = "supervised"
# directory = "/teamspace/studios/this_studio/out_sortcolors/{experiment}/" # Change to your directory path
directory = f"/teamspace/studios/this_studio/colors/colors-refactor-{experiment}/" # Change to your directory path
k = 10
spacing_inches = 1.5
create_grid_composite(directory, k, spacing_inches)
spacing_inches = 2
sp_str = str(spacing_inches).replace(".", "-")
# savefile = f"/teamspace/studios/this_studio/composites/{experiment}-{sp_str}.png"
savefile = f"/teamspace/studios/this_studio/composites/{experiment}-{sp_str}.png"
create_grid_composite(directory, k, spacing_inches, output_file=savefile)