赞
踩
- import numpy as np
-
- np.random.seed(1336) # for reproducibility
- from keras.datasets import mnist
- from keras.datasets import cifar10
- from keras.models import Sequential
- from keras.layers import Dense, Dropout, Activation, Flatten
- from keras.layers import Convolution2D, MaxPooling2D
- from keras.utils import np_utils
- from keras import backend as K
- import h5py
- from PIL import Image
- import cv2
- import matplotlib.pyplot as pyplot
-
- # 全局变量
- batch_size = 20
- nb_classes = 2
- epochs = 20
-
- trainImagesNum = 4000
- testImagesNum = 2000
- # input image dimensions
- img_rows, img_cols = 128, 128
- # number of convolutional filters to use
- nb_filters = 128
- # size of pooling area for max pooling
- pool_size = (2, 2)
- # convolution kernel size
- kernel_size = (3, 3)
- X_train = np.zeros([2000, img_rows, img_cols, 3])
- X_test = np.zeros([2000, img_rows, img_cols, 3])
-
- print(type(X_train), X_train.shape)
- for i in range(2000):
- if (np.mod(i, 50) &#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。