WO2021056746A1 - 图像模型检测方法、装置、电子设备及存储介质 - Google Patents

图像模型检测方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2021056746A1
WO2021056746A1 PCT/CN2019/118027 CN2019118027W WO2021056746A1 WO 2021056746 A1 WO2021056746 A1 WO 2021056746A1 CN 2019118027 W CN2019118027 W CN 2019118027W WO 2021056746 A1 WO2021056746 A1 WO 2021056746A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
model
recognition result
detected
sample
Prior art date
Application number
PCT/CN2019/118027
Other languages
English (en)
French (fr)
Inventor
王健宗
黄章成
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021056746A1 publication Critical patent/WO2021056746A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/217Validation; Performance evaluation; Active pattern learning techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/03Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
    • G06F2221/033Test or assess software

Definitions

  • This application relates to the technical field of smart terminals, and in particular to an image model detection method, device, electronic equipment, and storage medium.
  • artificial intelligence is applied in many fields, such as face recognition, voiceprint recognition and other scenarios, and its core technology is based on machine learning or deep learning.
  • the first aspect of the present application provides an image model detection method, the method includes: obtaining original image samples; inputting the original image samples into a trained mainstream image classification model; using the mainstream image classification model, based on momentum Gradient iterative algorithm, to conduct a confrontation attack on the original image sample to obtain a confrontation image; obtain the first recognition result obtained after the original image sample is recognized by the image model to be detected, and obtain the image model to be detected against the The second recognition result obtained after recognizing the confrontation image; determine whether the first recognition result is consistent with the second recognition result; if the first recognition result is consistent with the second recognition result, determine the to-be-detected The image model successfully recognizes the confrontation image.
  • a second aspect of the present application provides an image model detection device, the device includes:
  • the first acquisition module is used to obtain the original image samples; the input module is used to input the original image samples into the trained mainstream image classification model; the generation module is used to use the mainstream image classification model and iterate based on the momentum of the gradient Algorithm to perform a confrontation attack on the original image sample to obtain a confrontation image; the second acquisition module is used to acquire the first recognition result obtained after the original image sample is recognized by the image model to be detected, and to obtain the The second recognition result obtained after the image model recognizes the confrontation image; the judgment module is used to judge whether the first recognition result is consistent with the second recognition result; the determination module is used to determine whether the first recognition result is consistent with the second recognition result. The result is consistent with the second recognition result, and it is determined that the recognition of the counter image by the to-be-detected image model is successful.
  • a third aspect of the present application provides an electronic device including a processor and a memory, and the processor is configured to implement the image model detection method when executing computer-readable instructions stored in the memory.
  • a fourth aspect of the present application provides a non-volatile readable storage medium having computer readable instructions stored on the non-volatile readable storage medium, and when the computer readable instructions are executed by a processor, the Image model detection method.
  • the present application can detect the security performance of the image model to be detected in the above manner, so as to facilitate subsequent improvements to the image model to be detected based on the detection results, and improve the anti-interference ability of the image model to be detected .
  • Fig. 1 is a flowchart of a preferred embodiment of an image model detection method disclosed in the present application.
  • Fig. 2 is a functional block diagram of a preferred embodiment of an image model detection device disclosed in the present application.
  • FIG. 3 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the image model detection method according to the present application.
  • Fig. 1 is a flowchart of a preferred embodiment of an image model detection method disclosed in the present application. Among them, according to different needs, the order of the steps in the flowchart can be changed, and some steps can be omitted.
  • the electronic device obtains an original image sample.
  • the original image samples are relatively common and general, the original image samples can be obtained from the network through web crawling technology. If the original image samples are not easily obtained through public channels, the original image samples can be obtained from the client device, namely The original image sample is provided by the user, not local. Among them, the original image sample is a clean sample without any disturbance added.
  • the method further includes:
  • the sample features are input into the open source model framework for training, and a trained mainstream image classification model is obtained.
  • the open source model framework is based on mainstream image classification frameworks, such as resnet, inceptionV3, and other model frameworks disclosed in the open source community.
  • mainstream image classification frameworks such as resnet, inceptionV3, and other model frameworks disclosed in the open source community.
  • training samples such as face image samples, non-face image samples, etc.
  • sample features of the training samples such as face features
  • input the sample features into the open source model framework Training is performed in the process to obtain the image classification results, and finally the parameters of the open source model framework are continuously updated according to the image classification results, until the final convergence, and the trained mainstream image classification model is obtained.
  • follow-up also needs to attack the trained mainstream image classification model.
  • a model with a known specific structure and parameters (such as the above-mentioned trained mainstream image classification model) can be called a white box model, and a model with no specific structure and parameters can be called a black box model.
  • the attack methods of picture disturbance are mainly divided into white box attacks and black box attacks.
  • the above method can target white box attacks, that is, attacks against known models, while improving its robustness and transferability, so that the results after white box attacks can also successfully attack models that do not know the specific structure and parameters.
  • the electronic device inputs the original image samples into the trained mainstream image classification model.
  • the mainstream image classification model After the mainstream image classification model is trained, it is also necessary to attack the mainstream image classification model, such as a white box attack or a black box attack.
  • step S11 the method further includes:
  • the inputting the original image samples into the trained mainstream image classification model includes:
  • the processed original image samples are input into the trained mainstream image classification model.
  • the original image sample may be randomly changed in size, and then the original image sample may be randomly filled into a size of 331x331, and then the size may be changed to
  • the input size of the mainstream image classification model such as 224x224, can make the perturbation universal and adapt to different situations because of the various changes of the original image samples, so as to achieve the purpose of improving the robustness of the model and high transferability.
  • the electronic device uses the mainstream image classification model and a momentum-based gradient iterative algorithm to perform a confrontational attack on the original image sample to obtain a confrontational image.
  • the white-box model uses white-box attacks, and against white-box attacks, it uses a momentum-based gradient iterative algorithm.
  • the processed perturbation amount is added to the original image to obtain a counter image.
  • g refers to the amount of disturbance
  • g t refers to the amount of disturbance in the tth iteration
  • refers to the noise that the momentum coefficient is used to control the change
  • I ⁇ (x′ t , y) refers to the input of x′ t
  • y Go to the model function I ⁇ (x, y) and calculate the cross entropy to obtain l, which refers to the cross entropy loss between the output result of the penultimate fully connected layer of the mainstream image classification model and the category of the original image sample value
  • x′ t+1 refers to the original image sample adding the result of the tth iteration perturbation
  • refers to the perturbation coefficient , Used to control the difference between the disturbed image and the original image sample, clip [-10,10] g t+1 is used to cut g t+1 to the
  • the perturbation needs to be smoothed by convolution.
  • a randomly generated 4x4 Gaussian convolution kernel is used to perform convolution processing on g t without changing its dimensionality, so that the disturbance is smooth and thus more transferable.
  • the number of iterations can be tested in advance based on multiple experiments and set. Usually, the number of iterations is between 100 and 200. This will increase the perturbation capability of the perturbation amount by several times compared with traditional attack methods.
  • the electronic device obtains a first recognition result obtained after the image model to be detected recognizes the original image sample, and obtains a second recognition result obtained after the image model to be detected recognizes the confrontation image.
  • the image model to be detected is different from the trained mainstream image classification model, and the user may modify the mainstream frame model to obtain the image model to be detected.
  • the first recognition result obtained after the image model to be detected recognizes the original image sample can be obtained locally
  • the second recognition result obtained after the image model to be detected recognizes the confrontation image can be obtained locally
  • the first recognition result obtained after the original image sample is recognized by the image model to be detected may be obtained on the user-end device
  • the image model to be detected may be obtained on the user-end device to identify the confrontation image The second recognition result obtained afterwards.
  • the method further includes:
  • the original image sample and the confrontation image are respectively input to the image model to be detected, and a first recognition result of the original image sample and a second recognition result of the confrontation image are obtained.
  • the image model to be detected for model detection it is necessary to obtain the image model to be detected for model detection from the client device, and install the image model to be detected on the electronic device, and then directly upload the original image on the electronic device.
  • the sample and the confrontation image are respectively input to the image model to be detected, and a first recognition result of the original image sample and a second recognition result of the confrontation image are obtained.
  • the entire identification process is performed on the electronic device without any processing by the user-end device, which can save the resource consumption of the user-end device and save the user's time.
  • the method further includes:
  • the identification request carrying the original image sample and the confrontation image is sent to the user-end device, wherein the user-end device is equipped with the image model to be detected, and the image model to be detected on the user-end device is paired with
  • the original image sample is recognized to obtain a first recognition result
  • the confrontation image is recognized to obtain a second recognition result.
  • the electronic device can send the identification request carrying the original image sample and the confrontation image to the user-end device through the API interface.
  • the user-end device After the user-end device receives the identification request, it can use the to-be-detected An image model that recognizes the original image sample and the confrontation image, and obtains a first recognition result for the original image sample and a second recognition result for the confrontation image.
  • the client device can use the API The interface returns the first recognition result for the original image sample and the second recognition result for the confrontation image to the electronic device. The electronic device can make a judgment based on the first recognition result and the second recognition result.
  • the original image sample can come from a public channel, such as the Internet, or it can come from a user-end device.
  • the client device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • Its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), and a field programmable Gate array (FPGA), digital processor (DSP), embedded devices, etc., such as personal computers, tablet computers, personal digital assistants, etc.
  • an electronic device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • Its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), and a programmable gate array. (FPGA), digital processor (DSP), embedded devices, etc., such as personal computers, tablet computers, personal digital assistants, etc.
  • step S15 The electronic device judges whether the first recognition result is consistent with the second recognition result, if they are consistent, execute step S16, if not, end this process.
  • the first recognition result obtained after the original image sample is recognized by the image model to be detected is the first recognition result.
  • the original image sample has a human face
  • the second recognition result obtained after the image model to be detected recognizes the confrontation image. Since the confrontation image is an image with added disturbance, the second recognition result may be The confrontation image has a human face, or the confrontation image does not have a human face.
  • the electronic device determines that the image model to be detected successfully recognizes the counter image.
  • the first recognition result is consistent with the second recognition result, it indicates that the image model to be detected successfully and correctly recognizes the confrontation image.
  • the method further includes:
  • the security level of the image model to be detected is determined.
  • the recognition result of the image model to be detected also further indicates that the image model to be detected cannot defend against such confrontation images, indicating that the image model to be detected can easily be successfully attacked and has poor security.
  • different application scenarios have different standards for the image model to be detected, and the security level can be set according to different application scenarios.
  • Different security levels represent the level of security performance of the image model to be detected.
  • the image model to be tested is a minor security problem. If the accuracy of the tested image model is disturbing If the accuracy of the image model to be detected drops by 20% in the disturbed picture, the image model to be detected is a moderate security problem. If the accuracy of the image model to be detected drops by 30% or more in the disturbed image, the image model to be detected is a serious security problem.
  • the original image samples can be obtained, the original image samples can be input into the trained mainstream image classification model, the mainstream image classification model is used, and the momentum-based gradient iterative algorithm is used to compare the original image samples.
  • the image sample is subjected to a confrontation attack to obtain a confrontation image, and further, the first recognition result obtained after the original image sample is recognized by the image model to be detected can be acquired, and the confrontation image can be recognized by acquiring the image model to be detected And determine whether the first recognition result is consistent with the second recognition result, and if the first recognition result is consistent with the second recognition result, it is determined that the image model to be detected is The recognition of the confrontation image is successful.
  • a confrontational attack can be performed on the original image samples through a trained mainstream image classification model to generate a confrontational image, and then the confrontational image is used to test the image model to be detected.
  • the detection can be performed.
  • the security performance of the image model to be detected facilitates subsequent improvements to the image model to be detected based on the detection result, and improves the anti-interference ability of the image model to be detected.
  • Fig. 2 is a functional block diagram of a preferred embodiment of an image model detection device disclosed in the present application.
  • the image model detection device runs in an electronic device.
  • the image model detection device may include a plurality of functional modules composed of program code segments.
  • the program code of each program segment in the image model inspection device can be stored in a memory and executed by at least one processor to execute part or all of the steps in the image model inspection method described in FIG. 1.
  • the image model detection device can be divided into multiple functional modules according to the functions it performs.
  • the functional modules may include: a first acquisition module 201, an input module 202, a generation module 203, a second acquisition module 204, a judgment module 205, and a determination module 206.
  • the module referred to in this application refers to a series of computer-readable instruction segments that can be executed by at least one processor and can complete fixed functions, and are stored in a memory.
  • the first acquisition module 201 is used to acquire original image samples.
  • the original image samples are relatively common and general, the original image samples can be obtained from the network through web crawling technology. If the original image samples are not easily obtained through public channels, the original image samples can be obtained from the client device, namely The original image sample is provided by the user, not local. Among them, the original image sample is a clean sample without any disturbance added.
  • the input module 202 is configured to input the original image samples into the trained mainstream image classification model.
  • the mainstream image classification model After the mainstream image classification model is trained, it is also necessary to attack the mainstream image classification model, such as a white box attack or a black box attack.
  • the generating module 203 is configured to use the mainstream image classification model and a momentum-based gradient iteration algorithm to perform a confrontation attack on the original image sample to obtain a confrontation image.
  • the white-box model uses white-box attacks, and against white-box attacks, it uses a momentum-based gradient iterative algorithm.
  • the processed perturbation amount is added to the original image to obtain a counter image.
  • g refers to the amount of disturbance
  • g t refers to the amount of disturbance in the tth iteration
  • refers to the noise that the momentum coefficient is used to control the change
  • I ⁇ (x′ t , y) refers to the input of x′ t
  • y Go to the model function I ⁇ (x, y) and calculate the cross entropy to obtain l, which refers to the cross entropy loss between the output result of the penultimate fully connected layer of the mainstream image classification model and the category of the original image sample value
  • x′ t+1 refers to the original image sample adding the result of the tth iteration perturbation
  • refers to the perturbation coefficient , Used to control the difference between the disturbed image and the original image sample, clip [-10,10] g t+1 is used to cut g t+1 to the
  • the perturbation needs to be smoothed by convolution.
  • a randomly generated 4x4 Gaussian convolution kernel is used to perform convolution processing on g t without changing its dimensionality, so that the disturbance is smooth and thus more transferable.
  • the number of iterations can be tested in advance based on multiple experiments and set.
  • the number of iterations is between 100 and 200, which will increase the perturbation capability of the perturbation amount by several times compared with traditional attack methods.
  • the second acquisition module 204 is configured to acquire a first recognition result obtained after the original image sample is recognized by the image model to be detected, and a second recognition result obtained after the image model to be detected recognizes the confrontation image result.
  • the image model to be detected is different from the trained mainstream image classification model, and the user may modify the mainstream frame model to obtain the image model to be detected.
  • the first recognition result obtained after the image model to be detected recognizes the original image sample can be obtained locally
  • the second recognition result obtained after the image model to be detected recognizes the confrontation image can be obtained locally
  • the first recognition result obtained after the original image sample is recognized by the image model to be detected may be obtained on the user-end device
  • the image model to be detected may be obtained on the user-end device to identify the confrontation image The second recognition result obtained afterwards.
  • the judgment module 205 is configured to judge whether the first recognition result is consistent with the second recognition result.
  • the first recognition result obtained after the original image sample is recognized by the image model to be detected is the first recognition result.
  • the original image sample has a human face
  • the second recognition result obtained after the image model to be detected recognizes the confrontation image. Since the confrontation image is an image with added disturbance, the second recognition result may be The confrontation image has a human face, or the confrontation image does not have a human face.
  • the determining module 206 is configured to, if the first recognition result is consistent with the second recognition result, determine that the recognition of the to-be-detected image model for the confrontation image is successful.
  • the first recognition result is consistent with the second recognition result, it indicates that the image model to be detected successfully and correctly recognizes the confrontation image.
  • the image model detection device described in Figure 2 it is possible to obtain original image samples, input the original image samples into a trained mainstream image classification model, and use the mainstream image classification model to perform a momentum-based gradient iteration algorithm for all
  • the original image sample performs a confrontation attack to obtain a confrontation image.
  • the model successfully recognizes the confrontation image.
  • a confrontational attack can be performed on the original image samples through a trained mainstream image classification model to generate a confrontational image, and then the confrontational image is used to test the image model to be detected.
  • the detection can be performed.
  • the security performance of the image model to be detected facilitates subsequent improvements to the image model to be detected based on the detection result, and improves the anti-interference ability of the image model to be detected.
  • FIG. 3 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the image model detection method according to the present application.
  • the electronic device 3 includes a memory 31, at least one processor 32, computer readable instructions 33 stored in the memory 31 and executable on the at least one processor 32, and at least one communication bus 34.
  • FIG. 3 is only an example of the electronic device 3, and does not constitute a limitation on the electronic device 3. It may include more or less components than those shown in the figure, or a combination. Certain components, or different components, for example, the electronic device 3 may also include input and output devices, network access devices, and so on.
  • the at least one processor 32 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and application specific integrated circuits (ASICs). ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the processor 32 can be a microprocessor or the processor 32 can also be any conventional processor, etc.
  • the processor 32 is the control center of the electronic device 3, and connects the entire electronic device 3 through various interfaces and lines. The various parts.
  • the memory 31 may be used to store the computer-readable instructions 33 and/or modules/units, and the processor 32 runs or executes the computer-readable instructions and/or modules/units stored in the memory 31, and The data stored in the memory 31 is called to realize various functions of the electronic device 3.
  • the memory 31 may mainly include a storage program area and a storage data area.
  • the storage program area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; the storage data area may The data (such as audio data) created according to the use of the electronic device 3 and the like are stored.
  • the memory 31 may include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), At least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), At least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • the memory 31 in the electronic device 3 stores multiple computer-readable instructions to implement an image model detection method, and the processor 32 can execute the multiple computer-readable instructions to implement:
  • original image samples can be obtained, and the original image samples can be input into a trained mainstream image classification model.
  • mainstream image classification model a momentum-based gradient iterative algorithm can be used for The original image sample is subjected to a confrontation attack to obtain a confrontation image.
  • the first recognition result obtained after the original image sample is recognized by the original image sample can be obtained by the to-be-detected image model, and the to-be-detected image model
  • the second recognition result obtained after recognition and determine whether the first recognition result is consistent with the second recognition result, and if the first recognition result is consistent with the second recognition result, determine the image model to be detected The recognition of the confrontation image is successful.
  • a confrontational attack can be performed on the original image samples through a trained mainstream image classification model to generate a confrontational image, and then the confrontational image is used to test the image model to be detected.
  • the detection can be performed.
  • the security performance of the image model to be detected facilitates subsequent improvements to the image model to be detected based on the detection result, and improves the anti-interference ability of the image model to be detected.
  • the integrated module/unit of the electronic device 3 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile readable storage medium.
  • this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through computer-readable instructions.
  • the computer-readable instructions may be stored in a non-volatile memory.
  • the computer-readable instruction code may be in the form of source code, object code, executable file, or some intermediate forms, etc.
  • the non-volatile readable medium may include: any entity or device capable of carrying the computer readable instruction code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, and read-only memory (ROM, Read-Only Memory).
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Image Analysis (AREA)

