CN113569822A - Image segmentation method and device, computer equipment and storage medium - Google Patents

Image segmentation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113569822A
CN113569822A CN202111123936.XA CN202111123936A CN113569822A CN 113569822 A CN113569822 A CN 113569822A CN 202111123936 A CN202111123936 A CN 202111123936A CN 113569822 A CN113569822 A CN 113569822A
Authority
CN
China
Prior art keywords
image
segmentation model
sample
image segmentation
annotation
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202111123936.XA
Other languages
Chinese (zh)
Other versions
CN113569822B (en
Inventor
柳露艳
马锴
郑冶枫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111123936.XA priority Critical patent/CN113569822B/en
Publication of CN113569822A publication Critical patent/CN113569822A/en
Application granted granted Critical
Publication of CN113569822B publication Critical patent/CN113569822B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the application discloses an image segmentation method, an image segmentation device, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: the method comprises the steps of obtaining a first image segmentation model, obtaining a first sample image, a first annotation image and a first contrast image, carrying out contrast training on the first image segmentation model based on the first sample image, the first annotation image and the first contrast image to obtain the weight of each operation in the first image segmentation model, determining a target operation between every two feature identifications based on the weight of each operation, forming a second image segmentation model by using a plurality of feature identifications and the target operation, calling the second image segmentation model, and segmenting any image. The method provided by the embodiment of the application can be applied to various scenes such as cloud technology, intelligent traffic and the like, the image segmentation model is automatically obtained in a model searching mode, the influence of human factors on the image segmentation model is weakened, and the accuracy of the image segmentation model is ensured.

Description

Image segmentation method and device, computer equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to an image segmentation method, an image segmentation device, computer equipment and a storage medium.
Background
With the development of artificial intelligence technology, the application of network models is more and more extensive. For example, when the network model is applied to the field of image processing, face recognition, animal recognition, and the like can be realized. The structure of the network model in the related art is usually determined manually, and is greatly influenced by technicians, so that the accuracy of the network model is poor.
Disclosure of Invention
The embodiment of the application provides an image segmentation method, an image segmentation device, computer equipment and a storage medium, which can improve the accuracy of a second image segmentation model. The technical scheme is as follows.
In one aspect, an image segmentation method is provided, and the method includes:
acquiring a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers;
acquiring a first sample image, a first annotation image and a first contrast image, wherein the first annotation image indicates a segmented region in the first sample image, and the first contrast image is an image obtained by adding interference information in the first sample image;
performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain a weight of each operation in the first image segmentation model;
determining target operation between every two feature identifiers based on the weight of each operation, and forming a second image segmentation model by using a plurality of feature identifiers and the target operation;
and calling the second image segmentation model to segment any image.
In another aspect, an image segmentation apparatus is provided, the apparatus comprising:
the image segmentation method comprises the steps of obtaining a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers;
the obtaining module is further configured to obtain a first sample image, a first annotation image, and a first contrast image, where the first annotation image indicates a region segmented in the first sample image, and the first contrast image is an image obtained by adding interference information to the first sample image;
a training module, configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image, to obtain a weight of each operation in the first image segmentation model;
the composition module is used for determining target operation between every two feature identifiers based on the weight of each operation and forming a second image segmentation model by using a plurality of feature identifiers and the target operation;
and the segmentation module is used for calling the second image segmentation model to segment any image.
In a possible implementation manner, the obtaining module is configured to obtain a plurality of first sample images, and a first annotation image and a first contrast image corresponding to each first sample image, where different first sample images belong to different image categories;
the training module is used for performing weighted fusion on the plurality of first sample images based on the weights of the plurality of first sample images to obtain a fused sample image; weighting and fusing the first annotation images based on the weights of the first sample images to obtain a fused annotation image; weighting and fusing the first countermeasure images based on the weights of the first sample images to obtain a fused countermeasure image; and performing countermeasure training on the first image segmentation model based on the fusion sample image, the fusion annotation image and the fusion countermeasure image to obtain the weight of each operation.
In another possible implementation manner, the training module is configured to invoke the first image segmentation model, and perform image segmentation on the first sample image and the first contrast image respectively to obtain a first prediction segmentation image of the first sample image and a second prediction segmentation image of the first contrast image; and performing countermeasure training on the first image segmentation model based on the difference between the first prediction segmentation image and the first annotation image and the difference between the first prediction segmentation image and the second prediction segmentation image to obtain the weight of each operation.
In another possible implementation manner, the training module is configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image, so as to obtain a weight of each operation and an operation parameter corresponding to each operation.
In another possible implementation manner, the obtaining module is further configured to obtain a second sample image and a second annotation image, where the second annotation image indicates a segmented region in the second sample image;
the training module is further configured to train the first image segmentation model based on the second sample image and the second labeled image.
In another possible implementation manner, the training module is configured to train the first image segmentation model based on the second sample image and the second annotation image and update an operation parameter corresponding to each operation when the current iteration number is not greater than a first threshold; and training the first image segmentation model based on the second sample image and the second labeled image under the condition that the current iteration number is greater than the first threshold and not greater than a second threshold, updating the weight of each operation and the operation parameter corresponding to each operation, wherein the second threshold is greater than the first threshold.
In another possible implementation manner, the training module is configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image to obtain a weight of each operation when the current iteration number is greater than the second threshold.
In another possible implementation manner, the composition module is configured to, for a plurality of the operations between every two of the feature identifiers, select, based on weights of the plurality of the operations, at least one target operation with a largest weight from the plurality of the operations; and operating the plurality of feature identifications and the selected target to form the second image segmentation model.
In another possible implementation manner, the obtaining module is further configured to obtain a third sample image, a third annotation image, and a second contrast image, where the third annotation image indicates a segmented region in the third sample image, and the second contrast image is an image obtained by adding interference information to the third sample image;
the training module is further configured to perform countermeasure training on the second image segmentation model based on the third sample image, the third annotation image, and the second countermeasure image.
In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory having stored therein at least one computer program, the at least one computer program being loaded and executed by the processor to perform the operations performed in the image segmentation method according to the above aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one computer program is stored, the at least one computer program being loaded and executed by a processor to implement the operations performed in the image segmentation method according to the above aspect.
In a further aspect, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the operations carried out in the image segmentation method according to the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
the method, the device, the computer equipment and the storage medium provided by the embodiment of the application can be applied to various scenes such as cloud technology, intelligent traffic and the like, the first image segmentation model is trained in a countermeasure mode, then the second image segmentation model suitable for image segmentation is generated based on the trained first image segmentation model, the scheme that the image segmentation model is automatically obtained in a model search mode is achieved, the network structure of the image segmentation model does not need to be designed manually in the process, the influence of human factors on the image segmentation model is weakened, and therefore the accuracy of the second image segmentation model is guaranteed. And the first image segmentation model is trained in a countermeasure mode to improve the accuracy and robustness of the first image segmentation model and ensure the accuracy and robustness of the acquired second image segmentation model, and the subsequent image segmentation is carried out based on the second image segmentation model to ensure the accuracy of the image segmentation.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
fig. 2 is a flowchart of an image segmentation method provided in an embodiment of the present application;
FIG. 3 is a flowchart of an image segmentation method provided in an embodiment of the present application;
FIG. 4 is a flowchart of an image segmentation method provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an image segmentation model provided in an embodiment of the present application;
FIG. 6 is a diagram illustrating the effect of model width and model depth on robustness provided by an embodiment of the present application;
fig. 7 is a schematic structural diagram of an image segmentation apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
The terms "first," "second," "third," and the like as used herein may be used herein to describe various concepts that are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, the first sample image may be referred to as a second sample image, and similarly, the second sample image can be referred to as the first sample image, without departing from the scope of the present application.
As used herein, the terms "at least one," "a plurality," "each," and "any," at least one of which includes one, two, or more than two, and a plurality of which includes two or more than two, each of which refers to each of the corresponding plurality, and any of which refers to any of the plurality. For example, the plurality of images includes 3 images, each of the 3 images refers to each of the 3 images, and any one of the 3 images refers to any one of the 3 images, which can be a first image, a second image, or a third image.
Artificial Intelligence (AI) is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human Intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Computer Vision technology (CV) is a science for researching how to make a machine "see", and further refers to that a camera and a Computer are used to replace human eyes to perform machine Vision such as identification, tracking and measurement on a target, and further image processing is performed, so that the Computer processing becomes an image more suitable for human eyes to observe or is transmitted to an instrument to detect. As a scientific discipline, computer vision research-related theories and techniques attempt to build artificial intelligence systems that can capture information from images or multidimensional data. The computer vision technology generally includes image processing, image Recognition, image semantic understanding, image retrieval, OCR (Optical Character Recognition), video processing, video semantic understanding, video content/behavior Recognition, three-dimensional object reconstruction, 3D (3-Dimension) technology, virtual reality, augmented reality, synchronous positioning and map construction, automatic driving, smart transportation and other technologies, and also includes common human face Recognition, fingerprint Recognition and other biological feature Recognition technologies.
Machine Learning (ML) is a multi-domain cross discipline, and relates to a plurality of disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and the like. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
According to the scheme provided by the embodiment of the application, the second image segmentation model can be trained based on the machine learning technology of artificial intelligence, and the image segmentation method is realized by utilizing the trained second image segmentation model.
The image segmentation method provided by the embodiment of the application is executed by computer equipment. Optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like. Optionally, the terminal is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. Optionally, the computer device includes a terminal and a server, and the terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited herein.
In some embodiments, the computer program according to the embodiments of the present application may be deployed to be executed on one computer device or on multiple computer devices located at one site, or may be executed on multiple computer devices distributed at multiple sites and interconnected by a communication network, and the multiple computer devices distributed at the multiple sites and interconnected by the communication network can form a block chain system.
Fig. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. Referring to fig. 1, the implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wireless or wired network.
In one possible implementation, the terminal 101 has installed thereon a target application served by the server 102, through which the terminal 101 can implement functions such as data transmission, message interaction, and the like. Optionally, the target application is a target application in an operating system of the terminal 101, or a target application provided by a third party. For example, the target application is an image recognition application having a function of image recognition, but of course, the image recognition application can also have other functions, such as a comment function, a shopping function, a navigation function, a game function, and the like.
The server 102 is used to train the image segmentation model and store the image segmentation model, or the developer deploys the image segmentation model in another storage location, and the server 102 calls the stored image segmentation model. The terminal 101 is configured to log in a target application based on a user identifier, send an image to be segmented to the server 102 through the target application, the server 102 is configured to receive the image sent by the terminal 101, segment the image based on the image segmentation model to obtain a segmented image corresponding to the image, and perform image recognition based on the segmented image to obtain a corresponding recognition result.
Fig. 2 is a flowchart of an image segmentation method provided in an embodiment of the present application, which is executed by a computer device, and as shown in fig. 2, the method includes the following steps.
201. The computer device obtains a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers.
Wherein each feature identification indicates a feature, each operation for processing the feature. In this embodiment of the application, when the first image segmentation model segments an image, through a plurality of operations between every two feature identifiers in the first image segmentation model, the features corresponding to each feature identifier are sequentially obtained until the features corresponding to the last feature identifier are obtained, where the features corresponding to the last feature identifier are the segmented image corresponding to the final output image.
202. The computer device acquires a first sample image, a first annotation image and a first contrast image, wherein the first annotation image indicates a segmented region in the first sample image, and the first contrast image is an image obtained by adding interference information in the first sample image.
The first sample image is an arbitrary image, for example, in a medical scene, the first sample image is a sample medical image, and in an automatic driving scene, the first sample image is a sample street view image. The first annotation image corresponds to the first sample image and is obtained by annotating the first sample image, and the first annotation image indicates a segmented region in the annotated first sample image. The interference information is used for interfering the original image, and the obtained first contrast image is different from the first sample image by adding the interference information in the first sample image.
203. And the computer equipment carries out countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation in the first image segmentation model.
In the embodiment of the application, each operation in the first image segmentation model has a weight, and the weight of each operation indicates the importance degree of the operation in a plurality of operations between the corresponding two feature identifiers. The first annotation image indicates a real segmented region in the first sample image, and based on the first sample image, the first annotation image and the first countermeasure image, countermeasure training is performed on the first image segmentation model, and the weight of each operation in the first image segmentation model is updated, so that the accuracy of the first image segmentation model is improved, and the capability of the first image segmentation model for resisting countermeasure attacks is also improved, namely the robustness of the first image segmentation model is improved. After the first image segmentation model is trained, the weight of each operation can be obtained.
204. The computer equipment determines target operation between every two feature identifiers based on the weight of each operation, and forms a second image segmentation model by using the plurality of feature identifiers and the target operation.
The second image segmentation model is used for segmenting the image, the second image segmentation model comprises a plurality of feature identifiers and target operations between every two feature identifiers, and the operations contained in the second image segmentation model are possibly less than those contained in the first image segmentation model.
After the training of the first image segmentation model is completed, the weight of each operation can be determined. And for a plurality of operations between each two feature identifiers, selecting a target operation from the plurality of operations based on the weight of each operation, and then forming a second image segmentation model by the plurality of feature identifiers and the selected target operation, thereby realizing a scheme of obtaining the second image segmentation model by searching based on the first image segmentation model in a model searching mode.
205. And calling a second image segmentation model by the computer equipment to segment any image.
By segmenting any image through the trained second image segmentation model, a segmented image of the image can be acquired.
The method provided by the embodiment of the application can be applied to various scenes such as cloud technology, intelligent traffic and the like, the first image segmentation model is trained in a countermeasure mode, then the second image segmentation model suitable for image segmentation is generated based on the trained first image segmentation model, the scheme that the image segmentation model is automatically obtained in a model searching mode is achieved, the network structure of the image segmentation model does not need to be designed manually in the process, the influence of human factors on the image segmentation model is weakened, and therefore the accuracy of the second image segmentation model is guaranteed. And the first image segmentation model is trained in a countermeasure mode to improve the accuracy and robustness of the first image segmentation model and ensure the accuracy and robustness of the acquired second image segmentation model, and the subsequent image segmentation is carried out based on the second image segmentation model to ensure the accuracy of the image segmentation.
On the basis of the embodiment shown in fig. 2, the first image segmentation model can be trained through multiple training stages to improve the accuracy of the acquired second segmentation model, after the second image segmentation model is acquired, the second image segmentation model is subjected to fine tuning training, and then the image is segmented based on the trained second image segmentation model, and the model training process and the image segmentation process are described in detail in the following embodiments.
Fig. 3 is a flowchart of an image segmentation method provided in an embodiment of the present application, which is executed by a computer device, and as shown in fig. 3, the method includes the following steps.
301. The computer device obtains a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers.
Wherein each operation is used for processing a feature, optionally the operations in the first image segmentation model comprise an averaging pooling operation, a maximum pooling operation, a convolution operation, a weighting operation, etc.
In this embodiment of the present application, the first image segmentation model is used as a super network model, the super network model includes a set of all possible networks, that is, the super network model includes a plurality of feature identifiers and a plurality of possible operations between every two feature identifiers, and then the first image segmentation model is trained, and a second image segmentation model suitable for image segmentation is obtained based on the first image segmentation model in a model search manner.
In a possible implementation manner, the plurality of feature identifiers in the first image segmentation model are arranged in order, for a first feature identifier in the plurality of feature identifiers, the first feature identifier is any one feature identifier in the plurality of feature identifiers, the second feature identifier is a feature identifier before the first feature identifier, and a feature corresponding to the first feature identifier is obtained based on a feature corresponding to the plurality of second feature identifiers. For example, when the feature corresponding to the first feature identifier is obtained, the feature corresponding to each second feature identifier is used as an input, and the feature corresponding to the first feature identifier can be obtained by using the features corresponding to the plurality of second feature identifiers. Namely, in the process of acquiring the feature corresponding to the first feature identifier, the method includes: for a plurality of operations between each second feature identifier and the first feature identifier, respectively processing features corresponding to the second feature identifier based on the plurality of operations to obtain each processed feature, performing weighted fusion on the plurality of processed features based on the weights of the plurality of operations to obtain a fusion feature corresponding to the second feature identifier, and fusing the fusion features corresponding to the plurality of second feature identifiers to obtain a feature corresponding to the first feature identifier.
The image segmentation based on the first image segmentation model is to start from a first feature identifier, obtain features corresponding to each feature identifier in sequence according to the arrangement sequence of a plurality of feature identifiers and in the above manner, until obtaining features corresponding to a last feature identifier, where the features corresponding to the last feature identifier are the segmented images corresponding to the input images.
302. The computer device obtains a second sample image and a second annotated image, the second annotated image indicating a region segmented in the second sample image.
The second sample image is an arbitrary image in an arbitrary application scene. For example, in a medical scenario, the second sample image is a sample medical image, and in an automatic driving scenario, the second sample image is a sample street view image. The second annotation image is obtained by annotating the second sample image, optionally, the second annotation image is obtained by manual annotation, or the second annotation image is obtained by annotating the second sample image through an annotation model, which is not limited in the present application.
In one possible implementation, the second annotation image contains an indicator corresponding to each pixel in the second sample image, and the indicator indicates a category to which the corresponding pixel belongs. Optionally, the second annotation image is represented in a matrix, where each element in the matrix is an indicator corresponding to each pixel in the second sample image.
For example, the second sample image is a brain medical image, the second labeled image is obtained by labeling a lesion region of the brain in the second sample image, the second labeled image is represented in a matrix form, the matrix includes 0 or 1, 0 represents that the corresponding pixel does not belong to the lesion region, and 1 represents that the corresponding pixel belongs to the lesion region.
303. The computer device trains the first image segmentation model based on the second sample image and the second annotation image.
The second annotation image is obtained by annotating the second sample image and indicates the real segmented region in the second sample image, and the first image segmentation model is trained through the second sample image and the second annotation image, so that the accuracy of the first image segmentation model can be improved.
In one possible implementation, this step 303 includes: and calling a first image segmentation model, carrying out image segmentation on the second sample image to obtain a predicted segmentation image, and training the first image segmentation model based on the difference between the predicted segmentation image and the second labeled image.
The predicted segmentation image is obtained by calling the first image segmentation model, namely the predicted segmentation image indicates a predicted segmented region in the second sample image, the second annotation image indicates a real segmented region in the second sample image, and the difference between the predicted segmentation image and the second annotation image can reflect the accuracy of the first image segmentation model.
In one possible implementation, this step 303 includes: under the condition that the current iteration number is not larger than a first threshold value, training a first image segmentation model based on a second sample image and a second annotation image, and updating an operation parameter corresponding to each operation; and under the condition that the current iteration number is greater than a first threshold and not greater than a second threshold, training the first image segmentation model based on the second sample image and the second annotation image, and updating the weight of each operation and the operation parameter corresponding to each operation.
The second threshold is greater than the first threshold, and both the first threshold and the second threshold are arbitrary values, for example, the first threshold is 10, and the second threshold is 50. In the embodiment of the present application, each operation has a corresponding weight and an operation parameter, and the operation parameter is a parameter used when an operation is performed on a feature corresponding to a feature identifier. For any operation, when the feature is processed based on the operation, that is, based on the operation parameter corresponding to the operation, the feature is processed.
In the embodiment of the application, the first image segmentation model is iteratively trained for multiple times, a second sample image and a corresponding second labeled image are obtained each time, and the first image segmentation model is trained based on the second sample image and the second labeled image. The process of training the first image segmentation model can be divided into two stages according to the number of iterations: under the condition that the iteration times are not more than a first threshold value, a process of training the first image segmentation model is a first training stage; and under the condition that the iteration times are larger than the first threshold and not larger than the second threshold, the process of training the first image segmentation model is the second training stage. In the first training stage, only the operation parameter corresponding to each operation is updated each time the first image segmentation model is iteratively trained, and the weight of each operation is kept unchanged.
Optionally, in a case that the number of iterations is not greater than the first threshold, each time the first image segmentation model is trained in an iteration, the operation parameter corresponding to each operation is updated, and the process of updating the operation parameter corresponding to each operation includes: and determining a first loss value based on the difference between the prediction segmentation image and the second labeling image, determining a first learning rate and a first descending gradient of the operation parameters, and updating the operation parameters corresponding to each operation based on the first loss value, the first learning rate and the first descending gradient.
Optionally, in a case that the number of iterations is not greater than the first threshold, for an operation parameter corresponding to any one operation, the operation parameters before and after updating satisfy the following relationship:
Figure DEST_PATH_IMAGE001
Figure DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE003
for the number of iterations, here
Figure 583401DEST_PATH_IMAGE003
Not greater than a second threshold;
Figure DEST_PATH_IMAGE004
the updated operation parameters corresponding to the operation;
Figure DEST_PATH_IMAGE005
for the pre-update operating parameters corresponding to the operation,
Figure DEST_PATH_IMAGE006
as the first learning rate,
Figure DEST_PATH_IMAGE007
in order to be the first falling gradient,
Figure DEST_PATH_IMAGE008
is a loss value associated with the operating parameter;
Figure DEST_PATH_IMAGE009
updated weights for the operation;
Figure DEST_PATH_IMAGE010
the weight of the operation before updating, i.e. the weight of the operation, remains unchanged.
Optionally, when the number of iterations is greater than the first threshold and not greater than the second threshold, and each time the first image segmentation model is trained in an iteration, the weight of each operation and the operation parameter corresponding to each operation are updated, and the process of updating the weight of each operation and the operation parameter corresponding to each operation includes: and updating the weight of each operation and the operation parameter corresponding to each operation based on the first loss value, the first learning rate, the first descending gradient, the second learning rate and the second descending gradient of the weight.
Optionally, when the number of iterations is greater than the first threshold and not greater than the second threshold, for the weight of any operation and the operation parameter corresponding to the operation, the weight and the operation parameter before and after updating satisfy the following relationship:
Figure DEST_PATH_IMAGE011
Figure DEST_PATH_IMAGE012
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE013
for the number of iterations, here
Figure 936760DEST_PATH_IMAGE013
Greater than a first threshold and not greater than a second threshold;
Figure DEST_PATH_IMAGE014
the updated operation parameters corresponding to the operation;
Figure DEST_PATH_IMAGE015
for the pre-update operating parameters corresponding to the operation,
Figure DEST_PATH_IMAGE016
as the first learning rate,
Figure DEST_PATH_IMAGE017
in order to be the first falling gradient,
Figure DEST_PATH_IMAGE018
is a loss value associated with the operating parameter;
Figure DEST_PATH_IMAGE019
updated weights for the operation;
Figure DEST_PATH_IMAGE020
the weights before the update for the operation are,
Figure DEST_PATH_IMAGE021
as the second learning rate, is set to the second learning rate,
Figure DEST_PATH_IMAGE022
in order to be the second decreasing gradient, the gradient is,
Figure DEST_PATH_IMAGE023
is a weight-dependent penalty value
Figure 396123DEST_PATH_IMAGE023
Is by means of updated operating parameters
Figure 73223DEST_PATH_IMAGE014
And weights before update
Figure 153175DEST_PATH_IMAGE020
And (4) obtaining the product.
304. The computer device acquires a first sample image, a first annotation image and a first contrast image, wherein the first annotation image indicates a segmented region in the first sample image, and the first contrast image is an image obtained by adding interference information in the first sample image.
In the embodiment of the present application, the first countermeasure image is an image obtained by adding interference information to the first sample image, and there is a difference between the first sample image and the first countermeasure image.
In one possible implementation, this step 304 includes: acquiring a first sample image, and acquiring a first contrast image corresponding to the first sample image from the contrast image set.
In the embodiment of the present application, the countermeasure image set includes first countermeasure images corresponding to a plurality of first sample images, and in the countermeasure image set, the interference information added in each countermeasure image is information within an allowable interference range, that is, a difference between the obtained first countermeasure image and the first sample image is within the allowable interference range.
Optionally, the first sample image and the first contrast image satisfy the following relationship:
Figure DEST_PATH_IMAGE024
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE025
for representing a set of confrontational images
Figure 116583DEST_PATH_IMAGE025
A first contrast image including a correspondence of each first sample image;
Figure DEST_PATH_IMAGE026
for the purpose of representing a first image of the sample,
Figure DEST_PATH_IMAGE027
for representing a first contrast image,
Figure DEST_PATH_IMAGE028
for the purpose of representing the normalization process,
Figure DEST_PATH_IMAGE029
the value to which the norm corresponds is indicated,
Figure 321299DEST_PATH_IMAGE029
is an integer of not less than 1, and,
Figure DEST_PATH_IMAGE030
the attack strength can be expressed, and the distance corresponding to the allowable interference range can also be expressed.
305. And the computer equipment carries out countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation in the first image segmentation model.
And performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image so as to improve the accuracy and robustness of the first image segmentation model. And in the process of training the first image segmentation model, updating the weight of each operation in the first image segmentation model so as to obtain the weight of each operation after the training of the first image segmentation model is finished.
In one possible implementation, this step 305 includes: calling a first image segmentation model, performing image segmentation on a first sample image and a first contrast image respectively to obtain a first prediction segmentation image of the first sample image and a second prediction segmentation image of the first contrast image, and performing contrast training on the first image segmentation model based on the difference between the first prediction segmentation image and the first annotation image and the difference between the first prediction segmentation image and the second prediction segmentation image to obtain the weight of each operation.
The first prediction segmentation image and the second prediction segmentation image are obtained by calling the first image segmentation model to perform image segmentation, the first annotation image indicates a real segmented region in the first sample image, and the difference between the first prediction segmentation image and the first annotation image can reflect the accuracy of the first image segmentation model. Since the first countermeasure image is obtained by adding interference information to the first sample image, the difference between the first prediction result and the second prediction result can reflect the capability of the first image segmentation model to resist the countermeasure attack. Therefore, based on the difference between the first prediction segmentation image and the first annotation image and the difference between the first prediction segmentation image and the second prediction segmentation image, the first image segmentation model is subjected to countermeasure training to improve the accuracy of the first image segmentation model and improve the capability of the first image segmentation model to resist attacks, namely improve the robustness of the first image segmentation model. When the first image segmentation model is subjected to the countermeasure training, the weight of each operation in the first image segmentation model is updated, that is, the updated weight of each operation can be obtained after the first image segmentation model is trained.
Optionally, when the first image segmentation model is called to obtain the first predicted segmentation image and the second predicted segmentation image, the first image segmentation model is obtained based on the weight of each operation in the first image segmentation model and the weight parameter corresponding to each operation, and then, based on the difference between the first predicted segmentation image and the first annotation image and the difference between the first predicted segmentation image and the second predicted segmentation image, the first image segmentation model is subjected to countermeasure training, and the weight of each operation and the operation parameter corresponding to each operation are updated.
Optionally, a second loss value is determined based on a difference between the first predicted segmented image and the first annotated image, a third loss value is determined based on a difference between the first predicted segmented image and the second predicted segmented image, and the first image segmentation model is trained based on a sum of the second loss value and the third loss value.
Wherein obtaining the third loss value can employ a regularized loss function to trade-off robustness against the first sample image. For example, the regularization loss function is KL (relative entropy) or other loss functions, which is not limited in this application.
Optionally, a sum of the second loss value and the third loss value satisfies the following relationship:
Figure DEST_PATH_IMAGE031
Figure DEST_PATH_IMAGE032
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE033
for representing the sum of the second loss value and the third loss value,
Figure DEST_PATH_IMAGE034
for the purpose of representing the second loss value,
Figure DEST_PATH_IMAGE035
for the purpose of representing a third loss value,
Figure DEST_PATH_IMAGE036
for representing a regularization loss function,
Figure DEST_PATH_IMAGE037
for representing a first of the predictively segmented images,
Figure DEST_PATH_IMAGE038
for representing the second predictively segmented image.
In the embodiment of the present application, when training the first image segmentation model against challenge, in order to improve the capability and accuracy of the first image segmentation model against challenge attack, the following loss function is adopted to train the first image segmentation model. The first image segmentation model is trained according to the following loss function to reduce loss values, so that the accuracy and the robustness of the first image segmentation model are improved.
Figure DEST_PATH_IMAGE039
Wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE040
for the purpose of representing a first image of the sample,
Figure DEST_PATH_IMAGE041
for representing the second sample image,
Figure DEST_PATH_IMAGE042
a first contrast image is represented and,
Figure DEST_PATH_IMAGE043
for representing a set of sample images,
Figure DEST_PATH_IMAGE044
for the purpose of representing the normalization process,
Figure DEST_PATH_IMAGE045
for representing a distribution of differences between the first sample image and the first annotation,
Figure DEST_PATH_IMAGE046
for representing a set of confrontational images, the set of confrontational images comprising a first confrontational image,
Figure DEST_PATH_IMAGE047
for representing the sum of the second loss value and the third loss value,
Figure DEST_PATH_IMAGE048
for representing a first image segmentation model,
Figure DEST_PATH_IMAGE049
representing model parameters in the first image segmentation model.
In one possible implementation, this step 305 includes: and performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation and the operation parameter corresponding to each operation.
In an embodiment of the present application, each operation in the first image segmentation model has a corresponding weight and operation parameter. In the process of performing countermeasure training on the first image segmentation model, the weight of each operation and the operation parameter corresponding to each operation are updated, so that the accuracy of the first image segmentation model is improved.
In one possible implementation, this step 305 includes: and under the condition that the current iteration number is greater than a second threshold value, performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation.
In the embodiment of the application, the first image segmentation model is trained through multiple iterations, in the process of carrying out multiple iteration training on the first image segmentation model, only under the condition that the iteration times are larger than the second threshold value, the first image segmentation model is subjected to countermeasure training, and the weight of each operation is updated in the training process to obtain the updated weight of each operation.
Optionally, when the number of iterations is greater than the second threshold, each time the first image segmentation model is trained in an iteration mode, the weight of each operation and the operation parameter corresponding to each operation are updated, and the process of updating the weight of each operation and the operation parameter corresponding to each operation includes: the method includes the steps of determining a second loss value based on a difference between a first prediction segmentation image and a first annotation image, determining a third loss value based on a difference between the first prediction segmentation image and a second prediction segmentation image, determining a sum of loss values of the second loss value and the third loss value, determining a first learning rate and a first descending gradient of an operation parameter, and a second learning rate and a second descending gradient of a weight, and updating the weight of each operation and the operation parameter corresponding to each operation based on the sum of the loss values, the first learning rate, the first descending gradient, the second learning rate and the second descending gradient.
306. The computer device selects at least one target operation with the largest weight from the multiple operations based on the weights of the multiple operations for the multiple operations between every two feature identifications.
In the embodiment of the present application, after the first image segmentation model is trained, the weight of each operation can be obtained. For a plurality of operations between any two feature identifiers, the weight of each operation is larger, which indicates that the operation is more important, that is, the role of the operation in the image segmentation process is larger. Therefore, at least one target operation with the largest weight is selected from a plurality of operations between every two feature identifiers, namely at least one target operation is determined between every two feature identifiers.
In one possible implementation, this step 306 includes: for a plurality of operations between any two feature identifications, a target number of target operations are selected from the plurality of operations based on weights of the plurality of operations. Wherein the weight of the target operation is greater than the weight of the unselected operation in the plurality of operations.
307. And the computer equipment operates the plurality of feature identifications and the selected target to form a second image segmentation model.
After a target operation is determined between every two feature identifiers, a second image segmentation model can be formed based on the feature identifiers and the selected target operation, and the second image segmentation model comprises the feature identifiers and the target operation between every two feature identifiers. Because the target operation plays a great role in the image segmentation process, the target operation with the largest weight is selected from every two feature identifiers, so that the obtained second image segmentation model has the image segmentation capability, and the accuracy of the second image segmentation model is ensured.
It should be noted that in the embodiment of the present application, the target operation with the largest weight is determined for each two feature identifiers, and the target operation and the plurality of feature identifiers are used to form the second image segmentation model, but in another embodiment, the step 306 and the step 307 do not need to be executed, and the target operation between each two feature identifiers can be determined based on the weight of each operation in other manners, and the plurality of feature identifiers and the target operation are used to form the second image segmentation model.
308. The computer equipment acquires a third sample image, a third annotation image and a second contrast image, wherein the third annotation image indicates a segmented region in the third sample image, and the second contrast image is an image obtained by adding interference information in the third sample image.
This step is similar to step 304, and will not be described herein again.
309. And the computer equipment performs countermeasure training on the second image segmentation model based on the third sample image, the third annotation image and the second countermeasure image.
After the second image segmentation model is obtained, the second image segmentation model is subjected to countermeasure fine adjustment based on the third sample image, the third annotation image and the second countermeasure image, so that the accuracy of the second image segmentation model is further improved, the capability of the second image segmentation model for resisting attacks is improved, and the robustness of the second image segmentation model is further improved.
In one possible implementation, this step 309 includes: and performing countermeasure fine adjustment on the second image segmentation model based on the third sample image, the third annotation image and the second countermeasure image, and updating the weight of each target operation and the operation parameter corresponding to each target operation.
In one possible implementation manner, a plurality of third sample images and a plurality of second contrast images are obtained, the number of the third sample images is the same as that of the second contrast images, and the second image segmentation model is subjected to contrast fine adjustment based on the third sample images and the second contrast images.
The third sample image is different from the first sample image, and the procedure of performing countermeasure fine adjustment on the second image segmentation model is the same as the step 305, and is not described herein again.
310. And calling a second image segmentation model by the computer equipment to segment any image.
After the second image segmentation model is trained, the second image segmentation model is called, and any image can be segmented to obtain a segmented image of the image. For example, a medical image is segmented, resulting in a segmented image of the medical image, the segmented image indicating a region in the medical image where a lesion is located.
It should be noted that, in the embodiment of the present application, three training phases are included in the process of iteratively training the first image segmentation model.
And under the condition that the iteration times are not more than a first threshold value, a process of training the first image segmentation model is a first training stage, and only the operation parameters corresponding to each operation in the first image segmentation model are updated in the process. In the first training stage, one iteration of the first image segmentation model is realized based on one second sample image and the corresponding second labeled image each time, that is, according to the above-mentioned step 302 and step 303, multiple iterations of the first image segmentation model can be realized.
And under the condition that the iteration times are greater than the first threshold and less than the second threshold, training the first image segmentation model to be a second training stage, wherein the weight of each operation and the operation parameter corresponding to each operation in the first image segmentation model are trained. In the second training stage, one iteration of the first image segmentation model is realized based on one second sample image and the corresponding second labeled image each time, that is, according to the above-mentioned step 302 and step 303, multiple iterations of the first image segmentation model can be realized.
And under the condition that the iteration times are greater than the second threshold, training the first image segmentation model to be a third training stage, wherein the weight of each operation in the first image segmentation model and the operation parameter corresponding to each operation are trained. In the third training phase, one iteration of the first image segmentation model is realized each time based on one first sample image, the first annotation image corresponding to the first sample image, and the first contrast image corresponding to the first sample image, that is, according to step 304 and step 305, multiple iterations of the first image segmentation model can be realized.
The method provided by the embodiment of the application can be applied to various scenes such as cloud technology or intelligent traffic. For example, in a cloud technology scenario, the trained second image segmentation model is stored in a cloud server, so that other subsequent devices can access the second image segmentation model in the cloud server, and any image is segmented based on the second image segmentation model. For another example, in a smart traffic scene, an image captured by a vehicle is acquired, the image including an environment around the vehicle, and the image is segmented based on the second image segmentation model.
According to the method provided by the embodiment of the application, the first image segmentation model is trained in a countermeasure mode, then the second image segmentation model suitable for image segmentation is generated based on the trained first image segmentation model, the scheme that the image segmentation model is automatically obtained in a model searching mode is achieved, the network structure of the image segmentation model does not need to be designed manually in the process, the influence of human factors on the image segmentation model is weakened, and therefore the accuracy of the second image segmentation model is guaranteed. And the first image segmentation model is trained in a countermeasure mode to improve the accuracy and robustness of the first image segmentation model and ensure the accuracy and robustness of the acquired second image segmentation model, and the subsequent image segmentation is carried out based on the second image segmentation model to ensure the accuracy of the image segmentation.
And the first image segmentation model is trained in multiple stages, the first image segmentation model is trained on the basis of the second sample image and the second annotation image to preheat the first image segmentation model, the accuracy of the first image segmentation model is improved, then the first image segmentation model is subjected to countermeasure training, the accuracy of the first image segmentation model is further improved, and the capability of resisting countermeasure attack is further improved, so that the robustness of the first image segmentation model is improved, the accuracy and the robustness of the obtained second image segmentation model are ensured, and the accuracy of subsequent image segmentation is also ensured.
And after the second image segmentation model is obtained, the second image segmentation model is subjected to countermeasure training, so that the accuracy and robustness of the second image segmentation model are further improved, and the accuracy of subsequent image segmentation is ensured.
In the embodiment of the present application, a model search method, namely RobSearch (intelligent search algorithm), is provided, according to which a model for image segmentation can be automatically searched based on a hyper-network model, namely, a second image segmentation model is searched based on a first image segmentation model. In the searching process, the first image segmentation model is trained in a countercheck mode, and the mode of improving the countercheck attack resistance of the searched model in the model searching process is realized.
Based on the embodiment shown in fig. 3, a training process for a first image segmentation model is provided, which includes the following steps 1-4.
Step 1, obtaining a first image segmentation model, wherein the first image segmentation model is an initialized hyper-network model.
And 2, performing iterative training on the first image segmentation model according to the step 302 and the step 303 under the condition that the iteration number is not more than the first threshold value, and updating the operation parameters corresponding to each operation.
In the embodiment of the present application, the first threshold is 10, the second threshold is 50, and the total number of iterative training is 80.
And 3, performing iterative training on the first image segmentation model according to the step 302 and the step 303 when the iteration number is greater than the first threshold and not greater than the second threshold, and updating the operation parameters corresponding to each operation and the weight of each operation.
And 4, performing iterative training on the first image segmentation model according to the step 304 and the step 305 when the iteration number is greater than the second threshold, updating the operation parameters corresponding to each operation and the weight of each operation, stopping training the first image segmentation model when the iteration number is equal to the total iteration number, and then constructing a second image segmentation model according to the step 306 and the step 307.
In addition to the embodiment shown in fig. 2, the first image segmentation model and the second image segmentation model may be trained in multiple training stages based on sample images of multiple image categories, and after the second image segmentation model is obtained, the second image segmentation model is subjected to fine tuning training based on sample images of multiple image categories, and then the image is segmented based on the trained second image segmentation model.
Fig. 4 is a flowchart of an image segmentation method provided in an embodiment of the present application, which is executed by a computer device, and as shown in fig. 4, the method includes the following steps.
401. The computer device obtains a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers.
This step is similar to the step 301, and will not be described herein again.
402. The computer equipment acquires a plurality of second sample images and second annotation images corresponding to each second sample image, wherein the second annotation images indicate segmented areas in the second sample images, and the image categories of different second sample images are different.
In the embodiment of the present application, the sample image for training the first image segmentation model includes a plurality of image classes, and the image classes to which different second sample images belong are different. For example, in a medical scenario, the image categories include a brain category, a heart category, a skin category, etc., i.e., the second sample image belonging to a different image category contains different body parts. As another example, the image classes are indicative of different diseases, and the second sample image belonging to the different image classes is a medical image indicative of different diseases.
This step is similar to the step 302, and will not be described herein again.
403. And the computer equipment performs weighted fusion on the plurality of second sample images based on the weights of the plurality of second sample images to obtain a first fused sample image.
In the embodiment of the present application, the weights of the second sample images belonging to different image categories may be different, and optionally, the weight of each second sample image is randomly generated. The first fused sample image is a virtual sample image, that is, an image that does not exist actually, and the first fused sample image includes information included in the plurality of second sample images.
In a possible implementation manner, the weights of the plurality of second sample images are normalized, and the plurality of second sample images are weighted and fused based on the processed weights of the plurality of second sample images to obtain a first fused sample image. And normalizing the weights of the plurality of second sample images to ensure the accuracy of the obtained first fusion sample image.
404. And the computer equipment performs weighted fusion on the plurality of second labeled images based on the weights of the plurality of second sample images to obtain a first fused labeled image.
And the first fusion annotation image is an annotation image corresponding to the first fusion sample image. This step is similar to step 403, and will not be described herein again.
405. The computer device trains the first image segmentation model based on the first fusion sample image and the first fusion annotation image.
Because the first fusion sample image and the first fusion annotation image are both virtual images, the first image segmentation model is trained based on the first fusion sample image and the first fusion annotation image, the scheme of training the first image segmentation model by using the virtual images is realized, the generalization capability of the first image segmentation model is improved, and the first image segmentation model can be ensured to segment images belonging to various image categories. This step is similar to the step 303, and will not be described herein again.
406. The computer equipment acquires a plurality of first sample images, and a first annotation image and a first contrast image which correspond to each first sample image, wherein the image categories of different first sample images are different.
This step is similar to step 304, and will not be described herein again.
407. And the computer equipment performs weighted fusion on the plurality of first sample images based on the weights of the plurality of first sample images to obtain a second fused sample image.
In the embodiment of the present application, a fused sample image obtained by performing weighted fusion on a plurality of first sample images is referred to as a second fused sample image.
408. And the computer equipment performs weighted fusion on the plurality of first labeled images based on the weights of the plurality of first sample images to obtain a second fused labeled image.
In the embodiment of the present application, a fusion annotation image obtained by performing weighted fusion on a plurality of first annotation images is referred to as a second fusion annotation image, and the second fusion annotation image corresponds to the second fusion sample image.
409. And the computer equipment performs weighted fusion on the plurality of first antagonistic images based on the weights of the plurality of first sample images to obtain a first fused antagonistic image.
In the embodiment of the present application, a fusion countermeasure image obtained by performing weighted fusion on a plurality of first countermeasure images is referred to as a first fusion countermeasure image. The first fusion countermeasure image is a virtual sample image, i.e., an image that does not exist really, and includes information included in a plurality of first countermeasure images corresponding to the second fusion sample image.
The steps 407 and 409 are similar to the step 403, and are not described herein again.
410. And the computer equipment performs countermeasure training on the first image segmentation model based on the second fusion sample image, the second fusion annotation image and the second fusion countermeasure image to obtain the weight of each operation.
This step is similar to step 305 described above and will not be described herein again.
411. The computer equipment acquires a plurality of third sample images, and a third annotation image and a second contrast image corresponding to each third sample image, wherein the third annotation image indicates a segmented region in the third sample image, and the second contrast image is an image obtained by adding interference information in the third sample image.
412. And the computer equipment performs weighted fusion on the plurality of third sample images based on the weights of the plurality of third sample images to obtain third fused sample images.
413. And the computer equipment performs weighted fusion on the plurality of third labeled images based on the weights of the plurality of third sample images to obtain third fused labeled images.
414. And the computer equipment performs weighted fusion on the plurality of second antagonistic images based on the weights of the plurality of third sample images to obtain second fused antagonistic images.
415. And the computer equipment performs countermeasure training on the second image segmentation model based on the third fusion sample image, the third fusion annotation image and the second fusion countermeasure image.
The steps 411-415 are similar to the steps 406-410, and will not be described herein again.
416. And calling a second image segmentation model by the computer equipment to segment any image.
This step is similar to the step 310, and will not be described herein again.
According to the method provided by the embodiment of the application, the first image segmentation model is trained by using the sample images belonging to the multiple image categories, so that the scheme of training the first image segmentation model by using the virtual image is realized, the generalization capability of the first image segmentation model is improved, and the first image segmentation model can be ensured to segment the images belonging to the multiple image categories.
And the first image segmentation model is trained in multiple stages, the first image segmentation model is trained on the basis of the first fusion sample image and the first fusion annotation image to preheat the first image segmentation model and improve the accuracy of the first image segmentation model, and then the first image segmentation model is subjected to countermeasure training on the basis of the second fusion sample image, the second fusion annotation image and the second fusion countermeasure image to further improve the accuracy and the capability of resisting the countermeasure attack of the first image segmentation model, so that the robustness of the first image segmentation model is improved, the accuracy and the robustness of the obtained second image segmentation model are ensured, and the accuracy of subsequent image segmentation is also ensured.
And, by training the first image segmentation model or the second image segmentation model by using the virtual image, sample images of the trained image segmentation model can be enriched to ensure the generalization of the second image segmentation model on images with data scarcity and domain shift problems.
It should be noted that, in the above embodiment shown in fig. 3, each time the first image segmentation model or the second image segmentation model is trained iteratively, the training is performed by using a real image, for example, the real image is a first sample image, a second sample image, or a third sample image; while in the embodiment shown in fig. 4, each time the first image segmentation model or the second image segmentation model is trained iteratively, the virtual images are trained, for example, the virtual images are the first fused sample image, the second fused sample image or the third fused sample image, and in another embodiment, the embodiment shown in fig. 3 and the embodiment shown in fig. 4 can be combined. For example, when a first image segmentation model is trained for a plurality of iterations, both real images and virtual images are used; when the second image segmentation model is trained for multiple iterations, both real images and virtual images are used.
The method provided by the embodiment of the application can be applied to various scenes, such as a medical scene, a field biological image recognition scene, an automatic driving recognition scene and the like. After the second image segmentation model is acquired based on the image in any scene, the image in the scene can be segmented based on the second image segmentation model. The second image segmentation model searched by the application has stronger generalization performance on unseen data sets and stronger robustness against attacks, so the second image segmentation model is particularly suitable for complex scenes such as automatic driving and the like, such as various unpredictable scene images frequently occurring in automatic driving and the crisis of the attack resistance possibly encountered in the automatic driving process. Moreover, the method provided by the embodiment of the application can be further applied to the field of classification or detection, such as natural image classification, medical image classification and the like, and a model which has high normal image identification performance and good robustness to counterattack cannot be searched by utilizing a search algorithm after a deep learning service is deployed at a terminal in the future.
In addition, the operation in the first image segmentation model provided by the embodiment of the present application includes a hole convolution or average pooling operation, and the network structure of the first image segmentation model has a narrow width and a large depth, then the operation in the second image segmentation model includes a hole convolution or average pooling operation, and the network structure of the second image segmentation model has a narrow width and a large depth, so that the robustness of the second image segmentation model can be improved.
According to the method, the influence of different operations on robustness is verified, the jump connection is determined to have poor performance under the anti-attack condition, namely the jump connection can cause the robustness of the model to be reduced, and the verification process is as follows:
suppose that
Figure DEST_PATH_IMAGE050
In the form of a first image of the sample,
Figure DEST_PATH_IMAGE051
the first countermeasure image, i.e., the first sample image is an image in which there is no attack, the first countermeasure image is an image in which there is a countermeasure attack,
Figure DEST_PATH_IMAGE052
and
Figure DEST_PATH_IMAGE053
a segmented image corresponding to the first sample image and a segmented image corresponding to the first contrast image obtained based on the image segmentation model,
Figure DEST_PATH_IMAGE054
wherein, in the step (A),
Figure DEST_PATH_IMAGE055
is a constant in the lipschitz condition,
Figure DEST_PATH_IMAGE056
indicating the corresponding value of the norm. Identifying for each feature in an image segmentation model
Figure DEST_PATH_IMAGE057
Determining a signature
Figure 395566DEST_PATH_IMAGE057
Comprises the following steps:
Figure DEST_PATH_IMAGE058
wherein the characteristic marks
Figure DEST_PATH_IMAGE059
Identifying to a feature
Figure 939810DEST_PATH_IMAGE057
The characteristics of the input are used as input,
Figure DEST_PATH_IMAGE060
as a characteristic of the input, the input is,
Figure DEST_PATH_IMAGE061
for marking features
Figure 11803DEST_PATH_IMAGE059
And features ofIdentification
Figure 297291DEST_PATH_IMAGE057
The operation in (1);
Figure DEST_PATH_IMAGE062
in order for the parameters to be learnable,
Figure DEST_PATH_IMAGE063
representing a feature identifier
Figure 909669DEST_PATH_IMAGE059
The characteristics of the output are such that,
Figure DEST_PATH_IMAGE064
the strength of the attack is indicated and,
Figure DEST_PATH_IMAGE065
representing a feature identifier
Figure 323069DEST_PATH_IMAGE059
Identifying to a feature
Figure 34804DEST_PATH_IMAGE057
The fluctuation of the input characteristic is within the allowable interference range. Hypothesis mapping feature identification
Figure 604325DEST_PATH_IMAGE059
To the feature identification
Figure 410607DEST_PATH_IMAGE057
A function of
Figure DEST_PATH_IMAGE066
Then, then
Figure DEST_PATH_IMAGE067
Figure DEST_PATH_IMAGE068
For marking features
Figure 211335DEST_PATH_IMAGE057
A characteristic of the output. Using the following formula, a signature can be obtained
Figure 812081DEST_PATH_IMAGE057
Feature identification input therein
Figure 72161DEST_PATH_IMAGE059
Robustness change due to small interference:
Figure DEST_PATH_IMAGE069
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE070
in order to be of a non-aggressive nature,
Figure DEST_PATH_IMAGE071
for marking features
Figure 820150DEST_PATH_IMAGE057
The non-aggressive nature of the output is,
Figure DEST_PATH_IMAGE072
in order to be characterized as an attack,
Figure DEST_PATH_IMAGE073
representing a feature identifier
Figure 193493DEST_PATH_IMAGE057
The characteristics of the output which are attacked,
Figure DEST_PATH_IMAGE074
the value to which the norm corresponds is indicated,
Figure DEST_PATH_IMAGE075
representing a feature identifier
Figure 840506DEST_PATH_IMAGE059
Identifying to a feature
Figure 73036DEST_PATH_IMAGE057
The fluctuation of the input characteristic is within the allowable interference range,
Figure DEST_PATH_IMAGE076
for marking features
Figure 752279DEST_PATH_IMAGE057
Constants in the lipschitz condition, satisfy
Figure DEST_PATH_IMAGE077
Figure DEST_PATH_IMAGE078
And
Figure DEST_PATH_IMAGE079
are respectively a function
Figure 514217DEST_PATH_IMAGE066
And feature identification
Figure 738656DEST_PATH_IMAGE059
The constants in the lipschitz condition,
Figure DEST_PATH_IMAGE080
for marking features
Figure 35645DEST_PATH_IMAGE059
The non-aggressive nature of the output is,
Figure DEST_PATH_IMAGE081
representing a feature identifier
Figure 3732DEST_PATH_IMAGE059
And outputting the attacked characteristic.
Since the skip-connection residual learning branch of the residual block performs its sum with the original input, the Lipschitz constant of the skip-connection is 1, and the Lipschitz constant of the residual learning branch is positive, and thus, there is an identity operationThe Lipschitz constant of the network is
Figure DEST_PATH_IMAGE082
. In addition, since the Lipschitz constant of the image segmentation model is larger than 1, the Lipschitz constant increases exponentially with the network depth. If multiple jump connection layers are stacked, Identity (an operation) will result in poor robustness of the image segmentation model, which is broken by combining convex functions over the jump connections, in such a way as to improve the robustness of the model. In addition, the attention convolution is more robust than the jump connection, and the maximum pooling is less robust than the average pooling.
In addition, the effect of different operations on robustness was verified on the enteroscopy dataset, as shown in table 1, where the first performance index is Dice (coefficient of Dice) and the second performance index is Jc (coefficient of Jc). As can be seen from table 1, in the downlink operation, the robustness of the maximum pooling operation is poor, and the robustness of the average pooling operation is good. In the uplink operation, it is noted that the robustness of the convolution operation is better than that of other operations, the robustness of the jump connection, the attention jump connection, the deep separable convolution and the random packet convolution is poor, and the robustness of the hole convolution is the best, probably because the hole convolution has a larger receptive field and can be combined with more information to defend against attacks.
Figure DEST_PATH_IMAGE083
TABLE 1
The application also verifies the influence of the depth and the width of the image segmentation model on robustness, and four types of units are adopted to check the robust connection mode as shown in FIG. 5. Each cell in fig. 5 has three sets of signatures from top to bottom, including input, intermediate and output signatures. The width of a cell is defined as the maximum intermediate feature identifier number with the same input, and the depth of a cell is defined as the internal feature identifier number on the longest connecting path. For example, the width and depth of the cell 1 are 4 and 1, respectively. It is easy to find that the connection pattern from cell 1 to cell 4 is deeper and narrower. As can be seen from verification, the smaller the width and the greater the depth of the image segmentation model, the better the robustness of the image segmentation model.
In addition, on the enteroscopy dataset, the effect of the width and depth of the image segmentation model on robustness was verified, as shown in fig. 6 and table 2. Based on fig. 6 and table 2, it can be seen that the image segmentation model gradually improves in accuracy and becomes better and better in robustness from shallow to deep (i.e., from unit 1 to unit 4). Therefore, a trade-off is made between accuracy and robustness, and a deeper and narrower image segmentation model with robust operation can obtain good generalization capability.
Figure DEST_PATH_IMAGE084
TABLE 2
The image segmentation model obtained based on the model search method provided in the embodiment of the present application is compared with the image segmentation model provided in the related art on different datasets, for example, a skin cancer dataset, an enteroscopy dataset, and a CT (Computed Tomography) dataset. As shown in table 3, the clean image is an image without the interference information added, i.e., an original image. Based on the data in table 3, it can be known that the image segmentation model obtained by the model search method provided by the present application has good segmentation performance and has stronger capability of resisting counterattack, that is, the image segmentation model in the embodiment of the present application has better accuracy and robustness.
Figure DEST_PATH_IMAGE085
TABLE 3
Based on the method provided by the embodiment of the application, after the second image segmentation model is obtained based on the first image segmentation model, the second image segmentation model is subjected to confrontation training on the enteroscope data set, and the second image segmentation model after the confrontation training is compared with the image segmentation model provided in the related technology. When the second image segmentation model is subjected to countermeasure training, the proportion of the countermeasure image to the clean image is 1: 1. As shown in table 4, the clean image is an image without adding the interference information, and the countermeasure image 1, the countermeasure image 2, and the countermeasure image 3 are generated by different tools. By comparison, the method provided by the embodiment of the application has the best performance on the clean image and the counterattack image, namely the method provided by the embodiment of the application can achieve good accuracy and robustness at the same time, and has strong generalization performance on a multi-field small sample data set with counterattack.
Figure DEST_PATH_IMAGE086
TABLE 4
Fig. 7 is a schematic structural diagram of an image segmentation apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus includes:
an obtaining module 701, configured to obtain a first image segmentation model, where the first image segmentation model includes a plurality of feature identifiers and a plurality of operations between every two feature identifiers;
the obtaining module 701 is further configured to obtain a first sample image, a first labeled image and a first contrast image, where the first labeled image indicates a region segmented in the first sample image, and the first contrast image is an image obtained by adding interference information to the first sample image;
a training module 702, configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image, to obtain a weight of each operation in the first image segmentation model;
a forming module 703, configured to determine, based on the weight of each operation, a target operation between every two feature identifiers, and form a second image segmentation model by using the plurality of feature identifiers and the target operation;
and the segmentation module 704 is used for calling a second image segmentation model to segment any image.
In a possible implementation manner, the obtaining module 701 is configured to obtain a plurality of first sample images, and a first annotation image and a first contrast image corresponding to each first sample image, where image categories of different first sample images are different;
a training module 702, configured to perform weighted fusion on the multiple first sample images based on weights of the multiple first sample images to obtain a fused sample image; performing weighted fusion on the plurality of first annotation images based on the weights of the plurality of first sample images to obtain a fused annotation image; carrying out weighted fusion on the plurality of first countermeasure images based on the weights of the plurality of first sample images to obtain a fused countermeasure image; and performing countermeasure training on the first image segmentation model based on the fusion sample image, the fusion annotation image and the fusion countermeasure image to obtain the weight of each operation.
In another possible implementation manner, the training module 702 is configured to invoke a first image segmentation model, and perform image segmentation on the first sample image and the first contrast image respectively to obtain a first prediction segmentation image of the first sample image and a second prediction segmentation image of the first contrast image; and performing countermeasure training on the first image segmentation model based on the difference between the first prediction segmentation image and the first annotation image and the difference between the first prediction segmentation image and the second prediction segmentation image to obtain the weight of each operation.
In another possible implementation manner, the training module 702 is configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image, to obtain a weight of each operation and an operation parameter corresponding to each operation.
In another possible implementation manner, the obtaining module 701 is further configured to obtain a second sample image and a second annotation image, where the second annotation image indicates a segmented region in the second sample image;
the training module 702 is further configured to train the first image segmentation model based on the second sample image and the second labeled image.
In another possible implementation manner, the training module 702 is configured to train the first image segmentation model based on the second sample image and the second annotation image and update the operation parameter corresponding to each operation when the current iteration number is not greater than the first threshold; and under the condition that the current iteration number is greater than a first threshold and not greater than a second threshold, training the first image segmentation model based on the second sample image and the second annotation image, updating the weight of each operation and the operation parameter corresponding to each operation, wherein the second threshold is greater than the first threshold.
In another possible implementation manner, the training module 702 is configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image to obtain a weight of each operation when the current iteration number is greater than the second threshold.
In another possible implementation manner, the module 703 is configured to, for a plurality of operations between every two feature identifiers, select, based on weights of the plurality of operations, at least one target operation with a largest weight from the plurality of operations; and operating the plurality of feature identifications and the selected target to form a second image segmentation model.
In another possible implementation manner, the obtaining module 701 is further configured to obtain a third sample image, a third annotation image, and a second contrast image, where the third annotation image indicates a segmented region in the third sample image, and the second contrast image is an image obtained after the interference information is added in the third sample image;
the training module 702 is further configured to perform countermeasure training on the second image segmentation model based on the third sample image, the third annotation image, and the second countermeasure image.
It should be noted that: the image segmentation apparatus provided in the above embodiment is only illustrated by dividing the functional modules, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the image segmentation apparatus and the image segmentation method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments in detail and are not described herein again.
The embodiment of the present application further provides a computer device, which includes a processor and a memory, where the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the image segmentation method of the foregoing embodiment.
Optionally, the computer device is provided as a terminal. Fig. 8 shows a block diagram of a terminal 800 according to an exemplary embodiment of the present application. The terminal 800 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The terminal 800 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
The terminal 800 includes: a processor 801 and a memory 802.
The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 801 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit) which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 801 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 802 may include one or more computer-readable storage media, which may be non-transitory. Memory 802 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 802 is used to store at least one computer program for execution by the processor 801 to implement the image segmentation methods provided by the method embodiments herein.
In some embodiments, the terminal 800 may further include: a peripheral interface 803 and at least one peripheral. The processor 801, memory 802 and peripheral interface 803 may be connected by bus or signal lines. Various peripheral devices may be connected to peripheral interface 803 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, a positioning assembly 808, and a power supply 809.
The peripheral interface 803 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, memory 802, and peripheral interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral interface 803 may be implemented on separate chips or circuit boards, which are not limited by this embodiment.
The Radio Frequency circuit 804 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 804 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 804 converts an electrical signal into an electromagnetic signal to be transmitted, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 804 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 804 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 805 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 805 is a touch display, the display 805 also has the ability to capture touch signals on or above the surface of the display 805. The touch signal may be input to the processor 801 as a control signal for processing. At this point, the display 805 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 805 may be one, disposed on a front panel of the terminal 800; in other embodiments, the display 805 may be at least two, respectively disposed on different surfaces of the terminal 800 or in a folded design; in other embodiments, the display 805 may be a flexible display disposed on a curved surface or a folded surface of the terminal 800. Even further, the display 805 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The Display 805 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 806 is used to capture images or video. Optionally, camera assembly 806 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 806 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 807 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 801 for processing or inputting the electric signals to the radio frequency circuit 804 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 800. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 807 may also include a headphone jack.
The positioning component 808 is used to locate the current geographic position of the terminal 800 for navigation or LBS (Location Based Service). The Positioning component 808 may be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 809 is used to provide power to various components in terminal 800. The power supply 809 can be ac, dc, disposable or rechargeable. When the power supply 809 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 800 also includes one or more sensors 810. The one or more sensors 810 include, but are not limited to: acceleration sensor 811, gyro sensor 812, pressure sensor 813, fingerprint sensor 814, optical sensor 815 and proximity sensor 816.
The acceleration sensor 811 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 800. For example, the acceleration sensor 811 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 801 may control the display 805 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 812 may detect a body direction and a rotation angle of the terminal 800, and the gyro sensor 812 may cooperate with the acceleration sensor 811 to acquire a 3D motion of the user with respect to the terminal 800. From the data collected by the gyro sensor 812, the processor 801 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 813 may be disposed on the side frames of terminal 800 and/or underneath display 805. When the pressure sensor 813 is disposed on the side frame of the terminal 800, the holding signal of the user to the terminal 800 can be detected, and the processor 801 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is disposed at a lower layer of the display screen 805, the processor 801 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 805. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 814 is used for collecting a fingerprint of the user, and the processor 801 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, the processor 801 authorizes the user to perform relevant sensitive operations including unlocking a screen, viewing encrypted information, downloading software, paying for and changing settings, etc. Fingerprint sensor 814 may be disposed on the front, back, or side of terminal 800. When a physical button or a vendor Logo is provided on the terminal 800, the fingerprint sensor 814 may be integrated with the physical button or the vendor Logo.
The optical sensor 815 is used to collect the ambient light intensity. In one embodiment, processor 801 may control the display brightness of display 805 based on the ambient light intensity collected by optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display 805 is reduced. In another embodiment, the processor 801 may also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 815.
A proximity sensor 816, also called a distance sensor, is provided on the front panel of the terminal 800. The proximity sensor 816 is used to collect the distance between the user and the front surface of the terminal 800. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 gradually decreases, the processor 801 controls the display 805 to switch from the bright screen state to the dark screen state; when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 becomes gradually larger, the display 805 is controlled by the processor 801 to switch from the breath-screen state to the bright-screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 8 is not intended to be limiting of terminal 800 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Optionally, the computer device is provided as a server. Fig. 9 is a schematic structural diagram of a server provided in this embodiment of the present application, where the server 900 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 901 and one or more memories 902, where the memory 902 stores at least one computer program, and the at least one computer program is loaded and executed by the processors 901 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
The embodiment of the present application further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor to implement the operations performed in the image segmentation method of the foregoing embodiment.
Embodiments of the present application further provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the operations performed in the image segmentation method according to the foregoing embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an alternative embodiment of the present application and should not be construed as limiting the present application, and any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (13)

