OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

pytorch doesn't read input channels as it's supposed

  • Thread starter Thread starter hend naged
  • Start date Start date
H

hend naged

Guest
I'm building a conv3d model for videos using pytorch. the input is (2, 30, 46, 140, 1) but pytorch reads that the input channel is the second one and it's actually the 4th.

Code:
        self.conv1 = nn.Conv3d(in_channels=1, out_channels=32, kernel_size=3, padding=1)
Given groups=1, weight of size [32, 1, 3, 3, 3], expected input[2, 30, 46, 140, 1] to have 1 channels, but got 30 channels instead

I tried to reshape the input to be (2, 1, 30, 46, 140) but then it doesn't show the frames and gives an error that input is wrong

Code:
TypeError: Invalid shape (30, 46, 140) for image data

keep in mind that I tried running the same model with same input on tensorflow and it worked but I can't work with tensorflow due to dependency issues
<p>I'm building a conv3d model for videos using pytorch. the input is <code>(2, 30, 46, 140, 1)</code> but pytorch reads that the input channel is the second one and it's actually the 4th.</p>
<pre><code> self.conv1 = nn.Conv3d(in_channels=1, out_channels=32, kernel_size=3, padding=1)
Given groups=1, weight of size [32, 1, 3, 3, 3], expected input[2, 30, 46, 140, 1] to have 1 channels, but got 30 channels instead
</code></pre>
<p>I tried to reshape the input to be <code>(2, 1, 30, 46, 140)</code> but then it doesn't show the frames and gives an error that input is wrong</p>
<pre><code>TypeError: Invalid shape (30, 46, 140) for image data
</code></pre>
<p>keep in mind that I tried running the same model with same input on tensorflow and it worked but I can't work with tensorflow due to dependency issues</p>
 
Top