Stop CNN model at high accuracy and low loss rate? I train my CNN model with a large number of epochs, with each epoch I print the training loss and accuracy, but there is a lot of high and low in these two metrics, I want to do early stopping with for example loss at 0.2 and accuracy at %95 or more because I get this at more than one epoch, my question is:

1- is early stopping done on train set or validation set?

2- if on validation set, should I print validation loss and accuracy for each epoch with with a train set loss and accuracy?

3- can you give an idea to do early stopping with a piece of code but not in keras, because I use tensorflow not keras?
Early stopping is determined based on the validation set's results (either loss, accuracy or some other special metric).
Usually early stopping is checked every single epoch so you will need to check your validation accuracy/loss after each epoch. You don't have to print it, but if it is already calculated, there is no reason to withhold it from yourself. (you can also check validation results every x epochs if it slows your training process too much).
There are many sources that show how to use early stopping with tensorflow:


Early Stopping with TensorFlow and TFLearn

Early stopping with tf.estimator, how?

Early-stopping functionality for use with tf.estimator API.