We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to log images during training process, I followed info on "https://docs.wandb.ai/guides/integrations/pytorch" this page.
My codes looks like this:
image_table = wandb.Table() lr_images_list = [] rc_images_list = [] hr_images_list = [] transform_2PIL = tvt.Compose([tvt.ToPILImage(mode='L')]) for index in range(recon_images.size(0)): lr_images_list.append(transform_2PIL(low_res_images[index, :, :, :])) rc_images_list.append(transform_2PIL(recon_images[index, :, :, :])) hr_images_list.append(transform_2PIL(high_res_images[index, :, :, :])) image_table.add_column("Low Res Image", lr_images_list) image_table.add_column("Reconstruction Image", rc_images_list) image_table.add_column("High resolution Image", hr_images_list) image_table.add_column("Index of Batch", step_in_batch) image_table.add_column("Global Step", global_step) # Log your Table to W&B wandb.log({f"Result for {step_in_batch} at {global_step}": image_table})
But as soon as image_table.add_column("Low Res Image", lr_images_list) executes, it outputs:
image_table.add_column("Low Res Image", lr_images_list)
Traceback (most recent call last): File "D:\Program Files\JetBrains\PyCharm 2020.3.5\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec exec(exp, global_vars, local_vars) File "<input>", line 1, in <module> File "C:\Users\kousa\.conda\envs\UDPET_GPU\Lib\site-packages\wandb\data_types.py", line 774, in add_column assert is_first_col or len(data) == len( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: Expected length 0, found 4
low_res_images is a pytorch tensor, I am trying to turn them back to PIL and then log them in wandb, however, i couldn't get it to run.
low_res_images
I also tried something like:
image_table = wandb.Table(columns=["Low Res Image", "Reconstruction Image","High Resolution Image", "Index of Batch", "Global Step", "Index in Batch"]) for index in range(recon_images.size(0)): image_table.add_data(transform_2PIL(low_res_images[index, :, :, :]), transform_2PIL(recon_images[index, :, :, :]), transform_2PIL(high_res_images[index, :, :, :]), step_in_batch, global_step, index) wandb.log({f"Result for {step_in_batch} at {global_step}": image_table})
But it gives TypeError: Object of type Image is not JSON serializable.
TypeError: Object of type Image is not JSON serializable
What went wrong? Any insight is appreciated!
The text was updated successfully, but these errors were encountered:
Note the length of the list is 4, so that is where 4 is coming from
Sorry, something went wrong.
hey @GrandArth - what wandb SDK version are you running? looking into reproducing this on my end
maybe you need wandb.Image()
wandb.Image()
No branches or pull requests
I am trying to log images during training process, I followed info on "https://docs.wandb.ai/guides/integrations/pytorch" this page.
My codes looks like this:
But as soon as
image_table.add_column("Low Res Image", lr_images_list)
executes, it outputs:low_res_images
is a pytorch tensor, I am trying to turn them back to PIL and then log them in wandb, however, i couldn't get it to run.I also tried something like:
But it gives
TypeError: Object of type Image is not JSON serializable
.What went wrong?
Any insight is appreciated!
The text was updated successfully, but these errors were encountered: