Method, device, and computer program product for model comparison
Abstract
The present disclosure relates to a method, a device, and a computer program product for model comparison. The method includes generating a detection image based on an original image. The method further includes obtaining a first classification result by sending the detection image to a target model, and obtaining a second classification result by sending the detection image to a to-be-detected model. In addition, the method further includes comparing the first classification result with the second classification result, and determining, in response to the first classification result being the same as the second classification result, that the target model is the same as the to-be-detected model. The method of the present disclosure can verify whether the to-be-detected model plagiarizes the target model without knowing any internal structure, parameters, weights, and other information of the to-be-detected model.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A method for model comparison, comprising:
generating a detection image based on an original image having a first label, wherein generating the detection image comprises generating a modified version of the original image, generating a second label for the modified version of the original image, and labeling the modified version of the original image with the second label to provide the detection image, and wherein a first model is trained utilizing the original image having the first label and the detection image having the second label; obtaining a first classification result by sending the detection image to the first model; obtaining a second classification result by sending the detection image to a second model; comparing the first classification result with the second classification result; and determining, in response to the first classification result being the same as the second classification result, that the first model is the same as the second model.
2 . The method according to claim 1 , wherein determining that the first model is the same as the second model comprises:
obtaining a third classification result by sending the original image to the first model; obtaining a fourth classification result by sending the original image to the second model; comparing the third classification result with the fourth classification result; and determining, in response to the third classification result being the same as the fourth classification result and the first classification result being the same as the second classification result, that the first model is the same as the second model.
3 . The method according to claim 1 , further comprising:
obtaining an original training data set for generating the first model, wherein each piece of training data in the original training data set comprises an original training image and a corresponding original training label; generating a detection training data set based on the original training data set, wherein each piece of detection training data in the detection training data set comprises a detection image and a corresponding detection label; and training the first model by using the original training data set and the detection training data set.
4 . The method according to claim 3 , wherein generating the detection training data set based on the training data set comprises:
generating an original training data subset by extracting multiple pieces of original training data from each classification of the original training data set; and generating the detection training data set by generating detection training data for each piece of original training data in the original training data subset.
5 . The method according to claim 1 , wherein the detection image is a text detection image, and generating the detection image based on the original image comprises:
generating the text detection image by adding a predetermined text to the original image, wherein the predetermined text is fully displayed in the text detection image.
6 . The method according to claim 4 , wherein the detection training data is text detection training data, and generating the detection training data for each piece of original training data in the original training data subset comprises:
generating a text detection training image by adding a predetermined text to an original training image of the original training data, wherein the predetermined text is fully displayed in the text detection training image; and allocating a predetermined label to the text detection training image, wherein the predetermined label is different from a training label corresponding to the original training image.
7 . The method according to claim 1 , wherein the detection image is a noise detection image, and generating the detection image based on the original image comprises:
generating the noise detection image by adding noise to the original image, wherein a probability density function of the noise conforms to a predetermined distribution.
8 . The method according to claim 4 , wherein the detection training data is noise detection training data, and generating the detection training data for each piece of original training data in the original training data subset comprises:
generating a noise detection training image by adding noise to an original training image of the original training data, wherein a probability density function of the noise conforms to a predetermined distribution; and allocating a predetermined label to the noise detection training image, wherein the predetermined label is different from a training label corresponding to the original training image.
9 . The method according to claim 1 , wherein the detection image is a misleading detection image, and generating the detection image based on the original image comprises:
generating the misleading detection image belonging to a predetermined classification, wherein the predetermined classification is not a target classification in one or more target classifications pre-recognized by the first model.
10 . The method according to claim 3 , wherein the detection training data is misleading detection training data, and generating the detection training data set based on the original training data set comprises:
generating a misleading detection training image belonging to a predetermined image classification, wherein the predetermined image classification is not a target classification in one or more target classifications pre-recognized by the first model; and generating a misleading detection training label corresponding to the misleading detection training image, wherein the misleading detection training label belongs to a predetermined misleading classification, and the predetermined misleading classification is a target classification in the one or more target classifications.
11 . An electronic device, comprising:
at least one processor; and memory coupled to the at least one processor and having instructions stored thereon, wherein the instructions, when executed by the at least one processor, cause the electronic device to perform actions comprising: generating a detection image based on an original image having a first label, wherein generating the detection image comprises generating a modified version of the original image, generating a second label for the modified version of the original image, and labeling the modified version of the original image with the second label to provide the detection image, and wherein a first model is trained utilizing the original image having the first label and the detection image having the second label; obtaining a first classification result by sending the detection image to the first model; obtaining a second classification result by sending the detection image to a second model; comparing the first classification result with the second classification result; and determining, in response to the first classification result being the same as the second classification result, that the first model is the same as the second model.
12 . The electronic device according to claim 11 , wherein determining that the first model is the same as the second model comprises:
obtaining a third classification result by sending the original image to the first model; obtaining a fourth classification result by sending the original image to the second model; comparing the third classification result with the fourth classification result; and determining, in response to the third classification result being the same as the fourth classification result and the first classification result being the same as the second classification result, that the first model is the same as the second model.
13 . The electronic device according to claim 11 , further comprising:
obtaining an original training data set for generating the first model, wherein each piece of training data in the original training data set comprises an original training image and a corresponding original training label; generating a detection training data set based on the original training data set, wherein each piece of detection training data in the detection training data set comprises a detection image and a corresponding detection label; and training the first model by using the original training data set and the detection training data set.
14 . The electronic device according to claim 13 , wherein generating the detection training data set based on the training data set comprises:
generating an original training data subset by extracting multiple pieces of original training data from each classification of the original training data set; and generating the detection training data set by generating detection training data for each piece of original training data in the original training data subset.
15 . The electronic device according to claim 11 , wherein the detection image is a text detection image, and generating the detection image based on the original image comprises:
generating the text detection image by adding a predetermined text to the original image, wherein the predetermined text is fully displayed in the text detection image.
16 . The electronic device according to claim 14 , wherein the detection training data is text detection training data, and generating the detection training data for each piece of original training data in the original training data subset comprises:
generating a text detection training image by adding a predetermined text to an original training image of the original training data, wherein the predetermined text is fully displayed in the text detection training image; and allocating a predetermined label to the text detection training image, wherein the predetermined label is different from a training label corresponding to the original training image.
17 . The electronic device according to claim 11 , wherein the detection image is a noise detection image, and generating the detection image based on the original image comprises:
generating the noise detection image by adding noise to the original image, wherein a probability density function of the noise conforms to a predetermined distribution.
18 . The electronic device according to claim 14 , wherein the detection training data is noise detection training data, and generating the detection training data for each piece of original training data in the original training data subset comprises:
generating a noise detection training image by adding noise to an original training image of the original training data, wherein a probability density function of the noise conforms to a predetermined distribution; and allocating a predetermined label to the noise detection training image, wherein the predetermined label is different from a training label corresponding to the original training image.
19 . The electronic device according to claim 11 , wherein the detection image is a misleading detection image, and generating the detection image based on the original image comprises:
generating the misleading detection image belonging to a predetermined classification, wherein the predetermined classification is not a target classification in one or more target classifications pre-recognized by the first model.
20 . A computer program product that is tangibly stored on a non-volatile computer-readable medium and comprises machine-executable instructions, wherein the machine-executable instructions, when executed by a machine, cause the machine to perform actions comprising:
generating a detection image based on an original image having a first label, wherein generating the detection image comprises generating a modified version of the original image, generating a second label for the modified version of the original image, and labeling the modified version of the original image with the second label to provide the detection image, and wherein a first model is trained utilizing the original image having the first label and the detection image having the second label; obtaining a first classification result by sending the detection image to the first model; obtaining a second classification result by sending the detection image to a second model; comparing the first classification result with the second classification result; and determining, in response to the first classification result being the same as the second classification result, that the first model is the same as the second model.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.