sam_inversion icon indicating copy to clipboard operation
sam_inversion copied to clipboard

Size of input

Open ariel415el opened this issue 2 years ago • 2 comments

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) ```

ariel415el avatar Jun 21 '22 07:06 ariel415el

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

GaParmar avatar Jun 21 '22 11:06 GaParmar

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?

ariel415el avatar Jun 21 '22 12:06 ariel415el