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

Insufficient video memory #21

Open
userLx888 opened this issue May 5, 2022 · 5 comments
Open

Insufficient video memory #21

userLx888 opened this issue May 5, 2022 · 5 comments

Comments

@userLx888
Copy link

Training structure_generator.In order to solve the problem of insufficient video memory during generator, reducing batch_size leads to an error when saving the training results : Index 1 is out of bounds for axis 0 with size 1.I hope I can get your help. Thank you!

@USTC-JialunPeng
Copy link
Owner

What is your batch size? And please attach your error log.

@userLx888
Copy link
Author

my batch size is 2,
0PR(%3S} A KPPPH )7I6~M

@USTC-JialunPeng
Copy link
Owner

I found the problem. The visualization of structure feature maps shows 4 images. You can replace line162 with height = size and line167 with for i in range(1): to show only 1 image.

def structure_visual(gt, masked, recons_gen, recons_gt, iter, size, save_dir):
""" Show 4 generated structure feature maps in the training of structure generator."""
# gap between each images
gap = 2
# height and width of result image
height = size * 4 + gap * 3
width = size * 4 + gap * 3
result = 255 * np.ones((height, width, 3), dtype=np.uint8)
for i in range(4):
gt_i = ((gt[i] + 1.) * 127.5).astype(np.uint8)
masked_i = ((masked[i] + 1.) * 127.5).astype(np.uint8)
recons_gen_i = ((recons_gen[i] + 1.) * 127.5).astype(np.uint8)
recons_gt_i = ((recons_gt[i] + 1.) * 127.5).astype(np.uint8)
# fill the images into grid
result[i*(size+gap):i*(size+gap)+size, 0*(size+gap):0*(size+gap)+size, ::-1] = gt_i
result[i*(size+gap):i*(size+gap)+size, 1*(size+gap):1*(size+gap)+size, ::-1] = masked_i
result[i*(size+gap):i*(size+gap)+size, 2*(size+gap):2*(size+gap)+size, ::-1] = recons_gen_i
result[i*(size+gap):i*(size+gap)+size, 3*(size+gap):3*(size+gap)+size, ::-1] = recons_gt_i
cv2.imwrite(os.path.join(save_dir, 'structure%d.png' % iter), result)

@userLx888
Copy link
Author

OK OK,I get it ,thank you very much!

1 similar comment
@userLx888
Copy link
Author

OK OK,I get it ,thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants