質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1 +1,171 @@
|
|
1
|
+
X_image(5000, 64, 64, 3)を次のようにnp.arrayにしようとしたところ下記のようなエラーが出ました
|
2
|
+
|
3
|
+
配列が違っていると出るエラーのようですが、今回は原因がわかりません。ご教授いただけないでしょうか?
|
4
|
+
|
5
|
+
```
|
6
|
+
|
7
|
+
epochs=25
|
8
|
+
|
9
|
+
for epoch in range(epochs):
|
10
|
+
|
11
|
+
batch_idxs= min (len(X_image), np.inf) // 64
|
12
|
+
|
13
|
+
for idx in range (0, batch_idxs):
|
14
|
+
|
15
|
+
batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3)
|
16
|
+
|
17
|
+
batch = [image for batch_file in batch_files]
|
18
|
+
|
19
|
+
batch_images = np.array(batch).astype(np.float32)
|
20
|
+
|
21
|
+
ValueError Traceback (most recent call last)
|
22
|
+
|
23
|
+
<ipython-input-75-af766500016d> in <module>()
|
24
|
+
|
25
|
+
4 batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3)
|
26
|
+
|
27
|
+
5 batch = [image for batch_file in batch_files]
|
28
|
+
|
29
|
+
----> 6 batch_images = np.array(batch).astype(np.float32)
|
30
|
+
|
1
31
|
削除リクエスト送信済みのため回答しないでください。。、、、、、、、、、、、、、、、
|
32
|
+
|
33
|
+
ValueError: setting an array element with a sequence.
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
batch
|
42
|
+
|
43
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
44
|
+
|
45
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
46
|
+
|
47
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
48
|
+
|
49
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
50
|
+
|
51
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
52
|
+
|
53
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
54
|
+
|
55
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
56
|
+
|
57
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
58
|
+
|
59
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
60
|
+
|
61
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
62
|
+
|
63
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
64
|
+
|
65
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
66
|
+
|
67
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
68
|
+
|
69
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
70
|
+
|
71
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
72
|
+
|
73
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
74
|
+
|
75
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
76
|
+
|
77
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
78
|
+
|
79
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
80
|
+
|
81
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
82
|
+
|
83
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
84
|
+
|
85
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
86
|
+
|
87
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
88
|
+
|
89
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
90
|
+
|
91
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
92
|
+
|
93
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
94
|
+
|
95
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
96
|
+
|
97
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
98
|
+
|
99
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
100
|
+
|
101
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
102
|
+
|
103
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
104
|
+
|
105
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
106
|
+
|
107
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
108
|
+
|
109
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
110
|
+
|
111
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
112
|
+
|
113
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
114
|
+
|
115
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
116
|
+
|
117
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
118
|
+
|
119
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
120
|
+
|
121
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
122
|
+
|
123
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
124
|
+
|
125
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
126
|
+
|
127
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
128
|
+
|
129
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
130
|
+
|
131
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
132
|
+
|
133
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
134
|
+
|
135
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
136
|
+
|
137
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
138
|
+
|
139
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
140
|
+
|
141
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
142
|
+
|
143
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
144
|
+
|
145
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
146
|
+
|
147
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
148
|
+
|
149
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
150
|
+
|
151
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
152
|
+
|
153
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
154
|
+
|
155
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
156
|
+
|
157
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
158
|
+
|
159
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
160
|
+
|
161
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
162
|
+
|
163
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
164
|
+
|
165
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
166
|
+
|
167
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
168
|
+
|
169
|
+
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>]
|
170
|
+
|
171
|
+
```
|
1
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,183 +1 @@
|
|
1
|
-
X_image(5000, 64, 64, 3)を次のようにnp.arrayにしようとしたところ下記のようなエラーが出ました
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
削除リクエスト送信済みのため回答しないでください。。、、、、、、、、、、、、、、、
|
6
|
-
|
7
|
-
```
|
8
|
-
|
9
|
-
epochs=25
|
10
|
-
|
11
|
-
for epoch in range(epochs):
|
12
|
-
|
13
|
-
batch_idxs= min (len(X_image), np.inf) // 64
|
14
|
-
|
15
|
-
for idx in range (0, batch_idxs):
|
16
|
-
|
17
|
-
batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3)
|
18
|
-
|
19
|
-
batch = [image for batch_file in batch_files]
|
20
|
-
|
21
|
-
batch_images = np.array(batch).astype(np.float32)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
ValueError Traceback (most recent call last)
|
26
|
-
|
27
|
-
<ipython-input-75-af766500016d> in <module>()
|
28
|
-
|
29
|
-
4 batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3)
|
30
|
-
|
31
|
-
5 batch = [image for batch_file in batch_files]
|
32
|
-
|
33
|
-
----> 6 batch_images = np.array(batch).astype(np.float32)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
ValueError: setting an array element with a sequence.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
```
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
batch
|
54
|
-
|
55
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
56
|
-
|
57
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
58
|
-
|
59
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
60
|
-
|
61
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
62
|
-
|
63
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
64
|
-
|
65
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
66
|
-
|
67
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
68
|
-
|
69
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
70
|
-
|
71
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
72
|
-
|
73
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
74
|
-
|
75
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
76
|
-
|
77
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
78
|
-
|
79
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
80
|
-
|
81
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
82
|
-
|
83
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
84
|
-
|
85
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
86
|
-
|
87
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
88
|
-
|
89
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
90
|
-
|
91
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
92
|
-
|
93
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
94
|
-
|
95
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
96
|
-
|
97
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
98
|
-
|
99
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
100
|
-
|
101
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
102
|
-
|
103
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
104
|
-
|
105
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
106
|
-
|
107
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
108
|
-
|
109
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
110
|
-
|
111
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
112
|
-
|
113
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
114
|
-
|
115
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
116
|
-
|
117
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
118
|
-
|
119
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
120
|
-
|
121
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
122
|
-
|
123
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
124
|
-
|
125
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
126
|
-
|
127
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
128
|
-
|
129
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
130
|
-
|
131
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
132
|
-
|
133
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
134
|
-
|
135
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
136
|
-
|
137
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
138
|
-
|
139
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
140
|
-
|
141
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
142
|
-
|
143
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
144
|
-
|
145
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
146
|
-
|
147
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
148
|
-
|
149
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
150
|
-
|
151
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
152
|
-
|
153
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
154
|
-
|
155
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
156
|
-
|
157
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
158
|
-
|
159
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
160
|
-
|
161
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
162
|
-
|
163
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
164
|
-
|
165
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
166
|
-
|
167
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
168
|
-
|
169
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
170
|
-
|
171
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
172
|
-
|
173
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
174
|
-
|
175
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
176
|
-
|
177
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
178
|
-
|
179
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>,
|
180
|
-
|
181
|
-
<tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>]
|
182
|
-
|
183
|
-
```
|