Abstract

一种图像模型检测方法,所述方法包括:获取原始图像样本;将所述原始图像样本输入训练好的主流图像分类模型;使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;判断所述第一识别结果与所述第二识别结果是否一致;若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。本申请还提供一种图像模型检测装置、电子设备及存储介质。本申请能对深度神经网络模型的安全性进行检测。

Description

图像模型检测方法、装置、电子设备及存储介质
本申请要求于2019年09月23日提交中国专利局,申请号为201910901599.9发明名称为“图像模型检测方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请。
技术领域
本申请涉及智能终端技术领域,尤其涉及一种图像模型检测方法、装置、电子设备及存储介质。
背景技术
目前,人工智能应用在了很多领域中,比如人脸识别、声纹识别等场景,其核心技术以机器学习或者深度学习为基础。
实践中发现,虽然人工智能给人们带来了很多便利,但是,仍存在一些潜在的隐患,比如,在图像分类领域,如果图片被人恶意篡改,但是模型识别错误了,这会给用户带来安全隐患。这说明现代深度神经网络是非常容易受到对抗样本的攻击的。这些对抗样本仅有很轻微的扰动,以至于人类视觉系统无法察觉这种扰动(图片看起来几乎一样)。这样的攻击会导致神经网络完全改变它对图片的分类,导致出现识别错误的问题。
可见,如何对深度神经网络模型的安全性进行检测是一个亟待解决的技术问题。
发明内容
鉴于以上内容,有必要提供一种图像模型检测方法、装置、电子设备及存储介质,能够对深度神经网络模型的安全性进行检测。
本申请的第一方面提供一种图像模型检测方法,所述方法包括:获取原始 图像样本;将所述原始图像样本输入训练好的主流图像分类模型;使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;判断所述第一识别结果与所述第二识别结果是否一致;若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
本申请的第二方面提供一种图像模型检测装置,所述装置包括:
第一获取模块,用于获取原始图像样本;输入模块,用于将所述原始图像样本输入训练好的主流图像分类模型;生成模块,用于使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;第二获取模块,用于获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;判断模块,用于判断所述第一识别结果与所述第二识别结果是否一致;确定模块,用于若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
本申请的第三方面提供一种电子设备,所述电子设备包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机可读指令时实现所述的图像模型检测方法。
本申请的第四方面提供一种非易失性可读存储介质,所述非易失性可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现所述的图像模型检测方法。
由以上技术方案可知,本申请通过上述方式,可以检测所述待检测图像模型的安全性能,便于后续根据检测结果对所述待检测图像模型进行改进,提高所述待检测图像模型的抗扰能力。
附图说明
图1是本申请公开的一种图像模型检测方法的较佳实施例的流程图。
图2是本申请公开的一种图像模型检测装置的较佳实施例的功能模块图。
图3是本申请实现图像模型检测方法的较佳实施例的电子设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
图1是本申请公开的一种图像模型检测方法的较佳实施例的流程图。其中,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。
S11、电子设备获取原始图像样本。
其中,如果原始图像样本属于比较常见通用的,则可以通过网络爬取技术从网络中获取原始图像样本,如果原始图像样本不容易通过公共渠道获得,则可以从用户端设备获取原始图像样本,即该原始图像样本是用户提供的,而不是本地的。其中,该原始图像样本为干净的样本,没有添加任何扰动。
作为一种可选的实施方式,在步骤S11之前,所述方法还包括:
从需要进行模型检测的用户端设备获取训练样本;
提取所述训练样本的样本特征;
将所述样本特征输入开源模型框架中进行训练,获得训练好的主流图像 分类模型。
在该可选的实施方式中,所述开源模型框架基于主流的图片分类框架,比如resnet、inceptionV3等在开源社区公开的模型框架。在训练时,需要预先从用户端设备获取训练样本,比如人脸图像样本、非人脸图像样本等,进一步提取训练样本的样本特征,比如人脸特征,并将所述样本特征输入开源模型框架中进行训练,获得图片分类结果,最后根据图片分类结果不断更新开源模型框架的参数,直至最后收敛,获得训练好的主流图像分类模型。后续还需要对训练好的主流图像分类模型进行攻击。
其中,已知具体结构和参数的模型(比如上述训练好的主流图像分类模型)可以称为白盒模型,而不知道具体结构和参数的模型可以称为黑盒模型。通常,图片扰动的攻击手段主要分为白盒攻击和黑盒攻击。
上述方式可以针对白盒攻击,即针对已知模型进行攻击,同时提升它的鲁棒性和转移性,使白盒攻击后的结果也可以成功攻击不知道具体结构和参数的模型。
S12、电子设备将所述原始图像样本输入训练好的主流图像分类模型。
其中,训练好主流图像分类模型后,还需要对该主流图像分类模型进行攻击,比如白盒攻击或黑盒攻击。
作为一种可选的实施方式,在步骤S11之后,所述方法还包括:
对所述原始图像样本进行图片增强处理。
所述将所述原始图像样本输入训练好的主流图像分类模型包括:
将处理后的所述原始图像样本输入训练好的主流图像分类模型。
其中,为了使后续获得的对抗图像可以更好的攻击黑盒模型,增强图像的扰动能力从而模拟真实的攻击情景,还需要对原始图像样本进行图片增强处理。具体的,可以在对所述训练好的主流图像分类模型进行推理之前,对所述原始图像样本进行随机的改变大小,然后随机将所述原始图像样本填充成为一个331x331的尺寸,再变化大小成为主流图像分类模型的输入大小, 比如224x224,因为原始图像样本的变化多样,可以使扰动具有普遍性,可以适应不同的情况,从而达到提高模型鲁棒性和转移性高的目的。
S13、电子设备使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像。
其中,白盒模型采用的是白盒攻击,针对白盒攻击,采用基于动量的梯度迭代算法。
具体的,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像包括:
使用所述主流图像分类模型,基于动量的梯度迭代算法,计算扰动量;
对所述扰动量进行卷积平滑处理;
在所述原始图像上增加处理后的所述扰动量,获得对抗图像。
其中,所述基于动量的梯度迭代算法的公式如下:
Figure PCTCN2019118027-appb-000001
x′ t+1=x′ t+∈·clip [-10,10]g t+1
其中,g是指扰动量,g t是指第t次迭代的扰动量,μ是指动量系数用于控制更改的噪声,I θ(x′ t,y)是指将x′ t,y输入至模型函数I θ(x,y)并计算交叉熵后即可获得l,l是指主流图像分类模型的倒数第二层全连接层的输出结果与原始图像样本的类别之间的交叉熵损失值,
Figure PCTCN2019118027-appb-000002
则是求解每个像素延梯度方向更改的大小除以其扰动的方差,用于计算扰动量,x′ t+1则是指原始图像样本增加了第t次迭代扰动的结果,∈指扰动系数,用于控制添加扰动的图像与原始图像样本之间的差别,clip [-10,10]g t+1用于将g t+1裁减至[-10,10]的范围。
其中,为了使后续获得的对抗图像可以更好的攻击黑盒模型,增强图像的扰动能力从而模拟真实的攻击情景,在计算得到扰动量之后,还需要对所述扰动量进行卷积平滑处理,具体的,使用随机生成的4x4高斯卷积核对g t进行卷积处理,同时不改变其维度大小,使得扰动平滑从而更具有转移性。
其中,可以事先根据多次试验来测试迭代次数,并进行设置,通常迭代 次数在100到200之间,这样会使扰动量的扰动能力相较于传统的攻击方法增强数倍。
S14、电子设备获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果。
其中,所述待检测图像模型与所述训练好的主流图像分类模型不同,用户可能会在主流框架模型上进行修改以获得所述待检测图像模型。
其中,可以在本地获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及在本地获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,或者,可以在用户端设备上获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及在用户端设备上获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果。
可选的,步骤S14之前,所述方法还包括:
从用户端设备获取需要进行模型检测的待检测图像模型;
安装所述待检测图像模型;
将所述原始图像样本以及所述对抗图像分别输入至所述待检测图像模型,获得所述原始图像样本的第一识别结果以及所述对抗图像的第二识别结果。
在该可选的实施方式中,需要从用户端设备上获取需要进行模型检测的待检测图像模型,并在电子设备上安装所述待检测图像模型,进而直接在电子设备上将所述原始图像样本以及所述对抗图像分别输入至所述待检测图像模型,获得所述原始图像样本的第一识别结果以及所述对抗图像的第二识别结果。整个识别过程都是在电子设备上进行的,无需用户端设备做任何处理,从而可以节省用户端设备的资源消耗,节省用户时间。
可选的,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对 所述原始图像样本进行对抗攻击,获得对抗图像之后,所述方法还包括:
将携带有所述原始图像样本以及所述对抗图像的识别请求发送至用户端设备,其中,所述用户端设备安装有待检测图像模型,由所述用户端设备上的所述待检测图像模型对所述原始图像样本进行识别,获得第一识别结果,以及对所述对抗图像进行识别,获得第二识别结果。
在该可选的实施方式中,不需要获取用户端一侧的待检测模型,即不需要在电子设备上安装所述待检测模型,只需要用户端一侧提供API接口(Application Programming Interface,应用程序编程接口),电子设备可以通过该API接口将携带有所述原始图像样本以及所述对抗图像的识别请求发送至用户端设备,用户端设备接收到该识别请求后,即可使用该待检测图像模型,对所述原始图像样本以及所述对抗图像进行识别,获得针对所述原始图像样本的第一识别结果以及针对所述对抗图像的第二识别结果,最后用户端设备即可通过该API接口将针对所述原始图像样本的第一识别结果以及针对所述对抗图像的第二识别结果返回给电子设备。电子设备根据第一识别结果以及第二识别结果即可做出判断。
其中,所述原始图像样本可以来自于公共渠道,如网络,也可以来自于用户端设备。
在该可选的实施方式中,不需要主动获得用户端设备具体使用的模型以及用户在模型应用上的创新技术等细节,从而可以对客户模型技术进行保密,同时,还可以检测客户模型的安全问题,从而给予客户模型改进的指导以及用户安全的保护。
其中,用户端设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ASIC)、现场可编程门阵列(FPGA)、数字处理器(DSP)、嵌入式设备等,比如个人计算机、平板电脑、个人数字助理等。
其中,电子设备是一种能够按照事先设定或存储的指令,自动进行数值 计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ASIC)、可编程门阵列(FPGA)、数字处理器(DSP)、嵌入式设备等,比如个人计算机、平板电脑、个人数字助理等。
S15、电子设备判断所述第一识别结果与所述第二识别结果是否一致,若一致,执行步骤S16,若否,结束本流程。
其中,假设所述原始图像样本以及所述对抗样本是针对人脸图片的识别的,则待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,该第一识别结果为所述原始图像样本存在人脸,而待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,由于所述对抗图像是添加扰动后的图像,则所述第二识别结果可能是所述对抗图像存在人脸,或者,所述对抗图像不存在人脸。
S16、电子设备确定所述待检测图像模型针对所述对抗图像的识别成功。
其中,若所述第一识别结果与所述第二识别结果一致,表明所述待检测图像模型成功正确识别了所述对抗图像。
作为一种可选的实施方式,所述方法还包括:
若所述第一识别结果与所述第二识别结果不一致,确定所述待检测图像模型发生误判;
统计所述待检测图像模型发生误判的数量;
根据所述数量以及所述原始图像样本的总数量,计算所述待检测图像模型的准确率;
根据所述准确率,确定所述待检测图像模型的安全等级。
其中,若所述第一识别结果与所述第二识别结果不一致,表明所述待检测图像模型对所述对抗图像发生了误判,也说明对所述原始图像样本的扰动成功干扰了所述待检测图像模型的识别结果,也进一步预示着所述待检测图像模型无法防御这类的对抗图像,表明所述待检测图像模型很容易就被攻击成功,安全性较差。
其中,如果误判过多,会反映该待检测图像模型的安全性有很大问题。因此,还需要统计所述待检测图像模型发生误判的数量,并根据所述数量以及所述原始图像样本的总数量,计算所述待检测图像模型的准确率,其中,所述原始图像样本的总数量与所述对抗图像的总数量是相同的。
其中,不同的应用场景,对待检测图像模型的标准是不同的,可以根据不同的应用场景来设置安全等级。不同的安全等级代表所述待检测图像模型的安全性能的高低程度。
比如综合1000张及以上测试的图片情况,如果待检测图像模型的准确率在扰动的图片中下降了10%,则待检测图像模型为轻微的安全问题,如果待检测图像模型的准确率在扰动的图片中下降20%,则待检测图像模型为中度的安全问题,如果待检测图像模型的准确率在扰动的图片中下降30%及以上则待检测图像模型为严重的安全问题。
在图1所描述的方法流程中,可以获取原始图像样本,将所述原始图像样本输入训练好的主流图像分类模型,使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像,进一步地,可以获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,并判断所述第一识别结果与所述第二识别结果是否一致,若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。可见,本申请中,可以通过训练好的主流图像分类模型,对所述原始图像样本进行对抗攻击来生成对抗图像,进而通过对抗图像来对待检测图像模型进行测试,通过上述方式,可以检测所述待检测图像模型的安全性能,便于后续根据检测结果对所述待检测图像模型进行改进,提高所述待检测图像模型的抗扰能力。
图2是本申请公开的一种图像模型检测装置的较佳实施例的功能模块图。
在一些实施例中,所述图像模型检测装置运行于电子设备中。所述图像模型检测装置可以包括多个由程序代码段所组成的功能模块。所述图像模型检测装置中的各个程序段的程序代码可以存储于存储器中,并由至少一个处理器所执行,以执行图1所描述的图像模型检测方法中的部分或全部步骤。
本实施例中,所述图像模型检测装置根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:第一获取模块201、输入模块202、生成模块203、第二获取模块204、判断模块205及确定模块206。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。
第一获取模块201,用于获取原始图像样本。
其中,如果原始图像样本属于比较常见通用的,则可以通过网络爬取技术从网络中获取原始图像样本,如果原始图像样本不容易通过公共渠道获得,则可以从用户端设备获取原始图像样本,即该原始图像样本是用户提供的,而不是本地的。其中,该原始图像样本为干净的样本,没有添加任何扰动。
输入模块202,用于将所述原始图像样本输入训练好的主流图像分类模型。
其中,训练好主流图像分类模型后,还需要对该主流图像分类模型进行攻击,比如白盒攻击或黑盒攻击。
生成模块203,用于使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像。
其中,白盒模型采用的是白盒攻击,针对白盒攻击,采用基于动量的梯度迭代算法。
具体的,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像包括:
使用所述主流图像分类模型,基于动量的梯度迭代算法,计算扰动量;
对所述扰动量进行卷积平滑处理;
在所述原始图像上增加处理后的所述扰动量,获得对抗图像。
其中,所述基于动量的梯度迭代算法的公式如下:
Figure PCTCN2019118027-appb-000003
x′ t+1=x′ t+∈·clip [-10,10]g t+1
其中,g是指扰动量,g t是指第t次迭代的扰动量,μ是指动量系数用于控制更改的噪声,I θ(x′ t,y)是指将x′ t,y输入至模型函数I θ(x,y)并计算交叉熵后即可获得l,l是指主流图像分类模型的倒数第二层全连接层的输出结果与原始图像样本的类别之间的交叉熵损失值,
Figure PCTCN2019118027-appb-000004
则是求解每个像素延梯度方向更改的大小除以其扰动的方差,用于计算扰动量,x′ t+1则是指原始图像样本增加了第t次迭代扰动的结果,∈指扰动系数,用于控制添加扰动的图像与原始图像样本之间的差别,clip [-10,10]g t+1用于将g t+1裁减至[-10,10]的范围。
其中,为了使后续获得的对抗图像可以更好的攻击黑盒模型,增强图像的扰动能力从而模拟真实的攻击情景,在计算得到扰动量之后,还需要对所述扰动量进行卷积平滑处理,具体的,使用随机生成的4x4高斯卷积核对g t进行卷积处理,同时不改变其维度大小,使得扰动平滑从而更具有转移性。
其中,可以事先根据多次试验来测试迭代次数,并进行设置,通常迭代次数在100到200之间,这样会使扰动量的扰动能力相较于传统的攻击方法增强数倍。
第二获取模块204,用于获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果。
其中,所述待检测图像模型与所述训练好的主流图像分类模型不同,用户可能会在主流框架模型上进行修改以获得所述待检测图像模型。
其中,可以在本地获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及在本地获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,或者,可以在用户端设备上获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及在用户端 设备上获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果。
判断模块205,用于判断所述第一识别结果与所述第二识别结果是否一致。
其中,假设所述原始图像样本以及所述对抗样本是针对人脸图片的识别的,则待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,该第一识别结果为所述原始图像样本存在人脸,而待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,由于所述对抗图像是添加扰动后的图像,则所述第二识别结果可能是所述对抗图像存在人脸,或者,所述对抗图像不存在人脸。
确定模块206,用于若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
其中,若所述第一识别结果与所述第二识别结果一致,表明所述待检测图像模型成功正确识别了所述对抗图像。
在图2所描述的图像模型检测装置中,可以获取原始图像样本,将所述原始图像样本输入训练好的主流图像分类模型,使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像,进一步地,可以获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,并判断所述第一识别结果与所述第二识别结果是否一致,若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。可见,本申请中,可以通过训练好的主流图像分类模型,对所述原始图像样本进行对抗攻击来生成对抗图像,进而通过对抗图像来对待检测图像模型进行测试,通过上述方式,可以检测所述待检测图像模型的安全性能,便于后续根据检测结果对所述待检测图像模型进行改进,提高所述待检测图像模型的抗扰能力。
图3是本申请实现图像模型检测方法的较佳实施例的电子设备的结构示意图。所述电子设备3包括存储器31、至少一个处理器32、存储在所述存储器31中并可在所述至少一个处理器32上运行的计算机可读指令33及至少一条通讯总线34。
本领域技术人员可以理解,图3所示的示意图仅仅是所述电子设备3的示例,并不构成对所述电子设备3的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备3还可以包括输入输出设备、网络接入设备等。
所述至少一个处理器32可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。该处理器32可以是微处理器或者该处理器32也可以是任何常规的处理器等,所述处理器32是所述电子设备3的控制中心,利用各种接口和线路连接整个电子设备3的各个部分。
所述存储器31可用于存储所述计算机可读指令33和/或模块/单元,所述处理器32通过运行或执行存储在所述存储器31内的计算机可读指令和/或模块/单元,以及调用存储在存储器31内的数据,实现所述电子设备3的各种功能。所述存储器31可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备3的使用所创建的数据(比如音频数据)等。此外,存储器31可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。
结合图1,所述电子设备3中的所述存储器31存储多个计算机可读指令 以实现一种图像模型检测方法,所述处理器32可执行所述多个计算机可读指令从而实现:
获取原始图像样本;
将所述原始图像样本输入训练好的主流图像分类模型;
使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;
获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;
判断所述第一识别结果与所述第二识别结果是否一致;
若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
具体地,所述处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在图3所描述的电子设备3中,可以获取原始图像样本,将所述原始图像样本输入训练好的主流图像分类模型,使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像,进一步地,可以获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果,并判断所述第一识别结果与所述第二识别结果是否一致,若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。可见,本申请中,可以通过训练好的主流图像分类模型,对所述原始图像样本进行对抗攻击来生成对抗图像,进而通过对抗图像来对待检测图像模型进行测试,通过上述方式,可以检测所述待检测图像模型的安全性能,便于后续根据检测结果对所述待检测图像模型进行改进,提高所述待检测图像模型的抗扰能力。
所述电子设备3集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述非易失性可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器以及只读存储器(ROM,Read-Only Memory)。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种图像模型检测方法,其特征在于,所述方法包括:
    获取原始图像样本;
    将所述原始图像样本输入训练好的主流图像分类模型;
    使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;
    获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;
    判断所述第一识别结果与所述第二识别结果是否一致;
    若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
  2. 根据权利要求1所述的方法,其特征在于,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像包括:
    使用所述主流图像分类模型,基于动量的梯度迭代算法,计算扰动量;
    对所述扰动量进行卷积平滑处理;
    在所述原始图像上增加处理后的所述扰动量,获得对抗图像。
  3. 根据权利要求1所述的方法,其特征在于,所述获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果之前,所述方法还包括:
    从用户端设备获取需要进行模型检测的待检测图像模型;
    安装所述待检测图像模型;
    将所述原始图像样本以及所述对抗图像分别输入至所述待检测图像模型。
  4. 根据权利要求1所述的方法,其特征在于,所述使用所述主流图像分类 模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像之后,所述方法还包括:
    将携带有所述原始图像样本以及所述对抗图像的识别请求发送至用户端设备,其中,所述用户端设备安装有待检测图像模型,由所述用户端设备上的所述待检测图像模型对所述原始图像样本进行识别,获得第一识别结果,以及对所述对抗图像进行识别,获得第二识别结果。
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述方法还包括:
    若所述第一识别结果与所述第二识别结果不一致,确定所述待检测图像模型发生误判;
    统计所述待检测图像模型发生误判的数量;
    根据所述数量以及所述原始图像样本的总数量,计算所述待检测图像模型的准确率;
    根据所述准确率,确定所述待检测图像模型的安全等级。
  6. 根据权利要求1至4中任一项所述的方法,其特征在于,所述获取原始图像样本之前,所述方法还包括:
    从需要进行模型检测的用户端设备获取训练样本;
    提取所述训练样本的样本特征;
    将所述样本特征输入开源模型框架中进行训练,获得训练好的主流图像分类模型。
  7. 根据权利要求1所述的方法,其特征在于,所述获取原始图像样本之后,所述方法还包括:
    对所述原始图像样本进行图片增强处理;
    将经过图片增强处理后的所述原始图像样本输入训练好的主流图像分类模型。
  8. 一种图像模型检测装置,其特征在于,所述装置包括:
    第一获取模块,用于获取原始图像样本;
    输入模块,用于将所述原始图像样本输入训练好的主流图像分类模型;
    生成模块,用于使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;
    第二获取模块,用于获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;
    判断模块,用于判断所述第一识别结果与所述第二识别结果是否一致;
    确定模块,用于若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
  9. 一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述处理器用于执行存储器中存储的至少一个计算机可读指令以实现以下步骤:
    获取原始图像样本;
    将所述原始图像样本输入训练好的主流图像分类模型;
    使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;
    获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;
    判断所述第一识别结果与所述第二识别结果是否一致;
    若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
  10. 根据权利要求9所述的电子设备,其特征在于,所述处理器执行至少一个计算机可读指令以实现所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像时,具体包括:
    使用所述主流图像分类模型,基于动量的梯度迭代算法,计算扰动量;
    对所述扰动量进行卷积平滑处理;
    在所述原始图像上增加处理后的所述扰动量,获得对抗图像。
  11. 根据权利要求9所述的电子设备,其特征在于,所述获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果之前,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    从用户端设备获取需要进行模型检测的待检测图像模型;
    安装所述待检测图像模型;
    将所述原始图像样本以及所述对抗图像分别输入至所述待检测图像模型。
  12. 根据权利要求9所述的电子设备,其特征在于,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像之后,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    将携带有所述原始图像样本以及所述对抗图像的识别请求发送至用户端设备,其中,所述用户端设备安装有待检测图像模型,由所述用户端设备上的所述待检测图像模型对所述原始图像样本进行识别,获得第一识别结果,以及对所述对抗图像进行识别,获得第二识别结果。
  13. 根据权利要求9至12中任一项所述的电子设备,其特征在于,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    若所述第一识别结果与所述第二识别结果不一致,确定所述待检测图像模型发生误判;
    统计所述待检测图像模型发生误判的数量;
    根据所述数量以及所述原始图像样本的总数量,计算所述待检测图像模型的准确率;
    根据所述准确率,确定所述待检测图像模型的安全等级。
  14. 根据权利要求9至12中任一项所述的电子设备,其特征在于,所述获 取原始图像样本之前,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    从需要进行模型检测的用户端设备获取训练样本;
    提取所述训练样本的样本特征;
    将所述样本特征输入开源模型框架中进行训练,获得训练好的主流图像分类模型。
  15. 一种非易失性可读存储介质,其特征在于,所述非易失性可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
    获取原始图像样本;
    将所述原始图像样本输入训练好的主流图像分类模型;
    使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像;
    获取待检测图像模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果;
    判断所述第一识别结果与所述第二识别结果是否一致;
    若所述第一识别结果与所述第二识别结果一致,确定所述待检测图像模型针对所述对抗图像的识别成功。
  16. 根据权利要求15所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行以实现所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像时,具体包括:
    使用所述主流图像分类模型,基于动量的梯度迭代算法,计算扰动量;
    对所述扰动量进行卷积平滑处理;
    在所述原始图像上增加处理后的所述扰动量,获得对抗图像。
  17. 根据权利要求15所述的存储介质,其特征在于,所述获取待检测图像 模型对所述原始图像样本进行识别后获得的第一识别结果,以及获取所述待检测图像模型对所述对抗图像进行识别后获得的第二识别结果之前,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    从用户端设备获取需要进行模型检测的待检测图像模型;
    安装所述待检测图像模型;
    将所述原始图像样本以及所述对抗图像分别输入至所述待检测图像模型。
  18. 根据权利要求15所述的存储介质,其特征在于,所述使用所述主流图像分类模型,基于动量的梯度迭代算法,对所述原始图像样本进行对抗攻击,获得对抗图像之后,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    将携带有所述原始图像样本以及所述对抗图像的识别请求发送至用户端设备,其中,所述用户端设备安装有待检测图像模型,由所述用户端设备上的所述待检测图像模型对所述原始图像样本进行识别,获得第一识别结果,以及对所述对抗图像进行识别,获得第二识别结果。
  19. 根据权利要求15至18中任一项所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    若所述第一识别结果与所述第二识别结果不一致,确定所述待检测图像模型发生误判;
    统计所述待检测图像模型发生误判的数量;
    根据所述数量以及所述原始图像样本的总数量,计算所述待检测图像模型的准确率;
    根据所述准确率,确定所述待检测图像模型的安全等级。
  20. 根据权利要求15至18中任一项所述的存储介质,其特征在于,所述获取原始图像样本之前,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    从需要进行模型检测的用户端设备获取训练样本;
    提取所述训练样本的样本特征;
    将所述样本特征输入开源模型框架中进行训练,获得训练好的主流图像分类模型。
