X_image(5000, 64, 64, 3)を次のようにnp.arrayにしようとしたところ下記のようなエラーが出ました
配列が違っていると出るエラーのようですが、今回は原因がわかりません。ご教授いただけないでしょうか?
epochs=25 for epoch in range(epochs): batch_idxs= min (len(X_image), np.inf) // 64 for idx in range (0, batch_idxs): batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3) batch = [image for batch_file in batch_files] batch_images = np.array(batch).astype(np.float32) ValueError Traceback (most recent call last) <ipython-input-75-af766500016d> in <module>() 4 batch_files= X_image[idx*64:(idx+1)*64] #shape=(64, 64, 64, 3) 5 batch = [image for batch_file in batch_files] ----> 6 batch_images = np.array(batch).astype(np.float32) 削除リクエスト送信済みのため回答しないでください。。、、、、、、、、、、、、、、、 ValueError: setting an array element with a sequence.
batch <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>, <tf.Tensor 'Placeholder_3:0' shape=(5000, 64, 64, 3) dtype=float32>]
回答しないでくださいとのことですが、問題が見受けられるので指摘します。編集履歴を確認したところ、「質問をした疑問が解決した」か「質問をしたのが恥ずかしくなった」といった理由で申請したのだと思いますが、それでの削除は許可しないそうです(https://teratail.com/help/delete-policy)。また、編集で消すのもダメなので、質問を元に戻してください。また、自己解決したならば自分で回答してそれをベストアンサーにしてください。
回答1件
あなたの回答
tips
プレビュー