→ littlebo1990: train.reshap(-1,3,3,1) 選我正解05/16 11:54
→ littlebo1990: 抱歉搞錯了XD 我以為你w,h分別為3, channel是1..05/16 11:55
→ littlebo1990: 應該是你的np array裡面是object, 所以shape才是05/16 11:57
→ littlebo1990: 你可以用 list comprehension 把裡面的object變arra05/16 11:59
→ littlebo1990: i.e train = np.array([i.reshape(w,h,3) for i in05/16 11:59
→ littlebo1990: train])05/16 12:00
→ littlebo1990: 這樣train dim就會變(N,w,h,3)05/16 12:00
感謝回覆 但是用list comprehension會回報ValueError: cannot reshape array of siz
e 1 into shape (48,140,3)
※ 編輯: grimaceo (223.139.67.224 臺灣), 05/16/2020 12:30:33
→ eooft: 那個3代表channel數 先弄清楚你的channel是1(黑白)還3(RGB)05/16 13:11
已經解決了 謝謝兩位
※ 編輯: grimaceo (223.139.67.224 臺灣), 05/16/2020 14:53:11