text: import numpy as np
  import cv2
  import pandas as pd
  
  import matplotlib
  matplotlib.use("Agg")
  
  # import the necessary packages
  from keras.preprocessing.image import ImageDataGenerator
  from keras.optimizers import SGD
  from pyimagesearch.resnet import ResNet
  from sklearn.metrics import classification_report
  from imutils import paths
  import matplotlib.pyplot as plt
  import numpy as np
  import argparse
  import os
  
  # construct the argument parser and parse the arguments
  ap = argparse.ArgumentParser()
  ap.add_argument("-d", "--dataset", type=str, required=True,
  	help="path dataset of input images")
  ap.add_argument("-m", "--model", type=str, required=True,
  	help="path to trained model")
  ap.add_argument("-p", "--plot", type=str, default="plot.png",
  	help="path to output loss/accuracy plot")
  args = vars(ap.parse_args())
  
  #taking the epochs and batch_size as input
  
  epochs=100
  batch_size=5
  
  train_path=os.path.sep.join([args["dataset"], "training"])
  test_path=os.path.sep.join([args["dataset"], "testing"])
  val_path=os.path.sep.join([args["dataset"], "validation"])
  
  totalTrain = len(list(paths.list_images(train_path)))
  totalVal = len(list(paths.list_images(val_path)))
  totalTest = len(list(paths.list_images(test_path)))
  
  #generating the new images
  # initialize the training training data augmentation object
  
  trainAug = ImageDataGenerator(
  	rescale=1 / 255.0,
  	rotation_range=20,
  	zoom_range=0.05,
  	width_shift_range=0.05,
  	height_shift_range=0.05,
  	shear_range=0.05,
  	horizontal_flip=True,
  	fill_mode="nearest")
  
  # initialize the validation (and testing) data augmentation object
  valAug = ImageDataGenerator(rescale=1 / 255.0)
  
  # initialize the training generator
  trainGen = trainAug.flow_from_directory(
  	train_path,
  	class_mode="categorical",
  	target_size=(64, 64),
  	color_mode="rgb",
  	shuffle=True,
  	batch_size=batch_size)
  
  # initialize the validation generator
  valGen = valAug.flow_from_directory(
  	val_path,
  	class_mode="categorical",
  	target_size=(64, 64),
  	color_mode="rgb",
  	shuffle=False,
  	batch_size=batch_size)
  
  # initialize the testing generator
  testGen = valAug.flow_from_directory(
  	test_path,
  	class_mode="categorical",
  	target_size=(64, 64),
  	color_mode="rgb",
  	shuffle=False,
  	batch_size=batch_size)
  
  # initialize our Keras implementation of ResNet model and compile it
  model = ResNet.build(64, 64, 3, 2, (2, 2, 3),
  	(32, 64, 128, 256), reg=0.0005)
  opt = SGD(lr=1e-1, momentum=0.9, decay=1e-1 / epochs)
  model.compile(loss="binary_crossentropy", optimizer=opt,
  	metrics=["accuracy"])
  print("helo",totalVal // batch_size)
  print("145676",totalTrain // batch_size)
  # train our Keras model
  H = model.fit_generator(
  	trainGen,
  	steps_per_epoch=totalTrain // batch_size,
  	validation_data=valGen,
  	validation_steps=totalVal // batch_size,
  	epochs=epochs)
  
  # reset the testing generator and then use our trained model to
  # make predictions on the data
  print("[INFO] evaluating network...")
  testGen.reset()
  predIdxs = model.predict_generator(testGen,
  	steps=(totalTest // batch_size) + 1)
  
  # for each image in the testing set we need to find the index of the
  # label with corresponding largest predicted probability
  predIdxs = np.argmax(predIdxs, axis=1)
  
  # show a nicely formatted classification report
  print(classification_report(testGen.classes, predIdxs,
  	target_names=testGen.class_indices.keys()))
  
  # save the network to disk
  print("[INFO] serializing network to '{}'...".format(args["model"]))
  model.save(args["model"])
  
  # plot the training loss and accuracy
  N = epochs
  plt.style.use("ggplot")
  plt.figure()
  plt.plot(np.arange(0, N), H.history["loss"], label="train_loss")
  plt.plot(np.arange(0, N), H.history["val_loss"], label="val_loss")
  plt.plot(np.arange(0, N), H.history["acc"], label="train_acc")
  plt.plot(np.arange(0, N), H.history["val_acc"], label="val_acc")
  plt.title("Training Loss and Accuracy on Dataset")
  plt.xlabel("Epoch #")
  plt.ylabel("Loss/Accuracy")
  plt.legend(loc="lower left")
  plt.savefig(args["plot"])
  
  