adobe-research / sam_inversion

[CVPR 2022] GAN inversion and editing with spatially-adaptive multiple latent layers
Other
171 stars 10 forks source link

Size of input #4

Open ariel415el opened 2 years ago

ariel415el commented 2 years ago

I'm running python src/sam_inv_optimization.py --image_category "cars" --image_path car1.jpg --output_path "output/cars/" --sweep_thresholds --generate_edits where car1.jpg is a 1200x800 rgb image. I get the following errors:


  File "src/sam_inv_optimization.py", line 165, in <module>
    d_refined_invmap = refine(d_invmaps, segments, thresh)
  File "/home/ariel/repos/sam_inversion/src/mask_utils.py", line 18, in refine
    avg_val = (d_invmaps[l_name].detach().cpu()*curr_segment).sum() / curr_segment.sum()
ValueError: operands could not be broadcast together with shapes (1,1,800,1200) (192,256) ```
GaParmar commented 2 years ago

Can you try after resizing to 384x512? I think this step is needed because to match the resolution that the car model is trained for

ariel415el commented 2 years ago

No, when I changed https://github.com/adobe-research/sam_inversion/blob/4852a2a033ac5af981f91b9eb2baa3df6e2229fa/src/sam_inv_optimization.py#L141 to T_full = build_t(W=512, H=384) it didnt work but T_full = build_t(W=256, H=192) worked. Can you explain this? How can I run inference on bigger images?