A non-transitory computer readable medium storing a computer program that, when executed by a processor, causes the processor to perform operations comprising:
- adding perturbations to a pre-marked sample original box in an original image to obtain a plurality of sample selection boxes, wherein an image framed by the sample original box contains a target;
- and
- acquiring a plurality of positive samples from the original image by extracting images framed by the plurality of sample selection boxes;
- wherein the generating the target detection model using the preset classification model algorithm according to the plurality of positive samples and the plurality of negative samples that were acquired comprises:
- normalizing each of the plurality of positive samples and each of the plurality of negative samples;
- performing, with a preset feature extraction algorithm, feature vector extraction on each of the positive samples and each of the negative samples that were normalized to obtain a positive sample feature training set and a negative sample feature training set, wherein the positive sample feature training set comprises extracted feature vectors of all the positive samples, and the negative sample feature training set comprises extracted feature vectors of all the negative samples;
- and
- training a plurality of weak classifiers according to the positive sample feature training set and the negative sample feature training set, wherein all the plurality of weak classifiers form the target detection model;
- wherein the training the plurality of weak classifiers according to the positive sample feature training set and the negative sample feature training set comprises:
- S1, initializing respective detection scores and weights corresponding to respective ones of the positive sample feature vectors in the positive sample feature training set, initializing respective detection scores and weights corresponding to respective ones of the negative sample feature vectors in the negative sample feature training set, and initializing quantity of the weak classifiers as t=0;
- S2, setting up a storage structure and placing a root node into the storage structure, wherein the root node has a depth of 1, and the root node contains all the positive sample feature vectors and all the negative sample feature vectors;
- S3, detecting whether there is an unprocessed node in the storage structure, proceeding to step S7 upon detection that there is no unprocessed node in the storage structure, and proceeding to step S4 otherwise;
- S4, retrieving a node from the storage structure, determining whether the node is splittable, proceeding to step S5 upon determination that the node is splittable, and proceeding to step S3 otherwise;
- S5, determining a feature attribute and its corresponding feature threshold that are to be selected for splitting of the node;
- S6, splitting all the feature vectors in the node into a left subset and a right subset according to the feature attribute and its corresponding feature threshold that were determined, adding two new nodes as child nodes of the node that respectively contain the left subset and the right subset, adding the two new nodes into the storage structure, and then proceeding to step S4;
- S7, recording relevant information of all nodes to complete training of a weak classifier, S8, executing t=t+1, determining whether t is greater than a preset threshold T, ending the training of the plurality of weak classifiers upon determination that t is greater than T, and proceeding to step S9 otherwise;
- and
- S9, updating, with the weak classifier for which the training is currently completed, the detection scores and the weights of the respective ones of the positive sample feature vectors in the positive sample feature training set and the respective ones of the negative sample feature vectors in the negative sample feature training set, and proceeding to step S2 with the detection scores and weights that were updated.