1. A method of image segmentation, the method comprising:
acquiring a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers;
acquiring a first sample image, a first annotation image and a first contrast image, wherein the first annotation image indicates a segmented region in the first sample image, and the first contrast image is an image obtained by adding interference information in the first sample image;
performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain a weight of each operation in the first image segmentation model;
determining target operation between every two feature identifiers based on the weight of each operation, and forming a second image segmentation model by using a plurality of feature identifiers and the target operation;
and calling the second image segmentation model to segment any image.
2. The method of claim 1, wherein the obtaining the first sample image, the first annotation image, and the first contrast image comprises:
acquiring a plurality of first sample images, and a first annotation image and a first contrast image corresponding to each first sample image, wherein the image types of different first sample images are different;
performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain a weight of each operation in the first image segmentation model, including:
weighting and fusing the plurality of first sample images based on the weights of the plurality of first sample images to obtain fused sample images;
weighting and fusing the first annotation images based on the weights of the first sample images to obtain a fused annotation image;
weighting and fusing the first countermeasure images based on the weights of the first sample images to obtain a fused countermeasure image;
and performing countermeasure training on the first image segmentation model based on the fusion sample image, the fusion annotation image and the fusion countermeasure image to obtain the weight of each operation.
3. The method of claim 1, wherein performing a countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image to obtain a weight for each operation in the first image segmentation model comprises:
calling the first image segmentation model, and respectively carrying out image segmentation on the first sample image and the first contrast image to obtain a first prediction segmentation image of the first sample image and a second prediction segmentation image of the first contrast image;
and performing countermeasure training on the first image segmentation model based on the difference between the first prediction segmentation image and the first annotation image and the difference between the first prediction segmentation image and the second prediction segmentation image to obtain the weight of each operation.
4. The method of claim 1, wherein performing a countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image to obtain a weight for each operation in the first image segmentation model comprises:
and performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation and the operation parameter corresponding to each operation.
5. The method of claim 1, wherein prior to the obtaining the first sample image, the first annotation image, and the first contrast image, the method further comprises:
acquiring a second sample image and a second annotation image, wherein the second annotation image indicates a segmented region in the second sample image;
and training the first image segmentation model based on the second sample image and the second labeled image.
6. The method of claim 5, wherein training the first image segmentation model based on the second sample image and the second annotation image comprises:
under the condition that the current iteration number is not larger than a first threshold value, training the first image segmentation model based on the second sample image and the second annotation image, and updating an operation parameter corresponding to each operation;
and training the first image segmentation model based on the second sample image and the second labeled image under the condition that the current iteration number is greater than the first threshold and not greater than a second threshold, updating the weight of each operation and the operation parameter corresponding to each operation, wherein the second threshold is greater than the first threshold.
7. The method of claim 6, wherein performing a countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image to obtain a weight for each operation in the first image segmentation model comprises:
and performing countermeasure training on the first image segmentation model based on the first sample image, the first annotation image and the first countermeasure image to obtain the weight of each operation under the condition that the current iteration number is greater than the second threshold value.
8. The method according to claim 1, wherein the determining a target operation between every two feature identifiers based on the weight of each operation, and constructing a second image segmentation model by using a plurality of feature identifiers and the target operation comprises:
for a plurality of operations between every two feature identifiers, selecting at least one target operation with the maximum weight from the plurality of operations based on the weights of the plurality of operations;
and operating the plurality of feature identifications and the selected target to form the second image segmentation model.
9. The method of claim 1, wherein said invoking said second image segmentation model further comprises, prior to segmenting any image:
acquiring a third sample image, a third annotation image and a second contrast image, wherein the third annotation image indicates a segmented region in the third sample image, and the second contrast image is an image obtained by adding interference information in the third sample image;
performing countermeasure training on the second image segmentation model based on the third sample image, the third annotation image, and the second countermeasure image.
10. An image segmentation apparatus, characterized in that the apparatus comprises:
the image segmentation method comprises the steps of obtaining a first image segmentation model, wherein the first image segmentation model comprises a plurality of feature identifiers and a plurality of operations between every two feature identifiers;
the obtaining module is further configured to obtain a first sample image, a first annotation image, and a first contrast image, where the first annotation image indicates a region segmented in the first sample image, and the first contrast image is an image obtained by adding interference information to the first sample image;
a training module, configured to perform countermeasure training on the first image segmentation model based on the first sample image, the first annotation image, and the first countermeasure image, to obtain a weight of each operation in the first image segmentation model;
the composition module is used for determining target operation between every two feature identifiers based on the weight of each operation and forming a second image segmentation model by using a plurality of feature identifiers and the target operation;
and the segmentation module is used for calling the second image segmentation model to segment any image.
11. A computer device, characterized in that the computer device comprises a processor and a memory, in which at least one computer program is stored, which is loaded and executed by the processor to implement the operations performed in the image segmentation method according to any one of claims 1 to 9.
12. A computer-readable storage medium, having stored thereon at least one computer program, which is loaded into and executed by a processor, to perform the operations performed in the image segmentation method according to any one of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, is adapted to carry out the operations being performed in the image segmentation method according to any one of claims 1 to 9.
CN202111123936.XA 2021-09-24 2021-09-24 Image segmentation method and device, computer equipment and storage medium Active CN113569822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111123936.XA CN113569822B (en) 2021-09-24 2021-09-24 Image segmentation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111123936.XA CN113569822B (en) 2021-09-24 2021-09-24 Image segmentation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113569822A true CN113569822A (en) 2021-10-29
CN113569822B CN113569822B (en) 2021-12-21

