Summary of the invention
The purpose of the present invention is to provide detection method, device, equipment and the storage medium of a kind of body surface defect, with
Reduce the waste to being calculated in intelligent measurement machine with storage resource.
In a first aspect, the embodiment of the invention provides a kind of detection methods of body surface defect, comprising:
A series of corresponding with the regularity of distribution of callout box position of test object anchor frames are generated, in a series of anchor frames
The distribution of heart point constitutes the corresponding anchor frame of the test object and is distributed figure;
It is distributed a series of corresponding anchor frames of figure according to the anchor frame to be trained detection model, the inspection after being trained
Survey model;
It is detected using surface defect of the detection model after the training to the test object, obtains surface defect
Generate frame.
In one possible implementation, in the above method provided in an embodiment of the present invention, the generation and detection
A series of corresponding anchor frames of the regularity of distribution of the callout box position of object, described in the distributions of anchor frame central points a series of is constituted
The corresponding anchor frame of test object is distributed figure, comprising:
Obtain the corresponding target image of the test object;
The target image is labeled, the corresponding labeled data collection of the target object is obtained;
It concentrates the coordinate of each callout box central point to count the labeled data, obtains statistical result;
According to the statistical result, current square anchor frame distribution figure is mapped as and the inspection using operator is collapsed
A series of corresponding anchor frames of the regularity of distribution of the callout box position of object are surveyed, a series of distribution of anchor frame central points constitutes institute
State the corresponding anchor frame distribution figure of test object.
In one possible implementation, in the above method provided in an embodiment of the present invention, the operator of collapsing is adopted
With the first calculation formula:
Wherein, (x, y) is transformed coordinate;(x0,y0) be transformation before coordinate;(a, b) is center coordinate;K is to collapse
The factor.
In one possible implementation, in the above method provided in an embodiment of the present invention, the factor of collapsing is adopted
With the second calculation formula:
Second aspect, the embodiment of the invention provides a kind of detection devices of body surface defect, comprising:
Generation module, for generating a series of anchor frames corresponding with the regularity of distribution of callout box position of test object, institute
A series of distribution for stating anchor frame central points constitutes the corresponding anchor frame distribution figure of the test object;
Training module is trained detection model for being distributed a series of corresponding anchor frames of figure according to the anchor frame,
Detection model after being trained;
Detection module, for being examined using surface defect of the detection model after the training to the test object
It surveys, obtains surface defect and generate frame.
In one possible implementation, in above-mentioned apparatus provided in an embodiment of the present invention, the generation module, packet
It includes:
Acquiring unit, for obtaining the corresponding target image of the test object;
It marks unit and obtains the corresponding labeled data collection of the target object for being labeled to the target image;
Statistic unit is united for concentrating the coordinate of each callout box central point to count the labeled data
Count result;
Map unit, for current square anchor frame to be distributed figure using operator is collapsed according to the statistical result
It is mapped as a series of anchor frames corresponding with the regularity of distribution of callout box position of the test object, a series of anchor frames center
The distribution of point constitutes the corresponding anchor frame of the test object and is distributed figure.
In one possible implementation, in above-mentioned apparatus provided in an embodiment of the present invention, the operator of collapsing is adopted
With the first calculation formula:
Wherein, (x, y) is transformed coordinate;(x0,y0) be transformation before coordinate;(a, b) is center coordinate;K is to collapse
The factor.
In one possible implementation, in above-mentioned apparatus provided in an embodiment of the present invention, the factor of collapsing is adopted
With the second calculation formula:
The third aspect, the embodiment of the invention provides a kind of electronic equipment, comprising: memory and processor;
The memory, for storing computer program;
Wherein, the processor executes the computer program in the memory, to realize above-mentioned first aspect and
Method described in each embodiment of one side.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage
Computer program is stored in medium, for realizing above-mentioned first aspect and when the computer program is executed by processor
Method described in each embodiment of one side.
Compared with prior art, the detection method of body surface defect provided by the invention, device, equipment and storage are situated between
Matter, firstly generates a series of anchor frames corresponding with the regularity of distribution of callout box position of test object, in a series of anchor frames
The distribution of heart point constitutes the corresponding anchor frame of the test object and is distributed figure, is then distributed figure corresponding one according to the anchor frame
Series of anchors frame is trained until callout box and the offset minimum for generating frame relative to anchor frame, after being trained detection model
Detection model, detected using surface defect of the detection model after training to the test object, obtain surface defect
Frame is generated, so that the surface defects detection result of target object is more acurrate, reduces and generates nonsensical anchor frame data, from
And reduce the waste to calculating with storage resource.
Specific embodiment
With reference to the accompanying drawing, specific embodiments of the present invention will be described in detail, it is to be understood that guarantor of the invention
Shield range is not limited by the specific implementation.
Unless otherwise explicitly stated, otherwise in entire disclosure and claims, term " includes " or its change
Changing such as "comprising" or " including " etc. will be understood to comprise stated element or component, and not exclude other members
Part or other component parts.
Fig. 1 is the flow diagram for the networked resource concocting method that the embodiment of the present invention one provides, as shown in Figure 1, should
Method includes the following steps S101~S103:
S101, a series of generation anchor frames corresponding with the regularity of distribution of callout box position of test object, it is described a series of
The distribution of anchor frame central point constitutes the corresponding anchor frame of the test object and is distributed figure.
In the present embodiment, the callout box can be artificial mark and obtain, and the anchor frame is artificial preset value.The mesh
Marking object can be all kinds of fruit, such as navel orange, or other objects, the application do not limit this.
In practical application, the executing subject of the present embodiment can be the detection device of body surface defect, the body surface
The detection device of defect can be realized by virtual bench, such as software code, can also be by being written with related execution code
Entity apparatus realize, such as USB flash disk, then alternatively, can also be realized by being integrated with the related entity apparatus for executing code, example
Such as, chip, intelligent measurement machine etc..
Example is carried out in conjunction with actual scene: by taking the executing subject of the present embodiment is intelligent measurement machine as an example.Practical application
In, intelligent measurement machine firstly generates anchor collimation mark note figure corresponding with target object shape, for example, if the target object is
Apple is then just designed as the shape of the corresponding callout box statistical result of apple for the central point distribution figure of the anchor frame of detection,
If the target object is navel orange, the central point distribution figure of the anchor frame for detection is just designed as the corresponding callout box of navel orange
The shape of statistical result.After generating anchor collimation mark note figure corresponding with target object shape, step S102 can be carried out.
S102, detection model is trained according to a series of anchor frame distribution figure corresponding anchor frames, is trained
Detection model afterwards.
Specifically, first generating a series of anchor frames after generating anchor collimation mark note figure corresponding with target object shape, being arranged
Good anchor frame and detection model other parameters, after detection model is trained according to a series of anchor frames of generation, until callout box
It is minimum relative to the offset of anchor frame with frame is generated, so that the detection model after being trained, is detected again after training.Institute
State the output for generating that frame is detection model.
S103, it is detected using surface defect of the detection model after training to the test object, obtains surface and lack
It falls into and generates frame.
In the present embodiment, detected using surface defect of the detection model after training to test object, obtained inspection
Surveying result is that surface defect generates frame, and taking the form of with a frame is generated for testing result frames defect, it will be understood that should
Generating frame is using anchor frame as reference study from artificial callout box.
In the present embodiment, the testing result may include type, center point coordinate, confidence level of defect etc., described to lack
Sunken type can be pre-set.Such as after carrying out surface defects detection to navel orange, the type of available defect A is corruption
Rotten, confidence level 80%, the type of defect B is to damage by worms, confidence level 90%.
The detection method of body surface defect provided in this embodiment firstly generates and the callout box position of test object
A series of corresponding anchor frames of the regularity of distribution, a series of distribution of anchor frame central points constitute the corresponding anchor frame of the test object
It is distributed figure, a series of corresponding anchor frames of figure is then distributed according to the anchor frame, detection model is trained, until mark
Frame and generation frame are minimum relative to the offset of anchor frame, and the detection model after being trained utilizes the detection model pair after training
The surface defect of the test object is detected, and is obtained surface defect and is generated frame, so that the surface defect of target object
Testing result is more acurrate, reduces and generates nonsensical anchor frame data, to reduce the waste to calculating with storage resource.
In the present embodiment, the embodiment of generation anchor frame distribution figure corresponding with test object callout box can have more
Kind, in a kind of preferred embodiment, as shown in Fig. 2, based on above-described embodiment, above-mentioned steps S101, may include with
Lower step:
S201, the corresponding target image of the test object is obtained.
S202, the target image is labeled, obtains the corresponding labeled data collection of the target object.
Specifically, can be using artificial mark to the mark of target image, the application is without limitation.
S203, it concentrates the coordinate of each callout box central point to count the labeled data, obtains statistical result.
Specifically, the coordinate of each callout box central point labeled data can be concentrated to count in a coordinate system, from
And it can be detected the regularity of distribution of the callout box position of object.
S204, according to the statistical result, using collapse operator by current square anchor frame distribution figure be mapped as with
A series of corresponding anchor frames of the regularity of distribution of the callout box position of the test object, a series of distribution of anchor frame central points
Constitute the corresponding anchor frame distribution figure of the test object.
Specifically, will work as according to the corresponding statistical result of test object callout box, then using the operator of collapsing being pre-designed
The anchor frame of preceding square profile is mapped as distribution figure corresponding with the regularity of distribution of callout box position of test object.
Preferably, the operator of collapsing can use following first calculation formula:
Wherein, (x, y) is transformed coordinate;(x0,y0) be transformation before coordinate;(a, b) is center coordinate;K is to collapse
The factor.
Wherein, it according to the difference of target object, needs using the different factors of collapsing, with intelligent measurement machine to navel orange
For surface defect carries out detection screening, the factor of collapsing uses the second calculation formula:
The transformation of navel orange corresponding anchor collimation mark note figure as shown in figure 3, pore is square interior point coordinate in figure, compared with
Big point is the round coordinate after operator transformation of collapsing.
Anchor collimation mark corresponding with target object shape can be accurately generated by present embodiment and infuses figure, after being conducive to
The continuous detection to target object surface defect.
Following is the application Installation practice, can be used for executing the application embodiment of the method.It is real for the application device
Undisclosed details in example is applied, the application embodiment of the method is please referred to.
Fig. 4 is the structural schematic diagram of the detection device of body surface defect provided by Embodiment 2 of the present invention, such as Fig. 4 institute
Show, the apparatus may include:
Generation module 410, for generating a series of anchor frames corresponding with the regularity of distribution of callout box position of test object,
A series of distribution of anchor frame central points constitutes the corresponding anchor frame of the test object and is distributed figure;
Training module 420 instructs detection model for being distributed a series of corresponding anchor frames of figure according to the anchor frame
Practice, the detection model after being trained;
Detection module 430, for being carried out using surface defect of the detection model after the training to the test object
Detection obtains surface defect and generates frame.
The detection device of body surface defect provided in this embodiment firstly generates and the callout box position of test object
A series of corresponding anchor frames of the regularity of distribution, a series of distribution of anchor frame central points constitute the corresponding anchor frame of the test object
It is distributed figure, a series of corresponding anchor frames of figure is then distributed according to the anchor frame, detection model is trained until callout box
It is minimum relative to the offset of anchor frame with generation frame, the detection model after being trained, using the detection model after training to institute
The surface defect for stating test object is detected, and is obtained surface defect and is generated frame, so that the surface defect of target object is examined
Survey result is more acurrate, reduces and generates nonsensical anchor frame data, to reduce the waste to calculating with storage resource.
Preferably, as shown in figure 5, generation module 410, comprising:
Acquiring unit 411, for obtaining the corresponding target image of the test object;
It marks unit 412 and obtains the corresponding labeled data of the target object for being labeled to the target image
Collection;
Statistic unit 413 is obtained for concentrating the coordinate of each callout box central point to count the labeled data
Statistical result;
Map unit 414, for according to the statistical result, using operator of collapsing by current square anchor frame distribution map
Shape is mapped as a series of anchor frames corresponding with the regularity of distribution of callout box position of the test object, in a series of anchor frames
The distribution of heart point constitutes the corresponding anchor frame of the test object and is distributed figure.
Preferably, the operator of collapsing is using the first calculation formula:
Wherein, (x, y) is transformed coordinate;(x0,y0) be transformation before coordinate;(a, b) is center coordinate;K is to collapse
The factor.
Preferably, when body surface defects detection circular to navel orange etc., the factor of collapsing can be calculated using second
Formula:
It can be accurately generated by above embodiment corresponding with the regularity of distribution of callout box position of test object
Anchor collimation mark infuses figure, is conducive to the subsequent detection to target object surface defect.
Fig. 6 is the structural schematic diagram for the electronic equipment that the embodiment of the present invention three provides, as shown in fig. 6, the equipment includes: to deposit
Reservoir 601 and processor 602;
Memory 601, for storing computer program;
Wherein, processor 602 executes the computer program in memory 601, to realize each method embodiment as described above
Provided method.
In embodiment, example is carried out with detection device of the electronic equipment to body surface defect provided by the invention.
Processor can be central processing unit (CPU) or the other forms with data-handling capacity and/or instruction execution capability
Processing unit, and can control the other assemblies in electronic equipment to execute desired function.
Memory may include one or more computer program products, and computer program product may include various forms
Computer readable storage medium, such as volatile memory and/or nonvolatile memory.Volatile memory for example can be with
Including random access memory (RAM) and/or cache memory (cache) etc..Nonvolatile memory for example can wrap
Include read-only memory (ROM), hard disk, flash memory etc..It can store one or more computers on computer readable storage medium
Program instruction, processor can run program instruction, method in each embodiment to realize the application above and/or
Other desired functions of person.Such as input signal, signal component, noise point can also be stored in a computer-readable storage medium
The various contents such as amount.
The embodiment of the present invention four provides a kind of computer readable storage medium, stores in the computer readable storage medium
There is computer program, for realizing side provided by each method embodiment as described above when which is executed by processor
Method.
In practical application, the computer program in the present embodiment can be with any group of one or more programming languages
It closes to write the program code for executing the embodiment of the present application operation, programming language includes object-oriented programming
Language, Java, C++, python etc. further include conventional procedural programming language, such as " C " language or similar
Programming language.Program code can be executed fully on the user computing device, partly execute, make on a user device
It is executed for an independent software package, part partially executes on a remote computing on the user computing device or complete
It is executed in remote computing device or server.
In practical application, computer readable storage medium can be using any combination of one or more readable mediums.It can
Reading medium can be readable signal medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can include but is not limited to electricity,
Magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Readable storage medium storing program for executing
More specific example (non exhaustive list) includes: electrical connection with one or more conducting wires, portable disc, hard disk, random
It accesses memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable
Formula compact disk read-only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
The aforementioned description to specific exemplary embodiment of the invention is in order to illustrate and illustration purpose.These descriptions
It is not wishing to limit the invention to disclosed precise forms, and it will be apparent that according to the above instruction, can much be changed
And variation.The purpose of selecting and describing the exemplary embodiment is that explaining specific principle of the invention and its actually answering
With so that those skilled in the art can be realized and utilize a variety of different exemplary implementation schemes of the invention and
Various chooses and changes.The scope of the present invention is intended to be limited by claims and its equivalents.