PeterL1n / BackgroundMattingV2

Real-Time High-Resolution Background Matting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about select_refinement_regions and crop_patch in Refiner model

yuhan2615 opened this issue · comments

the select_refinement_regions(used in class Refiner) selects error locations from E4(E4 is the coarse error prediction map at 1/4 of the original resolution), and crop_patch(used in class Refiner) crops x(which concats [hid,pha,fgr] at 1/2 of the original resolution) directly according to the error locations, and also crops src_bgr(at the original resolution) directly according to the error locations. I am confused about the correspondence between error locations and resolution.

在class Refiner中,select_refinement_regions方法在E4上挑选出error locations ,E4对应的是1/4原始尺寸;那么error locations 坐标对应的也是1/4原始尺寸的坐标;但是在class Refiner中,如果用的是sampling的模式,crop_patch方法有时候会根据error locations直接对1/2原始尺寸的feature进行crop,有时候又会根据error locations直接对原始尺寸的src_bgr进行crop。请问,在1/4原始尺寸上选出来的error locations 为啥不需要经过变化就能同时对1/2原始尺寸的feature和原始尺寸的src_bgr进行crop呢?感觉坐标对不上呢

Error map 被缩放到1/4分辨率得到E4,也就是说每一个E4的像素对应全分辨率下的4x4分辨率的patch,在1/2分辨率下对应2x2分辨率的patch。你就可以对对应的patch进行crop。