Family

ID=78174402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111123936.XA Active CN113569822B (en) 2021-09-24 2021-09-24 Image segmentation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113569822B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115171190A (en) * 2022-07-23 2022-10-11 贵州华数云谷科技有限公司 Virtual image generation and fusion method for face recognition

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109272031A (en) * 2018-09-05 2019-01-25 宽凳(北京)科技有限公司 A kind of training sample generation method and device, equipment, medium
US20190295302A1 (en) * 2018-03-22 2019-09-26 Northeastern University Segmentation Guided Image Generation With Adversarial Networks
CN110796199A (en) * 2019-10-30 2020-02-14 腾讯科技(深圳)有限公司 Image processing method and device and electronic medical equipment
CN111695596A (en) * 2020-04-30 2020-09-22 华为技术有限公司 Neural network for image processing and related equipment
CN111754532A (en) * 2020-08-12 2020-10-09 腾讯科技(深圳)有限公司 Image segmentation model searching method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190295302A1 (en) * 2018-03-22 2019-09-26 Northeastern University Segmentation Guided Image Generation With Adversarial Networks
CN109272031A (en) * 2018-09-05 2019-01-25 宽凳(北京)科技有限公司 A kind of training sample generation method and device, equipment, medium
CN110796199A (en) * 2019-10-30 2020-02-14 腾讯科技(深圳)有限公司 Image processing method and device and electronic medical equipment
CN111695596A (en) * 2020-04-30 2020-09-22 华为技术有限公司 Neural network for image processing and related equipment
CN111754532A (en) * 2020-08-12 2020-10-09 腾讯科技(深圳)有限公司 Image segmentation model searching method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115171190A (en) * 2022-07-23 2022-10-11 贵州华数云谷科技有限公司 Virtual image generation and fusion method for face recognition

