Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于变化检测预测,重叠区域的策略问题。 #185

Closed
YuQi9797 opened this issue Feb 29, 2024 · 6 comments
Closed

关于变化检测预测,重叠区域的策略问题。 #185

YuQi9797 opened this issue Feb 29, 2024 · 6 comments
Assignees

Comments

@YuQi9797
Copy link

if yoff < self.prev_yoff:

作者您好,在AccumProcessor这个处理机制中,

    def process_pred(self, out, xoff, yoff):
        if self.prev_yoff is not None and yoff != self.prev_yoff:
            if yoff < self.prev_yoff:
                raise RuntimeError
            self.cache.roll_cache(yoff - self.prev_yoff)
        pred = out['label_map']
        pred = pred[:self.ch, :self.cw]
        prob = out['score_map']
        prob = prob[:self.ch, :self.cw]
        if self.assign_weight:
            prob = assign_border_weights(prob, border_ratio=0.25, inplace=True)
        self.cache.update_block(0, xoff, self.ch, self.cw, prob)
        pred = self.cache.get_block(0, xoff, self.ch, self.cw)
        self.prev_yoff = yoff
        return pred

这里的判断runtimeError 是通过 yoff< self.prev_yoff , 这里用 y 方向 是因为 在图像分块的过程中,是按行优先进行的分块,y只会以递增的情况出现吗?(https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/utils/slider_predict.py#L474)

如果我是以列优先分块,这里是否要改为xoff 进行判断

@github-actions github-actions bot added triage new issue/PR waiting to be dealed and removed triage new issue/PR waiting to be dealed labels Feb 29, 2024
@Bobholamovic
Copy link
Member

是的,这时因为PaddleRS滑窗推理的分块策略是行优先,如果以列优先分块,需要对应改写相关逻辑。

@YuQi9797
Copy link
Author

谢谢您的回答,由于我的代码理解能力有限,还想请问下
如果以列优先,是否只需要修改AccumProcessor呢?
只需要修改第一个判断条件吗?

        if self.prev_xoff is not None and xoff != self.prev_xoff:
            if xoff < self.prev_xoff:
                raise RuntimeError
            self.cache.roll_cache(xoff - self.prev_xoff)

还是说

self.cache.update_block(0, xoff, self.ch, self.cw, prob)
        pred = self.cache.get_block(0, xoff, self.ch, self.cw)

这段代码也要相应修改。

@Bobholamovic
Copy link
Member

需要修改的地方可能不止这两处,例如循环的内外层也需要调换,改写起来可能会比较困难,我暂时也无法确定全部需要改动的位置。请问是为什么需要列优先的分块策略哦?

@YuQi9797
Copy link
Author

由于我的输入图像并非两张大小完全一致的图像,因此我对输入图像进行了处理,得到两张图在其公共区域对应的索引。该索引是以列优先得到的,因此在对图像进行预测时,坐标索引是列优先开始的。 导致我使用accum策略时出错, 需要改为以列索引的。 目前看来只有修改前期处理图像部分了 ORL

@Bobholamovic
Copy link
Member

好吧,看起来比起修改滑窗推理逻辑,修改预处理部分或许会更省力一些~

@YuQi9797
Copy link
Author

感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants