The invention proposes an incremental learning method, a computer and a storage medium based on triplet diverse example sets and gradient regularization, belonging to the field of artificial intelligence. First, get the predicted sample features and real labels, and input the loss function for backpropagation to update the model parameters; second, calculate the prototype representation of the batch data; third, calculate the number of positive samples and negative examples that should be saved for each category The number of samples; secondly, update the number of examples that should be stored in the example set of the existing category; secondly, score the samples in the positive example set example set, and construct the current category example set according to the scores of the samples; secondly, random sampling Obtain the replay sample set, and then perform forward propagation on the replay sample set and the samples in the batch data; secondly, calculate the gradient of the three loss functions; finally, regularize the three different gradients to obtain the final gradient value. Backpropagating updates. The present invention solves the problem of catastrophic forgetting.