質問編集履歴
3
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### 前提
|
2
2
|
|
3
3
|
|
4
|
-
一つの長方形画像から重複こみで、n個の正方形を切り
|
4
|
+
一つの長方形画像から重複こみで、n個の正方形を切り抜く作業を行なっているのですが、以下の切り抜きのコードを実行した際に表示されるエラーに対処できずに詰まっております。
|
5
5
|
この部分の解決策についてどうか教えていただけないでしょうか?
|
6
6
|
よろしくお願いします。
|
7
7
|
|
2
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,8 +92,34 @@
|
|
92
92
|
上記のprint文の結果RuntimeError: shape '[-1, 5, 288, 288]' is invalid for input of size 1492992
|
93
93
|
というエラーが発生しました。
|
94
94
|
```python
|
95
|
+
/tmp/ipykernel_1430514/978018639.py:12: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
|
96
|
+
im = im.resize(new_size, Image.ANTIALIAS)
|
97
|
+
/tmp/ipykernel_1430514/3349803982.py:10: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
|
98
|
+
im = im.resize(new_size, Image.ANTIALIAS)
|
99
|
+
---------------------------------------------------------------------------
|
100
|
+
RuntimeError Traceback (most recent call last)
|
101
|
+
Input In [153], in <cell line: 14>()
|
102
|
+
11 sliced_images = torch.from_numpy(np.array(sliced_images)).to(device)
|
103
|
+
13 print(sliced_images.shape)
|
104
|
+
---> 14 print(image_encoder(sliced_images).shape)
|
105
|
+
|
106
|
+
File ~/.pyenv/versions/3.9.11/lib/python3.9/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
|
107
|
+
1126 # If we don't have any hooks, we want to skip the rest of the logic in
|
108
|
+
1127 # this function, and just call forward.
|
109
|
+
1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
|
110
|
+
1129 or _global_forward_hooks or _global_forward_pre_hooks):
|
111
|
+
-> 1130 return forward_call(*input, **kwargs)
|
112
|
+
1131 # Do not call functions when jit is used
|
113
|
+
1132 full_backward_hooks, non_full_backward_hooks = [], []
|
114
|
+
|
115
|
+
Input In [152], in ClipEncoderMulti.forward(self, x)
|
116
|
+
8 def forward(self, x):
|
117
|
+
9 # 4x3x288x288 -> 1x4x640
|
118
|
+
---> 10 out = self.model.encode_image(x.view(-1,5,288,288))
|
119
|
+
11 out = out.view(-1, self.num_embeds, self.num_features).float()
|
120
|
+
12 return out
|
121
|
+
|
95
122
|
RuntimeError: shape '[-1, 5, 288, 288]' is invalid for input of size 1492992
|
96
|
-
|
97
123
|
```
|
98
124
|
|
99
125
|
|
1
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### 前提
|
2
2
|
|
3
3
|
|
4
|
-
一つの長方形画像から重複こみで、n個の正方形を
|
4
|
+
一つの長方形画像から重複こみで、n個の正方形を切り取るという作業を行なっているのですが、以下の切り抜きのコードを実行した際に表示されるエラーに対処できずに詰まっております。
|
5
5
|
この部分の解決策についてどうか教えていただけないでしょうか?
|
6
6
|
よろしくお願いします。
|
7
7
|
|