PCT/CN2019/118027 2019-09-23 2019-11-13 图像模型检测方法、装置、电子设备及存储介质 WO2021056746A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910901599.9 2019-09-23
CN201910901599.9A CN110851835A (zh) 2019-09-23 2019-09-23 图像模型检测方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021056746A1 true WO2021056746A1 (zh) 2021-04-01

Family

ID=69596011

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118027 WO2021056746A1 (zh) 2019-09-23 2019-11-13 图像模型检测方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN110851835A (zh)
WO (1) WO2021056746A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656813A (zh) * 2021-07-30 2021-11-16 深圳清华大学研究院 基于对抗攻击的图像处理方法、系统、设备及存储介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117034212A (zh) * 2020-03-10 2023-11-10 百度在线网络技术(北京)有限公司 处理图像数据的方法、装置、电子设备和计算机存储介质
CN111476228A (zh) * 2020-04-07 2020-07-31 海南阿凡题科技有限公司 针对场景文字识别模型的白盒对抗样本生成方法
CN111723865B (zh) * 2020-06-19 2021-07-16 北京瑞莱智慧科技有限公司 评估图像识别模型、攻击方法性能的方法、装置和介质
CN111866004B (zh) * 2020-07-27 2022-09-27 中国工商银行股份有限公司 安全评估方法、装置、计算机系统和介质
CN112507811A (zh) * 2020-11-23 2021-03-16 广州大学 一种检测人脸识别系统抵御伪装攻击的方法和系统
CN112488172B (zh) * 2020-11-25 2022-06-21 北京有竹居网络技术有限公司 对抗攻击的方法、装置、可读介质和电子设备
CN112613543B (zh) * 2020-12-15 2023-05-30 重庆紫光华山智安科技有限公司 增强策略验证方法、装置、电子设备及存储介质
CN112560039B (zh) * 2020-12-25 2023-04-18 河南交通职业技术学院 一种计算机安全防护方法
CN112907552B (zh) * 2021-03-09 2024-03-01 百度在线网络技术(北京)有限公司 图像处理模型的鲁棒性检测方法、设备及程序产品
WO2022222143A1 (zh) * 2021-04-23 2022-10-27 中国科学院深圳先进技术研究院 人工智能系统的安全性检测方法、装置及终端设备
CN113111833B (zh) * 2021-04-23 2022-11-25 中国科学院深圳先进技术研究院 人工智能系统的安全性检测方法、装置及终端设备
CN113807400B (zh) * 2021-08-17 2024-03-29 西安理工大学 一种基于对抗攻击的高光谱图像分类方法、系统和设备
CN114510715B (zh) * 2022-01-14 2022-10-14 中国科学院软件研究所 模型的功能安全测试方法、装置、存储介质及设备
CN114724014B (zh) * 2022-06-06 2023-06-30 杭州海康威视数字技术股份有限公司 基于深度学习的对抗样本攻击检测方法、装置及电子设备
CN115439377B (zh) * 2022-11-08 2023-03-24 电子科技大学 一种增强对抗图像样本迁移性攻击的方法

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170365038A1 (en) * 2016-06-16 2017-12-21 Facebook, Inc. Producing Higher-Quality Samples Of Natural Images
US20180225823A1 (en) * 2017-02-09 2018-08-09 Siemens Healthcare Gmbh Adversarial and Dual Inverse Deep Learning Networks for Medical Image Analysis
CN108537271A (zh) * 2018-04-04 2018-09-14 重庆大学 一种基于卷积去噪自编码机防御对抗样本攻击的方法
CN108615048A (zh) * 2018-04-04 2018-10-02 浙江工业大学 基于扰动进化对图像分类器对抗性攻击的防御方法
CN109165671A (zh) * 2018-07-13 2019-01-08 上海交通大学 基于样本到决策边界距离的对抗样本检测方法
CN109492582A (zh) * 2018-11-09 2019-03-19 杭州安恒信息技术股份有限公司 一种基于算法对抗性攻击的图像识别攻击方法
CN110222831A (zh) * 2019-06-13 2019-09-10 百度在线网络技术(北京)有限公司 深度学习模型的鲁棒性评估方法、装置及存储介质
CN110245598A (zh) * 2019-06-06 2019-09-17 北京瑞莱智慧科技有限公司 对抗样本生成方法、装置、介质和计算设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106296692A (zh) * 2016-08-11 2017-01-04 深圳市未来媒体技术研究院 基于对抗网络的图像显著性检测方法
CN107025284B (zh) * 2017-04-06 2020-10-27 中南大学 网络评论文本情感倾向的识别方法及卷积神经网络模型
CN108257116A (zh) * 2017-12-30 2018-07-06 清华大学 一种生成对抗图像的方法

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170365038A1 (en) * 2016-06-16 2017-12-21 Facebook, Inc. Producing Higher-Quality Samples Of Natural Images
US20180225823A1 (en) * 2017-02-09 2018-08-09 Siemens Healthcare Gmbh Adversarial and Dual Inverse Deep Learning Networks for Medical Image Analysis
CN108537271A (zh) * 2018-04-04 2018-09-14 重庆大学 一种基于卷积去噪自编码机防御对抗样本攻击的方法
CN108615048A (zh) * 2018-04-04 2018-10-02 浙江工业大学 基于扰动进化对图像分类器对抗性攻击的防御方法
CN109165671A (zh) * 2018-07-13 2019-01-08 上海交通大学 基于样本到决策边界距离的对抗样本检测方法
CN109492582A (zh) * 2018-11-09 2019-03-19 杭州安恒信息技术股份有限公司 一种基于算法对抗性攻击的图像识别攻击方法
CN110245598A (zh) * 2019-06-06 2019-09-17 北京瑞莱智慧科技有限公司 对抗样本生成方法、装置、介质和计算设备
CN110222831A (zh) * 2019-06-13 2019-09-10 百度在线网络技术(北京)有限公司 深度学习模型的鲁棒性评估方法、装置及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LUO, JIA ET AL.: "Generative adversarial network: An overview", CHINESE JOURNAL OF SCIENTIFIC INSTRUMENT, vol. 40, no. 3, 31 March 2019 (2019-03-31), pages 74 - 84, XP055795533 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656813A (zh) * 2021-07-30 2021-11-16 深圳清华大学研究院 基于对抗攻击的图像处理方法、系统、设备及存储介质
CN113656813B (zh) * 2021-07-30 2023-05-23 深圳清华大学研究院 基于对抗攻击的图像处理方法、系统、设备及存储介质

