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

随机选取scale中的size进行插值,boxes为什么不需要随着size做相应变化。 #513

Open
vvvvvair opened this issue Dec 12, 2024 · 3 comments
Assignees

Comments

@vvvvvair
Copy link

code for rtdetrv2_pytorch/src/data/dataloader.py

class BatchImageCollateFuncion(BaseCollateFunction):
    def __init__(
        self, 
        scales=None, 
        stop_epoch=None, 
    ) -> None:
        super().__init__()
        self.scales = scales
        self.stop_epoch = stop_epoch if stop_epoch is not None else 100000000
        # self.interpolation = interpolation

    def __call__(self, items):
        images = torch.cat([x[0][None] for x in items], dim=0)
        targets = [x[1] for x in items]

        if self.scales is not None and self.epoch < self.stop_epoch:
            # sz = random.choice(self.scales)
            # sz = [sz] if isinstance(sz, int) else list(sz)
            # VF.resize(inpt, sz, interpolation=self.interpolation)

            sz = random.choice(self.scales)
            images = F.interpolate(images, size=sz)
            if 'masks' in targets[0]:
                for tg in targets:
                    tg['masks'] = F.interpolate(tg['masks'], size=sz, mode='nearest')
                raise NotImplementedError('')

        return images, targets

请问下训练之前随机选择size为sz大小进行插值,图像的size变化了,但是boxes没有做相应的变换,这样会不会存在boxes和size变换后的图像对不上的情况,请问下我理解的对嘛。谢谢您!

@lyuwenyu
Copy link
Owner

但是boxes没有做相应的变换,这样会不会存在boxes和size变换后的图像对不上的情况,请问下我理解的对嘛。谢谢您!

本仓库里box到这一步已经归一化了, 图像resize不影响

@vvvvvair
Copy link
Author

但是boxes没有做相应的变换,这样会不会存在boxes和size变换后的图像对不上的情况,请问下我理解的对嘛。谢谢您!

本仓库里box到这一步已经归一化了, 图像resize不影响

明白,谢谢您!按照这样理解的话还是有点疑问。那数据做_transforms变换时为什么可以先resize后再做normal,而且normal时在resize的大小(640)上进行的,并没有按比例进行调整。希望您可以指点下迷津,感谢!

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

3 participants
@lyuwenyu @vvvvvair and others