CN108509958A - Defect type detection method, defect type detection device, electronic equipment and medium - Google Patents
Defect type detection method, defect type detection device, electronic equipment and medium Download PDFInfo
- Publication number
- CN108509958A CN108509958A CN201810276600.9A CN201810276600A CN108509958A CN 108509958 A CN108509958 A CN 108509958A CN 201810276600 A CN201810276600 A CN 201810276600A CN 108509958 A CN108509958 A CN 108509958A
- Authority
- CN
- China
- Prior art keywords
- detected
- target
- defect type
- color image
- convolutional neural
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
Abstract
The embodiment of the invention provides a defect type detection method, a defect type detection device, electronic equipment and a defect type detection medium, wherein the method comprises the following steps: acquiring the byte code of an object to be detected, wherein the object to be detected comprises: a program written based on a preset programming language; acquiring a color image to be detected corresponding to the target to be detected based on the acquired bytecode of the target to be detected; determining whether the target to be detected has defects or not based on the obtained color image to be detected and a preset defect type detection model, and determining the defect type corresponding to the target to be detected when the defects are determined, wherein the preset defect type detection model comprises the following steps: including the correspondence of each defect type to the image feature. Whether the program to be detected has defects or not is detected, and further, when the program to be detected has defects, the defect type is detected.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of defect type detection method, device, electronic equipment
And medium.
Background technology
In some situations, some are write completion program be deployed to corresponding system after, when the above-mentioned journey for writing completion
When sequence existing defects, the system based on the above-mentioned program for writing completion of the deployment carries out having security risk when corresponding operating.
For example, the above-mentioned program for writing completion is the intelligent contract on block chain, when the intelligent contract there will be defect is deployed in block
After chain, trading activity caused by the block chain based on the deployment intelligence contract is likely to occur the case where can not being repaired, such as:
After block chain initiation moneytary operations of the initiator person that merchandises based on the above-mentioned deployment intelligence contract, even if the friendship of the moneytary operations
Easy recipient is wrong, which can not be withdrawn.The above situation so that it is hidden that the transaction in block chain has safety
Suffer from.As it can be seen that before disposing some and writing the program of completion, it is most important to the analysis of the correctness of above procedure, in a side
In face, the detection to the defect of above procedure, and type to existing defect detection, to the correct of intelligence above procedure
It is most important in the analytic process of property.
So, how before disposing above procedure, determine program whether there is defect, and then determine defect type at
For urgent problem to be solved.
Invention content
The embodiment of the present invention is designed to provide a kind of defect type detection method, device, electronic equipment and medium, with
The problem of solving how before disposing above procedure, determining that program whether there is defect, and then determine the type of defect.Specifically
Technical solution is as follows:
In a first aspect, an embodiment of the present invention provides a kind of defect type detection method, the method includes:
Obtain the bytecode of target to be detected, wherein the target to be detected is:It is write based on default programming language
Program;
Based on the bytecode of the target to be detected obtained, the corresponding chromaticity diagram to be detected of the target to be detected is obtained
Picture;
Based on the color image to be detected and preset defect type detection model obtained, the mesh to be detected is determined
Mark whether there is defect, and when determining existing defects, determine the corresponding defect type of the target to be detected, wherein described
Preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
Optionally, the default programming language includes solidity language, and the target to be detected includes intelligent contract.
Optionally, the bytecode of the target to be detected is a string of character strings;
The bytecode based on the target to be detected obtained obtains the corresponding color to be detected of the target to be detected
Image, including:
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of the target to be detected.
Optionally, the preset defect type detection model is preset convolutional neural networks model;
Described based on the color image to be detected obtained and preset defect type detection model, determine described in wait for
It detects target and whether there is defect, and when determining existing defects, before determining the corresponding defect type of the target to be detected,
The method further includes:
Establish the process of the preset convolutional neural networks model, wherein the process includes:
Obtain initial convolutional neural networks model;
Obtain the bytecode of multiple sample objects, wherein the sample object is:It is compiled based on the default programming language
The program write;
Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
Obtain the corresponding calibration information of each sample color image, wherein the calibration information includes:Corresponding sample color
Coloured picture is as corresponding defect type, as prediction defect type;
Based on being wrapped in each sample color image and the corresponding calibration information of each sample color image obtained
The prediction defect type included, the training initial convolutional neural networks model, obtains preset convolutional neural networks model.
Optionally, the initial convolutional neural networks model includes feature extraction layer and tagsort layer;
It is described based in each sample color image obtained and the corresponding calibration information of each sample color image
Included prediction defect type, the training initial convolutional neural networks model, obtains preset convolutional neural networks mould
Type, including:
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
Optionally, described based on each sample color image obtained and the corresponding mark of each sample color image
Determine prediction defect type included in information, the training initial convolutional neural networks model obtains preset convolution god
After network model, the method further includes:
Based on default testing process, the accuracy of the definitive result of the preset convolutional neural networks model is detected, is obtained
Obtain testing result;
Obtain the adjust instruction for the testing result, wherein the adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model.
Optionally, described based on the color image to be detected obtained and preset defect type detection model, it determines
The target to be detected whether there is defect, and when determining existing defects, determine the corresponding defect class of the target to be detected
Type, including:
The color image to be detected is inputted into the preset convolutional neural networks model, the preset convolutional Neural
Network model extracts image to be detected feature of the color image to be detected;And it is special based on the described image to be detected extracted
Sign determines that the target to be detected whether there is defect, and when determining the target existing defects to be detected, is waited for described in determination
Detect the corresponding defect type of target.
Optionally, the bytecode for obtaining target to be detected, including:
It obtains and the detection that the target to be detected is detected is instructed, wherein the detection instruction includes described to be checked
Survey the bytecode of target;
Based on the detection instruction obtained, the bytecode of the target to be detected is obtained.
Second aspect, an embodiment of the present invention provides a kind of defect type detection device, described device includes:
First obtains module, the bytecode for obtaining target to be detected, wherein the target to be detected is:Based on pre-
If the program that programming language is write;
Second obtains module, for the bytecode based on the target to be detected obtained, obtains the target pair to be detected
The color image to be detected answered;
Determining module, for based on the color image to be detected and preset defect type detection model obtained, really
The fixed target to be detected whether there is defect, and when determining existing defects, determine the corresponding defect of the target to be detected
Type, wherein the preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
Optionally, the default programming language includes solidity language, and the target to be detected includes intelligent contract.
Optionally, the bytecode of the target to be detected is a string of character strings;
Described second obtains module, is specifically used for
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of the target to be detected.
Optionally, the preset defect type detection model is preset convolutional neural networks model;
Described device further includes:
Model building module, for being examined based on the color image to be detected obtained and preset defect type described
Model is surveyed, determines that the target to be detected whether there is defect, and when determining existing defects, determine the target pair to be detected
Before the defect type answered, the preset convolutional neural networks model is established, wherein the model building module includes:
Second obtaining unit, for obtaining initial convolutional neural networks model;
Third obtaining unit, the bytecode for obtaining multiple sample objects, wherein the sample object is:Based on institute
State the program that default programming language is write;
4th obtaining unit is used for the bytecode based on each sample object, obtains the corresponding sample of each sample object
Color image;
5th obtaining unit, for obtaining the corresponding calibration information of each sample color image, wherein the calibration information
Including:The corresponding defect type of corresponding sample color image, as prediction defect type;
Training obtains unit, for based on each sample color image obtained and each sample color image correspondence
Calibration information in included prediction defect type, the training initial convolutional neural networks model obtains preset volume
Product neural network model.
Optionally, the initial convolutional neural networks model includes feature extraction layer and tagsort layer;
The training obtains unit, is specifically used for
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
Optionally, the model building module further includes:
Detection unit, for described based on each sample color image obtained and each sample color image pair
Included prediction defect type in the calibration information answered, the training initial convolutional neural networks model, obtains preset
After convolutional neural networks model, based on default testing process, that detects the preset convolutional neural networks model determines knot
The accuracy of fruit obtains testing result;
6th obtaining unit, for obtaining the adjust instruction for the testing result, wherein the adjust instruction carries
Required adjustment result;
Adjustment unit, for based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model
It is whole.
Optionally, the determining module, is specifically used for
The color image to be detected is inputted into the preset convolutional neural networks model, the preset convolutional Neural
Network model extracts image to be detected feature of the color image to be detected;And it is special based on the described image to be detected extracted
Sign determines that the target to be detected whether there is defect, and when determining the target existing defects to be detected, is waited for described in determination
Detect the corresponding defect type of target.
Optionally, described first module is obtained, be specifically used for
It obtains and the detection that the target to be detected is detected is instructed, wherein the detection instruction includes described to be checked
Survey the bytecode of target;
Based on the detection instruction obtained, the bytecode of the target to be detected is obtained.
The third aspect, an embodiment of the present invention provides a kind of electronic equipment, including processor, communication interface, memory and
Communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the computer program stored on memory, realizes what the embodiment of the present invention was provided
Any of the above-described defect type detection method step.
Fourth aspect, an embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Dielectric memory contains computer program, and it is upper to realize that the embodiment of the present invention is provided when the computer program is executed by processor
State any defect type detection method step.
5th aspect, an embodiment of the present invention provides a kind of computer programs, wherein the computer program is by processor
Any of the above-described defect type detection method step that the embodiment of the present invention is provided is realized when execution.
In the embodiment of the present invention, the bytecode of target to be detected is obtained, wherein above-mentioned target to be detected is:Based on default
The program that programming language is write;Based on the bytecode of the target to be detected obtained, it is corresponding to be checked to obtain target to be detected
Survey color image;Based on the color image to be detected and preset defect type detection model obtained, mesh to be detected is determined
Mark whether there is defect, and when determining existing defects, determine the corresponding defect type of target to be detected, wherein preset to lack
Fall into type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type, to solve how in deployment
Before stating program, the problem of determining that program whether there is defect, and then determine the type of defect.Certainly, implement appointing for the present invention
One product or method must be not necessarily required to reach all the above advantage simultaneously.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Obtain other attached drawings according to these attached drawings.
A kind of flow diagram for defect type detection method that Fig. 1 is provided by the embodiment of the present invention;
A kind of flow diagram for establishing preset convolutional neural networks model that Fig. 2 is provided by the embodiment of the present invention;
A kind of structural schematic diagram for defect type detection device that Fig. 3 is provided by the embodiment of the present invention;
A kind of structural schematic diagram for the model building module that Fig. 4 is provided by the embodiment of the present invention;
The structural schematic diagram for a kind of electronic equipment that Fig. 5 is provided by the embodiment of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a kind of defect type detection method, device, electronic equipment and medium, with solve how
Before disposing above procedure, the problem of determining that program whether there is defect, and then determine the type of defect.
As shown in Figure 1, an embodiment of the present invention provides a kind of defect type detection method, this method includes:
S101:Obtain the bytecode of target to be detected;
Wherein, above-mentioned target to be detected is:The program write based on default programming language;Wherein, above-mentioned default programming
Language can be solidity language and Javascript language etc..
It is understood that the defect type detection method that the embodiment of the present invention is provided, can be applied to any electronics
In equipment, above-mentioned electronic equipment can be computer and smart mobile phone etc..Realize the defect type that the embodiment of the present invention is provided
The functional software of detection method can exist in the form of special client software, can also be with the plug-in unit of client software
Form exists.
In the embodiment of the present invention, above-mentioned electronic equipment can directly obtain the bytecode of above-mentioned target to be detected
(Bytecode), for example, after receiving specific instruction, that is, the bytecode of target to be detected is obtained.In oneainstance, above-mentioned
Electronic equipment can be server, and above-mentioned server can receive the inspection about target to be detected that user is sent by client
Instruction is surveyed, above-mentioned detection instruction can carry the bytecode of above-mentioned target to be detected;Alternatively, above-mentioned detection instruction can carry
The mark of target to be detected is stated, above-mentioned server obtains the mark of above-mentioned target to be detected, the mark based on above-mentioned target to be detected
Know, obtains the bytecode of target to be detected.
S102:Based on the bytecode of the target to be detected obtained, the corresponding chromaticity diagram to be detected of target to be detected is obtained
Picture;
It in one implementation, can be with above-mentioned to be checked after electronic equipment obtains the bytecode of above-mentioned target to be detected
The bytecode for surveying target, obtains the corresponding color image to be detected of target to be detected.In oneainstance, above-mentioned electronic equipment sheet
In ground or the storage device communicated to connect with electronic equipment, it is stored with the bytecode of each target and the correspondence of color image,
Electronic equipment can be based on above-mentioned correspondence and above-mentioned target to be detected bytecode, obtain that target to be detected is corresponding to be waited for
Detect color image.Wherein, above-mentioned target is:The program write based on default programming language.
S103:Based on the color image to be detected and preset defect type detection model obtained, determine to be detected
Target whether there is defect, and when determining existing defects, determine the corresponding defect type of target to be detected.
Wherein, preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, above-mentioned preset defect type detection model can be:Based on sample color image and
The model of machine learning algorithm training gained, wherein above-mentioned sample color image is:Bytecode based on sample object is obtained
Image, above-mentioned sample object is:The program write based on default programming language.Wherein, above-mentioned machine learning algorithm can be with
For convolutional neural networks algorithm, deep learning algorithm and algorithm of support vector machine etc..
In one implementation, training obtains above-mentioned preset defect type detection model, needs to obtain first multiple
Sample data, such as sample color image, wherein each sample color image corresponds to the bytecode of a sample object;In turn, it obtains
The corresponding calibration information of each sample color image, wherein above-mentioned calibration information includes corresponding sample color image pair
The prediction defect type answered, drawbacks described above type are:The type for the defect that the corresponding sample object of sample color image is included.
Above-mentioned calibration information can be what model foundation personnel demarcated manually.
It, can be with base after obtaining above-mentioned sample color image and the corresponding prediction defect type of each sample color image
Sample color image and the corresponding prediction defect type of each sample color image are stated in above-mentioned, initial defect type is examined
Model is surveyed to be trained.In training process, the parameter in above-mentioned initial defect type detection model, Zhi Daochu can be constantly adjusted
After the defect type detection model convergence of beginning, the preset defect type detection model of training gained is obtained, wherein this is preset
Defect type detection model includes the correspondence of each defect type and characteristics of image.
In one case, the initial convergent mark of defect type detection model, Ke Yishi:Initial defect type inspection
The current detection obtained for each present color image that model convergence is exported is surveyed as a result, i.e. current defect type, with pair
The identical probability of prediction defect type for including in calibration information is answered, the first predetermined threshold is more than;In another case, initially
The convergent mark of defect type detection model, Ke Yishi:Using preset loss function, initial defect type detection is calculated
The current defect type of model output obtained for each present color image, with the prediction for including in corresponding calibration information
Difference between defect type, the difference calculated are less than the second predetermined threshold.
It is subsequent, electronic equipment be based on above-mentioned preset defect type detection model included in each defect type with
The correspondence of characteristics of image, and the color image to be detected that is obtained, obtain testing result, i.e. determination obtains mesh to be detected
Mark whether there is defect, and when determining existing defects, and determination obtains the corresponding defect type of target to be detected.On specifically,
Preset defect type detection model can be based on by stating electronic equipment, extract the characteristics of image of color image to be detected, Jin Erji
It is and each included in above-mentioned preset defect type detection model in the characteristics of image of the color image to be detected extracted
The correspondence of defect type and characteristics of image, obtains testing result.
In one implementation, drawbacks described above can characterize the loophole present in target to be detected, drawbacks described above type
For the type of the loophole present in target to be detected, in oneainstance, above-mentioned target to be detected can be intelligent contract.
Drawbacks described above type can be varied, including but not limited to:can be killed by arbitrary
Addresses (indefinitely locking fund), have no way to release Ether after a certain
Execution state (intelligent contract is accidentally leaked into arbitrary user), release Ether to arbitrary
(transaction is suitable by addresses carelessly (can be by any address termination) Transaction-Ordering Dependence
Sequence rely on), Timestamp Dependence (timestamp dependence), Mishandled Exceptions (improper exception treatment)
And TheDao hack (theft of decentralization tissue ether coin) etc..
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type.
In one implementation, default programming language may include solidity language, and target to be detected may include
Intelligent contract.Wherein, above-mentioned intelligent contract is the program write based on above-mentioned solidity language.
In one implementation, the bytecode for obtaining target to be detected may include:
It obtains and the detection that target to be detected is detected is instructed, wherein detection instruction includes the byte of target to be detected
Code;
Based on the detection instruction obtained, the bytecode of target to be detected is obtained.
In oneainstance, electronic equipment can be server, when server obtains pair that user is sent by client
After the detection instruction that target to be detected is detected, extracted from above-mentioned detection instruction to be detected entrained by detection instruction
The bytecode of target, and then for the bytecode of the target to be detected, execute subsequent defect type testing process.
It is subsequent, when server passes through the bytecode of preset defect type detection model and the target to be detected, determination
After going out the testing result of target to be detected, the testing result for the target to be detected determined can be sent to above-mentioned client
End.After above-mentioned client receives above-mentioned testing result, it can continue to show above-mentioned testing result, so that user checks, user
It can be based on above-mentioned testing result and carry out subsequent operation, for example, it is determined whether disposing above-mentioned wait on the block chain in ether mill
Detect target.Wherein, above-mentioned testing result includes:Detected above-mentioned target to be detected with the presence or absence of defect as a result, with
And when determining above-mentioned result existing defects to be detected, identified defect type.
The embodiment of the present invention detects the target to be detected with the presence or absence of scarce before user disposes above-mentioned target to be detected
It falls into, and when determining the target existing defects to be detected, determines the type of the defect present in target to be detected.It can be to avoid
There will be the target deployments to be detected of defect for appearance on the block chain in ether mill, to a certain extent, avoids the area in ether mill
There are security risks for block chain.Also, the embodiment of the present invention determines the type of the defect present in target to be detected, is more convenient for out
Hair personnel modify to target to be detected perfect.
In one implementation, the bytecode of the target to be detected is a string of character strings;
Based on the bytecode of the target to be detected obtained, the step of the corresponding color image to be detected of target to be detected is obtained
Suddenly, may include:
Based on preset RGB (RedGreenBlue, RGB) color chart, by the word of the target to be detected obtained
Code is saved, RGB color code is translated to;
Wherein, the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By RGB color code, unloading is the corresponding color image to be detected of target to be detected.
It is understood that the bytecode of above-mentioned target to be detected is hexadecimal, and above-mentioned preset RGB color pair
Also it is hexadecimal according to the character substring in table, is based on the above-mentioned preset RGB color table of comparisons, it can be directly by mesh to be detected
Target bytecode translates to RGB color code.
Specifically, can start from character string, i.e., the initial character of the bytecode of above-mentioned target to be detected, every six characters are made
It for one group of character substring, is matched with the preset RGB color table of comparisons, by the corresponding RGB face of the character substring of successful match
Color code.Such as:" 606060 " corresponding RGB color code in the bytecode of above-mentioned target to be detected be RGB (96,96,
96), " 405260 " corresponding RGB color code in the bytecode of above-mentioned target to be detected is RGB (64,82,96) etc..
Subsequent, electronic equipment can determine the corresponding RGB color of RGB color code, and then based on determined by
The corresponding RGB color of RGB color code obtains the corresponding color image to be detected of target to be detected.Wherein, in order to improve
The size of detection efficiency, above-mentioned color image to be detected can be pre-set dimension, which can be with sample color image
Size it is identical, above-mentioned sample color image is:Training obtains the image that above-mentioned preset defect type detection model is utilized.
In one implementation, above-mentioned preset defect type detection model can be preset convolutional neural networks mould
Type;
Based on the color image to be detected and preset defect type detection model obtained, target to be detected is determined
With the presence or absence of defect, and when determining existing defects, before determining the corresponding defect type of target to be detected, the method may be used also
To include:
Establish the process of preset convolutional neural networks model, wherein as shown in Fig. 2, the process may include:
S201:Obtain initial convolutional neural networks model;
S202:Obtain the bytecode of multiple sample objects;
Wherein, sample object is:The program write based on default programming language;
S203:Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
S204:Obtain the corresponding calibration information of each sample color image;
Wherein, calibration information includes:The corresponding defect type of corresponding sample color image, as prediction defect type;
The defect type is:The type for the defect that the corresponding sample object of sample color image is included.
S205:Based in each sample color image and the corresponding calibration information of each sample color image obtained
Included prediction defect type, the training initial convolutional neural networks model, obtains preset convolutional neural networks mould
Type.
It is understood that the quantity of the sample color image of the above-mentioned initial convolutional neural networks model of training is more,
The preset convolutional neural networks model of training gained is more stable, further, utilizes above-mentioned preset convolutional neural networks mould
Type, the target to be detected determined with the presence or absence of defect as a result, and when determining existing defects, identified defect class
Type is more accurate.
In oneainstance, in the above-mentioned initial convolutional neural networks model of training, the sample color image that is obtained
Quantity may be less, such as less than certain predetermined threshold value, at this point it is possible to using K-fold modes.Utilize obtained sample
Color image and the corresponding calibration information of each sample color image, the above-mentioned initial convolutional neural networks model of training, with
Obtain initial convolutional neural networks model.
In addition, being based on preset convolutional neural networks model, determine that target to be detected whether there is defect, and in determination
When existing defects, its defect type is determined, can ensure the accuracy of determined the above results to a certain extent, this is because
Training obtains the sample color image of preset convolutional neural networks model, is the corresponding image of true sample object, can
To characterize the various information of sample object well.
In embodiments of the present invention, above-mentioned default programming language can be solidity language and Javascript language
Deng.Above-mentioned sample object can be intelligent contract, at this point, the above-mentioned intelligent contract as sample object can be deployed in
Intelligent contract too on the block chain in mill.At this point, electronic equipment can obtain the address of above-mentioned intelligent contract by reptile software,
And then based on the address obtained, by ether mill API, (Application Program Interface, application program connect
Mouthful) get the corresponding bytecode of above-mentioned intelligent contract.
Above-mentioned convolutional neural networks model can be:VGG16/19 network models, Inception v3 network models and
Resnet network models etc..
In one implementation, initial convolutional neural networks model may include feature extraction layer and tagsort
Layer;
It is described based in each sample color image obtained and the corresponding calibration information of each sample color image
Included prediction defect type, the initial convolutional neural networks model of training, obtains preset convolutional neural networks model, can
To include:
The each sample color image input feature vector extract layer that will be obtained, extracts the sample image of the sample color image
Feature;
By the sample image feature input feature vector extracted classification layer, the corresponding current defect of sample color image is obtained
Type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional neural networks model for including feature extraction layer and tagsort layer is obtained;
When it fails to match, the parameter of feature extraction layer and tagsort layer is adjusted, returning to execute above-mentioned will be obtained
Each sample color image input feature vector extract layer, the step of extracting the sample image feature of the sample color image;
Until when successful match, the preset convolutional neural networks mould for including feature extraction layer and tagsort layer is obtained
Type.
It is above-mentioned to be by the current defect type obtained and the corresponding matched process of prediction defect type progress,
The difference of the current defect type and corresponding prediction defect type that obtain is calculated using preset loss function, it is poor when calculating
Value allows default in loss range, it is determined that successful match, when institute's calculating difference does not allow default in loss range, then really
Surely match it is unsuccessful, at this point it is possible to based on by the current defect type of acquisition and it is corresponding prediction defect type difference become smaller
Principle, adjust features described above extract layer and tagsort layer parameter;It is above-mentioned each by what is obtained that execution is returned to again
Sample color image inputs the feature extraction layer, the step of extracting the sample image feature of the sample color image.In one kind
In realization method, the parameter of gradient descent method adjustment features described above extract layer and tagsort layer can be utilized.
It in one implementation, can will be each during training above-mentioned initial convolutional neural networks model
Sample image frame inputs above-mentioned initial convolutional neural networks model, to be carried out to above-mentioned initial convolutional neural networks model
Training;Can also be first from the bytecode of above-mentioned sample object, random or sequence chooses the sample object of predetermined quantity
The bytecode of the sample object of selected predetermined quantity is inputted above-mentioned initial convolutional neural networks model by bytecode, with
Above-mentioned initial convolutional neural networks model is trained, preset convolutional neural networks model is obtained.
In one implementation, it in order to obtain better preset convolutional neural networks model, is preset in training
Convolutional neural networks model, which can be optimized.Specifically, being based on institute described
Included prediction defect class in each sample color image and the corresponding calibration information of each sample color image that obtain
Type, the training initial convolutional neural networks model, after obtaining preset convolutional neural networks model, the method may be used also
To include:
Based on default testing process, the accuracy of preset convolutional neural networks model definitive result is detected, is detected
As a result;
Obtain the adjust instruction for testing result, wherein adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to preset convolutional neural networks model.
Wherein, after obtaining preset convolutional neural networks model, electronic equipment can continue known defect type
The corresponding color image of target inputs above-mentioned preset convolutional neural networks model, is exported as a result, by above-mentioned output result
It is matched with the known defect type of the color image, preset convolutional neural networks model is determined really based on matching result
The accuracy for determining result, obtains testing result.When matching rate is less than preset matching threshold value, model foundation personnel tie according to detection
Fruit and experience determine corresponding Adjusted Option, and determine adjustment as a result, and trigger carry adjustment result adjust instruction,
Electronic equipment obtains the adjust instruction, wherein adjust instruction carries the above-mentioned preset convolutional neural networks model adjusted
The adjustment of parameter and each parameter of required adjustment is as a result, for example:Parameter may include learning rate (learning rate), criticize
The adjustment result of size (batch size), the number of plies of convolutional layer and majorized function etc., each parameter may include that adjustment is learned
Habit rate is to xx values, and big as low as yy values, etc. are criticized in adjustment, wherein above-mentioned majorized function may include Relu (Rectified
Linear Units) activation primitive.In turn, electronic equipment can continue the preset convolutional neural networks mould after training adjustment
Type.
In one implementation, described to be detected based on the color image to be detected obtained and preset defect type
Model determines that target to be detected whether there is defect, and when determining existing defects, determines the corresponding defect class of target to be detected
The step of type may include:
Color image to be detected is inputted into preset convolutional neural networks model, preset convolutional neural networks model extraction
Image to be detected feature of color image to be detected;And based on image to be detected feature extracted, determine that target to be detected is
No existing defects, and when determining target existing defects to be detected, determine the corresponding defect type of target to be detected.
In oneainstance, color image to be detected can be inputted preset convolutional neural networks model by electronic equipment
Then feature extraction layer, feature extraction layer can will be extracted based on image to be detected feature for extracting color image to be detected
Image to be detected feature inputs the tagsort layer of preset convolutional neural networks model, and tagsort layer is based on above-mentioned extracted
Image to be detected feature determines that the target to be detected is determining above-mentioned target existing defects to be detected in turn with the presence or absence of defect
When, determine the defect type of defect present in target to be detected, and export.
Corresponding to above method embodiment, an embodiment of the present invention provides a kind of defect type detection devices, such as Fig. 3 institutes
Show, described device includes:
First obtains module 310, the bytecode for obtaining target to be detected, wherein the target to be detected is:It is based on
The program that default programming language is write;
Second obtains module 320, for the bytecode based on the target to be detected obtained, obtains the target to be detected
Corresponding color image to be detected;
Determining module 330, for based on the color image to be detected and preset defect type detection model obtained,
It determines that the target to be detected whether there is defect, and when determining existing defects, determines that the target to be detected is corresponding and lack
Fall into type, wherein the preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type.
In one implementation, the default programming language includes solidity language, and the target to be detected includes
Intelligent contract.
In one implementation, the bytecode of the target to be detected is a string of character strings;
Described second obtains module 320, is specifically used for
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of the target to be detected.
In one implementation, the preset defect type detection model is preset convolutional neural networks model;
As shown in figure 4, described device can also include:
Model building module 410, for described based on the color image to be detected obtained and preset defect class
Type detection model determines that the target to be detected whether there is defect, and when determining existing defects, determines the mesh to be detected
Before marking corresponding defect type, the process of the preset convolutional neural networks model is established, wherein the model foundation mould
Block 410 includes:
Second obtaining unit 411, for obtaining initial convolutional neural networks model;
Third obtaining unit 412, the bytecode for obtaining multiple sample objects, wherein the sample object is:It is based on
The program that the default programming language is write;
4th obtaining unit 413 is used for the bytecode based on each sample object, obtains the corresponding sample of each sample object
Present color image;
5th obtaining unit 414, for obtaining the corresponding calibration information of each sample color image, wherein the calibration
Information includes:The corresponding defect type of corresponding sample color image, as prediction defect type;
Training obtains unit 415, for based on each sample color image and each sample color image obtained
Included prediction defect type in corresponding calibration information, the training initial convolutional neural networks model, is preset
Convolutional neural networks model.
In one implementation, the initial convolutional neural networks model includes feature extraction layer and tagsort
Layer;
The training obtains unit, is specifically used for
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
In one implementation, the model building module further includes:
Detection unit, for described based on each sample color image obtained and each sample color image pair
Included prediction defect type in the calibration information answered, the training initial convolutional neural networks model, obtains preset
After convolutional neural networks model, based on default testing process, that detects the preset convolutional neural networks model determines knot
The accuracy of fruit obtains testing result;
6th obtaining unit, for obtaining the adjust instruction for the testing result, wherein the adjust instruction carries
Required adjustment result;
Adjustment unit, for based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model
It is whole.
In one implementation, the determining module 430, is specifically used for
The color image to be detected is inputted into the preset convolutional neural networks model, the preset convolutional Neural
Network model extracts image to be detected feature of the color image to be detected;And it is special based on the described image to be detected extracted
Sign determines that the target to be detected whether there is defect, and when determining the target existing defects to be detected, is waited for described in determination
Detect the corresponding defect type of target.
In one implementation, described first module is obtained, be specifically used for
It obtains and the detection that the target to be detected is detected is instructed, wherein the detection instruction includes described to be checked
Survey the bytecode of target;
Based on the detection instruction obtained, the bytecode of the target to be detected is obtained.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of electronic equipment, as shown in figure 5, including
Processor 510, communication interface 520, memory 530 and communication bus 540, wherein processor 510, communication interface 520, storage
Device 530 completes mutual communication by communication bus 540,
Memory 530, for storing computer program;
Processor 510 when for executing the computer program stored on memory 530, realizes institute of the embodiment of the present invention
Any of the above-described defect type detection method provided, the defect type detection method include:
Obtain the bytecode of target to be detected, wherein the target to be detected is:It is write based on default programming language
Program;
Based on the bytecode of the target to be detected obtained, the corresponding chromaticity diagram to be detected of the target to be detected is obtained
Picture;
Based on the color image to be detected and preset defect type detection model obtained, the mesh to be detected is determined
Mark whether there is defect, and when determining existing defects, determine the corresponding defect type of the target to be detected, wherein described
Preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type.
In one implementation, the default programming language includes solidity language, and the target to be detected includes
Intelligent contract.
In one implementation, the bytecode of the target to be detected is a string of character strings;
The bytecode based on the target to be detected obtained obtains the corresponding color to be detected of the target to be detected
Image, including:
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of target to be detected.
In one implementation, the preset defect type detection model is preset convolutional neural networks model;
Described based on the color image to be detected obtained and preset defect type detection model, determine described in wait for
It detects target and whether there is defect, and when determining existing defects, before determining the corresponding defect type of the target to be detected,
Further include:
Establish the process of the preset convolutional neural networks model, wherein the process includes:
Obtain initial convolutional neural networks model;
Obtain the bytecode of multiple sample objects, wherein the sample object is:It is compiled based on the default programming language
The program write;
Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
Obtain the corresponding calibration information of each sample color image, wherein the calibration information includes:Corresponding sample color
Coloured picture is as corresponding defect type, as prediction defect type;
Based on being wrapped in each sample color image and the corresponding calibration information of each sample color image obtained
The prediction defect type included, the training initial convolutional neural networks model, obtains preset convolutional neural networks model.
In one implementation, the initial convolutional neural networks model includes feature extraction layer and tagsort
Layer;
It is described based in each sample color image obtained and the corresponding calibration information of each sample color image
Included prediction defect type, the training initial convolutional neural networks model, obtains preset convolutional neural networks mould
Type, including:
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
In one implementation, described based on each sample color image obtained and each sample color figure
As prediction defect type included in corresponding calibration information, the training initial convolutional neural networks model obtains pre-
If convolutional neural networks model after, the method further includes:
Based on default testing process, the accuracy of the definitive result of the preset convolutional neural networks model is detected, is obtained
Obtain testing result;
Obtain the adjust instruction for the testing result, wherein the adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model.
In one implementation, described to be detected based on the color image to be detected obtained and preset defect type
Model determines that the target to be detected whether there is defect, and when determining existing defects, determines that the target to be detected corresponds to
Defect type, including:
The color image to be detected is inputted into the preset convolutional neural networks model, the preset convolutional Neural
Network model extracts image to be detected feature of the color image to be detected;And it is special based on the described image to be detected extracted
Sign determines that the target to be detected whether there is defect, and when determining the target existing defects to be detected, is waited for described in determination
Detect the corresponding defect type of target.
The bytecode for obtaining target to be detected, including:
It obtains and the detection that the target to be detected is detected is instructed, wherein the detection instruction includes described to be checked
Survey the bytecode of target;
Based on the detection instruction obtained, the bytecode of the target to be detected is obtained.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, controlling bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), can also include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be at least one storage device for being located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of computer readable storage medium, described
It is stored with computer program in computer readable storage medium, realizes that the present invention is real when the computer program is executed by processor
Any of the above-described defect type detection method that example is provided is applied, which includes:
Obtain the bytecode of target to be detected, wherein the target to be detected is:It is write based on default programming language
Program;
Based on the bytecode of the target to be detected obtained, the corresponding chromaticity diagram to be detected of the target to be detected is obtained
Picture;
Based on the color image to be detected and preset defect type detection model obtained, the mesh to be detected is determined
Mark whether there is defect, and when determining existing defects, determine the corresponding defect type of the target to be detected, wherein described
Preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type.
In one implementation, the default programming language includes solidity language, and the target to be detected includes
Intelligent contract.
In one implementation, the bytecode of the target to be detected is a string of character strings;
The bytecode based on the target to be detected obtained obtains the corresponding color to be detected of the target to be detected
Image, including:
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of target to be detected.
In one implementation, the preset defect type detection model is preset convolutional neural networks model;
Described based on the color image to be detected obtained and preset defect type detection model, determine described in wait for
It detects target and whether there is defect, and when determining existing defects, before determining the corresponding defect type of the target to be detected,
Further include:
Establish the process of the preset convolutional neural networks model, wherein the process includes:
Obtain initial convolutional neural networks model;
Obtain the bytecode of multiple sample objects, wherein the sample object is:It is compiled based on the default programming language
The program write;
Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
Obtain the corresponding calibration information of each sample color image, wherein the calibration information includes:Corresponding sample color
Coloured picture is as corresponding defect type, as prediction defect type;
Based on being wrapped in each sample color image and the corresponding calibration information of each sample color image obtained
The prediction defect type included, the training initial convolutional neural networks model, obtains preset convolutional neural networks model.
In one implementation, the initial convolutional neural networks model includes feature extraction layer and tagsort
Layer;
It is described based in each sample color image obtained and the corresponding calibration information of each sample color image
Included prediction defect type, the training initial convolutional neural networks model, obtains preset convolutional neural networks mould
Type, including:
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
In one implementation, described based on each sample color image obtained and each sample color figure
As prediction defect type included in corresponding calibration information, the training initial convolutional neural networks model obtains pre-
If convolutional neural networks model after, the method further includes:
Based on default testing process, the accuracy of the definitive result of the preset convolutional neural networks model is detected, is obtained
Obtain testing result;
Obtain the adjust instruction for the testing result, wherein the adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of computer program, wherein the calculating
Any of the above-described defect type detection method that the embodiment of the present invention is provided is realized when machine program is executed by processor, it should
Defect type detection method includes:
Obtain the bytecode of target to be detected, wherein the target to be detected is:It is write based on default programming language
Program;
Based on the bytecode of the target to be detected obtained, the corresponding chromaticity diagram to be detected of the target to be detected is obtained
Picture;
Based on the color image to be detected and preset defect type detection model obtained, the mesh to be detected is determined
Mark whether there is defect, and when determining existing defects, determine the corresponding defect type of the target to be detected, wherein described
Preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
In the embodiment of the present invention, based on the bytecode of obtained target to be detected, the target to be detected of acquisition is corresponding to be waited for
Detect color image, in turn, based on color image to be detected and preset defect type detection model included it is each lack
Fall into the correspondence of type and characteristics of image, it may be determined that go out target to be detected and whether there is defect, and is to be detected determining
When target existing defects, the corresponding defect type of target to be detected is determined, realize to target to be detected with the presence or absence of defect
Detection is further realized when target existing defects to be detected, the detection to defect type.
In one implementation, the default programming language includes solidity language, and the target to be detected includes
Intelligent contract.
In one implementation, the bytecode of the target to be detected is a string of character strings;
The bytecode based on the target to be detected obtained obtains the corresponding color to be detected of the target to be detected
Image, including:
The bytecode of the target to be detected obtained is translated into RGB color generation based on the preset RGB color table of comparisons
Code, wherein the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of target to be detected.
In one implementation, the preset defect type detection model is preset convolutional neural networks model;
Described based on the color image to be detected obtained and preset defect type detection model, determine described in wait for
It detects target and whether there is defect, and when determining existing defects, before determining the corresponding defect type of the target to be detected,
Further include:
Establish the process of the preset convolutional neural networks model, wherein the process includes:
Obtain initial convolutional neural networks model;
Obtain the bytecode of multiple sample objects, wherein the sample object is:It is compiled based on the default programming language
The program write;
Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
Obtain the corresponding calibration information of each sample color image, wherein the calibration information includes:Corresponding sample color
Coloured picture is as corresponding defect type, as prediction defect type;
Based on being wrapped in each sample color image and the corresponding calibration information of each sample color image obtained
The prediction defect type included, the training initial convolutional neural networks model, obtains preset convolutional neural networks model.
In one implementation, the initial convolutional neural networks model includes feature extraction layer and tagsort
Layer;
It is described based in each sample color image obtained and the corresponding calibration information of each sample color image
Included prediction defect type, the training initial convolutional neural networks model, obtains preset convolutional neural networks mould
Type, including:
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample of the sample color image
Characteristics of image;
The sample image feature extracted is inputted into the tagsort layer, it is corresponding current to obtain the sample color image
Defect type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional Neural net for including the feature extraction layer and the tagsort layer is obtained
Network model;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described will
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional Neural for including the feature extraction layer and the tagsort layer is obtained
Network model.
In one implementation, described based on each sample color image obtained and each sample color figure
As prediction defect type included in corresponding calibration information, the training initial convolutional neural networks model obtains pre-
If convolutional neural networks model after, the method further includes:
Based on default testing process, the accuracy of the definitive result of the preset convolutional neural networks model is detected, is obtained
Obtain testing result;
Obtain the adjust instruction for the testing result, wherein the adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, identical similar portion between each embodiment
Point just to refer each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so description is fairly simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (10)
1. a kind of defect type detection method, which is characterized in that the method includes:
Obtain the bytecode of target to be detected, wherein the target to be detected is:The journey write based on default programming language
Sequence;
Based on the bytecode of the target to be detected obtained, the corresponding color image to be detected of the target to be detected is obtained;
Based on the color image to be detected and preset defect type detection model obtained, determine that the target to be detected is
No existing defects, and when determining existing defects, determine the corresponding defect type of the target to be detected, wherein it is described default
Defect type detection model:Include the correspondence of each defect type and characteristics of image.
2. according to the method described in claim 1, it is characterized in that, the default programming language includes solidity language, institute
It includes intelligent contract to state target to be detected.
3. according to the method described in claim 1, it is characterized in that, the bytecode of the target to be detected is a string of character strings;
The bytecode based on the target to be detected obtained obtains the corresponding chromaticity diagram to be detected of the target to be detected
Picture, including:
The bytecode of the target to be detected obtained is translated into RGB color code based on the preset RGB color table of comparisons,
In, the preset RGB color table of comparisons includes:The correspondence of each RGB color code and character substring;
By the RGB color code, unloading is the corresponding color image to be detected of the target to be detected.
4. according to claim 1-3 any one of them methods, which is characterized in that the preset defect type detection model is
Preset convolutional neural networks model;
Described based on the color image to be detected obtained and preset defect type detection model, determine described to be detected
Target whether there is defect, and when determining existing defects, described before determining the corresponding defect type of the target to be detected
Method further includes:
Establish the process of the preset convolutional neural networks model, wherein the process includes:
Obtain initial convolutional neural networks model;
Obtain the bytecode of multiple sample objects, wherein the sample object is:It is write based on the default programming language
Program;
Based on the bytecode of each sample object, the corresponding sample color image of each sample object is obtained;
Obtain the corresponding calibration information of each sample color image, wherein the calibration information includes:Corresponding sample color figure
As corresponding defect type, as prediction defect type;
Based on included in each sample color image and the corresponding calibration information of each sample color image obtained
Predict that defect type, the training initial convolutional neural networks model obtain preset convolutional neural networks model.
5. according to the method described in claim 4, it is characterized in that, the initial convolutional neural networks model includes that feature carries
Take layer and tagsort layer;
It is described based on being wrapped in each sample color image obtained and the corresponding calibration information of each sample color image
The prediction defect type included, the training initial convolutional neural networks model, obtains preset convolutional neural networks model, wraps
It includes:
The each sample color image obtained is inputted into the feature extraction layer, extracts the sample image of the sample color image
Feature;
The sample image feature extracted is inputted into the tagsort layer, obtains the corresponding current defect of sample color image
Type;
The current defect type obtained is matched with corresponding prediction defect type;
When successful match, the preset convolutional neural networks mould for including the feature extraction layer and the tagsort layer is obtained
Type;
When it fails to match, the parameter of the feature extraction layer and the tagsort layer is adjusted, return execution is described to be obtained
The each sample color image obtained inputs the feature extraction layer, extracts the sample image feature of the sample color image;
Until when successful match, the preset convolutional neural networks for including the feature extraction layer and the tagsort layer are obtained
Model.
6. according to the method described in claim 4, it is characterized in that, it is described based on each sample color image obtained with
And included prediction defect type in the corresponding calibration information of each sample color image, the training initial convolutional Neural
Network model, after obtaining preset convolutional neural networks model, the method further includes:
Based on default testing process, the accuracy of the definitive result of the preset convolutional neural networks model is detected, is examined
Survey result;
Obtain the adjust instruction for the testing result, wherein the adjust instruction carries required adjustment result;
Based on the adjustment obtained as a result, being adjusted to the preset convolutional neural networks model.
7. according to the method described in claim 4, it is characterized in that, described based on the color image to be detected obtained and pre-
If defect type detection model, determine that the target to be detected whether there is defect, and when determining existing defects, determine institute
The corresponding defect type of target to be detected is stated, including:
The color image to be detected is inputted into the preset convolutional neural networks model, the preset convolutional neural networks
Image to be detected feature of color image to be detected described in model extraction;And based on image to be detected feature extracted,
It determines that the target to be detected whether there is defect, and when determining the target existing defects to be detected, determines described to be checked
Survey the corresponding defect type of target.
8. a kind of defect type detection device, which is characterized in that described device includes:
First obtains module, the bytecode for obtaining target to be detected, wherein the target to be detected is:Based on default volume
The program that Cheng Yuyan is write;
Second obtains module, and for the bytecode based on the target to be detected obtained, it is corresponding to obtain the target to be detected
Color image to be detected;
Determining module, for based on the color image to be detected and preset defect type detection model obtained, determining institute
It states target to be detected and whether there is defect, and when determining existing defects, determine the corresponding defect type of the target to be detected,
Wherein, the preset defect type detection model:Include the correspondence of each defect type and characteristics of image.
9. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the computer program stored on memory, realizes any defects of claim 1-7
Type detection method and step.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium
Program realizes claim 1-7 any defect type detection method steps when the computer program is executed by processor
Suddenly.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810276600.9A CN108509958A (en) | 2018-03-30 | 2018-03-30 | Defect type detection method, defect type detection device, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810276600.9A CN108509958A (en) | 2018-03-30 | 2018-03-30 | Defect type detection method, defect type detection device, electronic equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108509958A true CN108509958A (en) | 2018-09-07 |
Family
ID=63377880
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810276600.9A Pending CN108509958A (en) | 2018-03-30 | 2018-03-30 | Defect type detection method, defect type detection device, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108509958A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109800175A (en) * | 2019-02-20 | 2019-05-24 | 河海大学 | A kind of ether mill intelligence contract reentry leak detection method based on code pitching pile |
CN109919925A (en) * | 2019-03-04 | 2019-06-21 | 联觉(深圳)科技有限公司 | Printed circuit board intelligent detecting method, system, electronic device and storage medium |
CN109949271A (en) * | 2019-02-14 | 2019-06-28 | 腾讯科技(深圳)有限公司 | A kind of detection method based on medical image, the method and device of model training |
CN109948345A (en) * | 2019-03-20 | 2019-06-28 | 杭州拜思科技有限公司 | A kind of method, the system of intelligence contract Hole Detection |
CN109977682A (en) * | 2019-04-01 | 2019-07-05 | 中山大学 | A kind of block chain intelligence contract leak detection method and device based on deep learning |
CN110781823A (en) * | 2019-10-25 | 2020-02-11 | 北京字节跳动网络技术有限公司 | Screen recording detection method and device, readable medium and electronic equipment |
CN111310778A (en) * | 2018-12-12 | 2020-06-19 | 横河电机株式会社 | Detection device, detection method, and recording medium on which detection program is recorded |
CN111338692A (en) * | 2018-12-18 | 2020-06-26 | 北京奇虎科技有限公司 | Vulnerability classification method and device based on vulnerability codes and electronic equipment |
CN111640096A (en) * | 2020-05-25 | 2020-09-08 | 中国电子科技集团公司第十三研究所 | Electronic product appearance detection method and device and terminal |
CN112257075A (en) * | 2020-11-11 | 2021-01-22 | 福建有度网络安全技术有限公司 | System vulnerability detection method, device, equipment and storage medium under intranet environment |
CN113792662A (en) * | 2021-09-15 | 2021-12-14 | 北京市商汤科技开发有限公司 | Image detection method, image detection device, electronic equipment and storage medium |
CN116503412A (en) * | 2023-06-29 | 2023-07-28 | 宁德时代新能源科技股份有限公司 | Appearance defect detection method, apparatus, computer device and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106919419A (en) * | 2017-02-03 | 2017-07-04 | 中钞信用卡产业发展有限公司北京智能卡技术研究院 | The update method and device of the intelligent contract program on block chain |
CN107526625A (en) * | 2017-07-18 | 2017-12-29 | 杭州趣链科技有限公司 | A kind of Java intelligence contract safety detection methods based on bytecode inspection |
CN107665307A (en) * | 2017-09-13 | 2018-02-06 | 北京金山安全软件有限公司 | Application identification method and device, electronic equipment and storage medium |
CN107844704A (en) * | 2017-11-01 | 2018-03-27 | 济南浪潮高新科技投资发展有限公司 | One kind is based on block chain believable intelligent contract reinforcement means |
US20180089436A1 (en) * | 2016-09-29 | 2018-03-29 | Intel Corporation | Methods And Apparatus To Facilitate Blockchain-based Boot Tracking |
-
2018
- 2018-03-30 CN CN201810276600.9A patent/CN108509958A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180089436A1 (en) * | 2016-09-29 | 2018-03-29 | Intel Corporation | Methods And Apparatus To Facilitate Blockchain-based Boot Tracking |
CN106919419A (en) * | 2017-02-03 | 2017-07-04 | 中钞信用卡产业发展有限公司北京智能卡技术研究院 | The update method and device of the intelligent contract program on block chain |
CN107526625A (en) * | 2017-07-18 | 2017-12-29 | 杭州趣链科技有限公司 | A kind of Java intelligence contract safety detection methods based on bytecode inspection |
CN107665307A (en) * | 2017-09-13 | 2018-02-06 | 北京金山安全软件有限公司 | Application identification method and device, electronic equipment and storage medium |
CN107844704A (en) * | 2017-11-01 | 2018-03-27 | 济南浪潮高新科技投资发展有限公司 | One kind is based on block chain believable intelligent contract reinforcement means |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111310778A (en) * | 2018-12-12 | 2020-06-19 | 横河电机株式会社 | Detection device, detection method, and recording medium on which detection program is recorded |
CN111338692B (en) * | 2018-12-18 | 2024-04-16 | 北京奇虎科技有限公司 | Vulnerability classification method and device based on vulnerability codes and electronic equipment |
CN111338692A (en) * | 2018-12-18 | 2020-06-26 | 北京奇虎科技有限公司 | Vulnerability classification method and device based on vulnerability codes and electronic equipment |
CN109949271B (en) * | 2019-02-14 | 2021-03-16 | 腾讯科技(深圳)有限公司 | Detection method based on medical image, model training method and device |
CN109949271A (en) * | 2019-02-14 | 2019-06-28 | 腾讯科技(深圳)有限公司 | A kind of detection method based on medical image, the method and device of model training |
CN109800175A (en) * | 2019-02-20 | 2019-05-24 | 河海大学 | A kind of ether mill intelligence contract reentry leak detection method based on code pitching pile |
CN109919925A (en) * | 2019-03-04 | 2019-06-21 | 联觉(深圳)科技有限公司 | Printed circuit board intelligent detecting method, system, electronic device and storage medium |
CN109948345A (en) * | 2019-03-20 | 2019-06-28 | 杭州拜思科技有限公司 | A kind of method, the system of intelligence contract Hole Detection |
CN109977682A (en) * | 2019-04-01 | 2019-07-05 | 中山大学 | A kind of block chain intelligence contract leak detection method and device based on deep learning |
CN109977682B (en) * | 2019-04-01 | 2023-04-07 | 中山大学 | Block chain intelligent contract vulnerability detection method and device based on deep learning |
CN110781823B (en) * | 2019-10-25 | 2022-07-26 | 北京字节跳动网络技术有限公司 | Screen recording detection method and device, readable medium and electronic equipment |
CN110781823A (en) * | 2019-10-25 | 2020-02-11 | 北京字节跳动网络技术有限公司 | Screen recording detection method and device, readable medium and electronic equipment |
CN111640096A (en) * | 2020-05-25 | 2020-09-08 | 中国电子科技集团公司第十三研究所 | Electronic product appearance detection method and device and terminal |
CN111640096B (en) * | 2020-05-25 | 2023-04-21 | 中国电子科技集团公司第十三研究所 | Method, device and terminal for detecting appearance of electronic product |
CN112257075A (en) * | 2020-11-11 | 2021-01-22 | 福建有度网络安全技术有限公司 | System vulnerability detection method, device, equipment and storage medium under intranet environment |
CN113792662A (en) * | 2021-09-15 | 2021-12-14 | 北京市商汤科技开发有限公司 | Image detection method, image detection device, electronic equipment and storage medium |
CN116503412A (en) * | 2023-06-29 | 2023-07-28 | 宁德时代新能源科技股份有限公司 | Appearance defect detection method, apparatus, computer device and storage medium |
CN116503412B (en) * | 2023-06-29 | 2023-12-08 | 宁德时代新能源科技股份有限公司 | Appearance defect detection method, apparatus, computer device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108509958A (en) | Defect type detection method, defect type detection device, electronic equipment and medium | |
CN107872772B (en) | Method and device for detecting fraud short messages | |
CN110009027B (en) | Image comparison method and device, storage medium and electronic device | |
CN106875007A (en) | End-to-end deep neural network is remembered based on convolution shot and long term for voice fraud detection | |
CN106327188B (en) | Method and device for binding bank card in payment application | |
CN109657539A (en) | Face value evaluation method and device, readable storage medium and electronic equipment | |
CN108520196A (en) | Luxury goods discriminating conduct, electronic device and storage medium | |
CN107341399A (en) | Assess the method and device of code file security | |
CN106415605A (en) | Techniques for distributed optical character recognition and distributed machine language translation | |
CN110365691B (en) | Phishing website distinguishing method and device based on deep learning | |
WO2020228283A1 (en) | Feature extraction method and apparatus, and computer readable storage medium | |
CN110457677A (en) | Entity-relationship recognition method and device, storage medium, computer equipment | |
CN109697449A (en) | A kind of object detection method, device and electronic equipment | |
CN110335139A (en) | Appraisal procedure, device, equipment and readable storage medium storing program for executing based on similarity | |
CN107403149A (en) | Iris identification method and related product | |
CN107958154A (en) | A kind of malware detection device and method | |
CN106228133A (en) | User authentication method and device | |
CN108154031A (en) | Recognition methods, device, storage medium and the electronic device of camouflage applications program | |
CN115658955A (en) | Cross-media retrieval and model training method, device, equipment and menu retrieval system | |
CN107037028A (en) | A kind of cloud platform Raman spectrum recognition methods and device | |
CN109800797A (en) | File black and white judgment method, device and equipment based on AI | |
CN105788056B (en) | Event-handling method and device | |
CN112883719A (en) | Class word recognition method, model training method, device and system | |
CN110837563B (en) | Case judge method, device and system | |
CN109101984A (en) | A kind of image-recognizing method and device based on convolutional neural networks |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180907 |