Also Published As

Publication number Publication date
CN110851835A (zh) 2020-02-28

Similar Documents

Publication Publication Date Title
WO2021056746A1 (zh) 图像模型检测方法、装置、电子设备及存储介质
US20220058426A1 (en) Object recognition method and apparatus, electronic device, and readable storage medium
US11971924B2 (en) Liveness test method and apparatus
CN110020592B (zh) 物体检测模型训练方法、装置、计算机设备及存储介质
US9679212B2 (en) Liveness testing methods and apparatuses and image processing methods and apparatuses
US10891467B2 (en) Facial verification method and apparatus
CN111723865B (zh) 评估图像识别模型、攻击方法性能的方法、装置和介质
WO2022100337A1 (zh) 人脸图像质量评估方法、装置、计算机设备及存储介质
US20200125836A1 (en) Training Method for Descreening System, Descreening Method, Device, Apparatus and Medium
Tan et al. Image co-saliency detection by propagating superpixel affinities
US20210390667A1 (en) Model generation
KR20150128510A (ko) 라이브니스 검사 방법과 장치,및 영상 처리 방법과 장치
Fang et al. Backdoor attacks on the DNN interpretation system
Chen et al. Image splicing forgery detection using simplified generalized noise model
WO2021042544A1 (zh) 基于去网纹模型的人脸验证方法、装置、计算机设备及存储介质
US9928408B2 (en) Signal processing
CN113033305B (zh) 活体检测方法、装置、终端设备和存储介质
CN108280388A (zh) 训练面部检测模型的方法和装置以及面部检测方法和装置
An et al. Benchmarking the Robustness of Image Watermarks
US20230162530A1 (en) Facial recognition adversarial patch adjustment
US10631050B2 (en) Determining and correlating visual context on a user device with user behavior using digital content on the user device
CN112883762A (zh) 一种活体检测方法、装置、系统及存储介质
TW202338730A (zh) 圖像擴增方法、電腦設備及儲存介質
CN111209567B (zh) 提高检测模型鲁棒性的可知性判断方法及装置
Xu et al. Lancex: A versatile and lightweight defense method against condensed adversarial attacks in image and audio recognition

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19946494

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19946494

Country of ref document: EP

Kind code of ref document: A1