INNER CODE UNIT · Python

top_rr

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

    top_rr = int((0.5*(target_height - height))/target_height * init_image.shape[2])  # xx% from the top
    bottom_rr = int((0.5*(target_height + height))/target_height * init_image.shape[2])  
    left_rr = int((0.5*(target_width - width))/target_width * init_image.shape[3])  # xx% from the left
    right_rr = int((0.5*(target_width + width))/target_width * init_image.shape[3]) 

    center_row_rm = int(center_row_from_top * target_height)
    center_col_rm = int(center_col_from_left * target_width)

    step_height2, remainder = divmod(height, 2)
    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() \

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…