Also Published As

Publication number Publication date
CN113569822B (en) 2021-12-21

Similar Documents

Publication Publication Date Title
CN111091132B (en) Image recognition method and device based on artificial intelligence, computer equipment and medium
CN111091166B (en) Image processing model training method, image processing device, and storage medium
CN111489378B (en) Video frame feature extraction method and device, computer equipment and storage medium
CN112598686B (en) Image segmentation method and device, computer equipment and storage medium
CN110544272A (en) face tracking method and device, computer equipment and storage medium
CN111104980B (en) Method, device, equipment and storage medium for determining classification result
CN112749613B (en) Video data processing method, device, computer equipment and storage medium
CN108320756B (en) Method and device for detecting whether audio is pure music audio
CN114332530A (en) Image classification method and device, computer equipment and storage medium
CN113610750A (en) Object identification method and device, computer equipment and storage medium
CN113395542A (en) Video generation method and device based on artificial intelligence, computer equipment and medium
CN112749728A (en) Student model training method and device, computer equipment and storage medium
CN114283050A (en) Image processing method, device, equipment and storage medium
CN110570460A (en) Target tracking method and device, computer equipment and computer readable storage medium
CN110675412A (en) Image segmentation method, training method, device and equipment of image segmentation model
CN111178343A (en) Multimedia resource detection method, device, equipment and medium based on artificial intelligence
CN113724189A (en) Image processing method, device, equipment and storage medium
CN113569822B (en) Image segmentation method and device, computer equipment and storage medium
CN114283299A (en) Image clustering method and device, computer equipment and storage medium
CN113822263A (en) Image annotation method and device, computer equipment and storage medium
CN114281936A (en) Classification method and device, computer equipment and storage medium
CN113570510A (en) Image processing method, device, equipment and storage medium
CN113763931A (en) Waveform feature extraction method and device, computer equipment and storage medium
CN112528760A (en) Image processing method, image processing apparatus, computer device, and medium
CN112818979A (en) Text recognition method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40053650

Country of ref document: HK