parameters: (train_folder, validation_folder, output_folder, batch_size=16, epochs=32)
return_statement: return (history_tl, model)
docstring: Train image classification model
      
      Args:
          train_folder {string} -- images training folder
          validation_folder {string} -- images validation folder
          output_folder {string} -- model folder
          batch_size {int} -- batch size
          epochs {int} -- training iterations
docstring_summary: Train image classification model
      
      Args:
          train_folder {string} -- images training folder
          validation_folder {string} -- images validation folder
          output_folder {string} -- model folder
          batch_size {int} -- batch size
          epochs {int} -- training iterations
docstring_tokens: Train image classification model Args : train_folder { string } -- images training folder validation_folder { string } -- images validation folder output_folder { string } -- model folder batch_size { int } -- batch size epochs { int } -- training iterations
function: def train (train_folder, validation_folder, output_folder, batch_size=16, epochs=32):
      """Train image classification model
      
      Args:
          train_folder {string} -- images training folder
          validation_folder {string} -- images validation folder
          output_folder {string} -- model folder
          batch_size {int} -- batch size
          epochs {int} -- training iterations
      """
  
      nb_classes = len(glob.glob(train_folder + "/*"))
      base_model = setup_base_model()
      model      = setup_new_classifier(base_model, nb_classes)
  
      # transfer learning
      setup_transfer_learninig(model, base_model)
  
      t_gen = train_generator(train_folder,batch_size)
  
      history_tl = model.fit_generator(
          t_gen,
          steps_per_epoch=500//batch_size,
          epochs=epochs,
          validation_data=validation_generator(validation_folder, batch_size),
          validation_steps=100//batch_size,
          verbose=1,
          class_weight='auto')
     
      if keras_backend == 'tensorflow':
          save_tf(model, output_folder, 'model_tf.pb')
      else:
          save_cntk(model, output_folder, 'model_cntk.pb')
      
      generate_labels(t_gen, os.path.join(output_folder,'labels.txt'))
      
      return (history_tl, model)
function_tokens: def train ( train_folder , validation_folder , output_folder , batch_size = 16 , epochs = 32 ) : nb_classes = len ( glob . glob ( train_folder + "/*" ) ) base_model = setup_base_model ( ) model = setup_new_classifier ( base_model , nb_classes ) # transfer learning setup_transfer_learninig ( model , base_model ) t_gen = train_generator ( train_folder , batch_size ) history_tl = model . fit_generator ( t_gen , steps_per_epoch = 500 // batch_size , epochs = epochs , validation_data = validation_generator ( validation_folder , batch_size ) , validation_steps = 100 // batch_size , verbose = 1 , class_weight = 'auto' ) if keras_backend == 'tensorflow' : save_tf ( model , output_folder , 'model_tf.pb' ) else : save_cntk ( model , output_folder , 'model_cntk.pb' ) generate_labels ( t_gen , os . path . join ( output_folder , 'labels.txt' ) ) return ( history_tl , model )