INNER CODE UNIT · Python

step_height1

Shilin-LU/TF-ICON · scripts/app.py:211

    step_height1 = step_height2 + remainder
    step_width2, remainder = divmod(width, 2)
    step_width1 = step_width2 + remainder
        
    # compositing in pixel space for same-domain composition
    save_image[:, :, center_row_rm - step_height1:center_row_rm + step_height2, center_col_rm - step_width1:center_col_rm + step_width2] \
            = save_image[:, :, center_row_rm - step_height1:center_row_rm + step_height2, center_col_rm - step_width1:center_col_rm + step_width2].clone() \
            * (1 - segmentation_map_save[:, :, top_rr:bottom_rr, left_rr:right_rr]) \
            + ref_image[:, :, top_rr:bottom_rr, left_rr:right_rr].clone() \
            * segmentation_map_save[:, :, top_rr:bottom_rr, left_rr:right_rr]

    # save the mask and the pixel space composited image
    save_mask = torch.zeros_like(init_image) 
    save_mask[:, :, center_row_rm - step_height1:center_row_rm + step_height2, center_col_rm - step_width1:center_col_rm + step_width2] = 1

    # image = Image.fromarray(((save_image/torch.max(save_image.max(), abs(save_image.min())) + 1) * 127.5)[0].permute(1,2,0).to(dtype=torch.uint8).cpu().numpy())
    precision_scope = autocast if precision == "autocast" else nullcontext
    

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…