Skip to content

Commit 8fcd9bf

Browse files
committed
add a method for loading RGB image
1 parent da4a2ae commit 8fcd9bf

File tree

1 file changed

+2
-1
lines changed
  • DeepLearning Tutorials/keras_usage

1 file changed

+2
-1
lines changed

DeepLearning Tutorials/keras_usage/data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from PIL import Image
1111
import numpy as np
1212

13-
#读取文件夹mnist下的42000张图片,图片为灰度图,所以为1通道,如果是将彩色图作为输入,则将1替换为3,图像大小28*28
13+
#读取文件夹mnist下的42000张图片,图片为灰度图,所以为1通道,图像大小28*28
14+
#如果是将彩色图作为输入,则将1替换为3,并且data[i,:,:,:] = arr改为data[i,:,:,:] = [arr[:,:,0],arr[:,:,1],arr[:,:,2]]
1415
def load_data():
1516
data = np.empty((42000,1,28,28),dtype="float32")
1617
label = np.empty((42000,),dtype="uint8")

0 commit comments

Comments
 (0)