質問編集履歴

1

修正

2022/10/23 16:23

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,7 +1,7 @@
1
1
  ### 前提
2
2
 
3
3
  画像18900枚に対してUnetを作っております。
4
- test_ds = tf.data.Dataset.from_tensor_slices((test_ds,test_gt)).batch(30) の所でタイトルにあるエラーが出ました。
4
+
5
5
  これは、バッチサイズを変更すれば、おさまるエラーなのでしょうか?
6
6
  何度か、数値を変えましたがこのエラーが消えません。
7
7
 
@@ -12,35 +12,6 @@
12
12
  Dimensions 0 and 2900 are not compatible
13
13
  ```
14
14
 
15
- ### 該当のソースコード
16
-
17
- ```python
18
- train_Combine0 = Combine[0:17000]#訓練データ(17000)
19
- train_Mask0 = Mask[0:17000]
20
-
21
- test_Combine = Combine[160000:18900]#訓練データ(17000):合計(18900)
22
- test_Mask = Mask[16000:18900]
23
-
24
- train_ds0 = np.asarray(train_Combine0)#配列を生成
25
- train_gt0 = np.asarray(train_Mask0)
26
- test_ds = np.asarray(test_Combine)
27
- test_gt = np.asarray(test_Mask)
28
-
29
- train_ds0 = train_ds0.astype('float32')/255.0#計算の都合上、入力を 0〜1の範囲の数値にした方が良い→データ型をfloatに変換したのち、255で割る
30
- train_gt0 = train_gt0.astype('float32')/255.0
31
- test_ds = test_ds.astype('float32')/255.0
32
- test_gt = test_gt.astype('float32')/255.0
33
-
34
-
35
- #パラメータ(エポックとバッチ)
36
- epochs =50#epochsはデータを何周するか
37
- epoch_num=list(range(1,epochs+1))
38
- train_loss_num=[]
39
- test_loss_num=[]
40
-
41
- train_ds = tf.data.Dataset.from_tensor_slices((train_ds0,train_gt0)).batch(50)#tf.data.Dataset.from_tensor_slices().batch()を用いてバッチ化(一定量のデータを集め、一括処理する)
42
- test_ds = tf.data.Dataset.from_tensor_slices((test_ds,test_gt)).batch(30)
43
- ```
44
15
 
45
16
  ### 試したこと
46
17