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

RuntimeError: Given groups=1, weight of size [192, 4, 1, 3, 3], expected input[1, 3, 100, 64, 64] to have 4 channels, but got 3 channels instead #11

Open
YoungofNUAA opened this issue Dec 12, 2022 · 1 comment

Comments

@YoungofNUAA
Copy link

i give a .mp4 video as a input file , but code gaives me some error shown below:

RuntimeError: Given groups=1, weight of size [192, 4, 1, 3, 3], expected input[1, 3, 100, 64, 64] to have 4 channels, but got 3 channels instead

sr model runs well with images input , denosing model should input a video? is it right
what is the forth channel with video?

@imironhead
Copy link

There are some bugs in this script: RVRT/data/dataset_video_test.py

For example, there are two class SingleVideoRecurrentTestDataset(data.Dataset): implementations.

To run denoising model, the noise level must be concatenated to the input images (I have not read the paper yet, but the source code is implemented that way), and that is where the 4-th channel comes from.

In my case (I ran the script with image sequence), add some code can fix the problem:

class SingleVideoRecurrentTestDataset(data.Dataset):
    def __init__(self, opt):
        ....
        self.sigma = opt['sigma'] / 255. if 'sigma' in opt else 0

    def __getitem__(self, index):
        ...
        if self.sigma:
            noise_level = torch.ones((1, 1, 1, 1)) * self.sigma
            t, _, h, w = imgs_lq.shape
            imgs_lq = torch.cat([imgs_lq, noise_level.expand(t, 1, h, w)], 1)

        return ...

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