Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. # partition the data into training and testing splits using 75% of
  2. # the data for training and the remaining 25% for testing
  3. (trainX, testX, trainY, testY) = train_test_split(data,
  4. labels, test_size=0.25, random_state=42)
  5. print ("trainX.shape------>>",trainX.shape)
  6. # convert the labels from integers to vectors (for 2-class, binary
  7. # classification you should use Keras' to_categorical function
  8. # instead as the scikit-learn's LabelBinarizer will not return a
  9. # vector)
  10. lb = LabelBinarizer()
  11. trainY = lb.fit_transform(trainY)
  12. testY = lb.transform(testY)
  13.  
  14. # construct the image generator for data augmentation
  15. aug = ImageDataGenerator(rotation_range=30, width_shift_range=0.1,
  16. height_shift_range=0.1, shear_range=0.2, zoom_range=0.2,
  17. horizontal_flip=True, fill_mode="nearest")
  18.  
  19. height = 64
  20. width = 64
  21. depth =3
  22.  
  23. inputShape = (height, width, depth)
  24.  
  25. classes = len(lb.classes_)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement