[summary of the invention]
To overcome current detection recognition method to detect the low defect of recognition accuracy in target size sensitivity, the present invention
There is provided a kind of image detection recognition methods and system, electronic equipment, image classification network optimized approach and system in order to solve on
It states technical problem and a kind of image detection recognition methods is provided, include the following steps: S1, provide at least one target to be identified
Testing image;S2, the target to be identified in the testing image is detected with acquisition and institute using detection disaggregated model
State the corresponding mask image of target to be identified;S3, by the exposure mask figure in the testing image and the step S2 in the step S1
As merging to obtain multichannel image;And it S4, the multichannel image is inputted into trained sorter network detects
To classify to the target to be identified.
Preferably, the step S2 specifically comprises the following steps: that step S21, positioning are corresponding with each target to be identified
Rectangle frame;Step S22, mask image corresponding with the target to be identified is obtained according to the rectangle frame.
Preferably, the step S2 further includes the following steps executed between the step S21 and the step S22:
Step S21A, confidence level corresponding with each rectangle frame is obtained;Step S21B, according to the size between confidence level and preset threshold
Relationship determines whether the rectangle frame is qualified;If so, corresponding execute step S22;If it is not, then returning to step S21.
Preferably, if it is determined that the rectangle frame is qualification, then further include between the above-mentioned steps S21B and step S22
Step S21C, by the rectangle frame according to preset scaling zoom in and out with obtain it is corresponding more with each target to be identified
A different rectangle frame of size.
Preferably, in the step S22,255 are set by the pixel value in the rectangle frame, by the rectangle frame with
The pixel value in outer region is set as 0 to obtain bianry image, and the bianry image is the mask image.
Preferably, in the step S3, port number, width and height based on the mask image and described to be measured
Port number, width and the height of image, which are done, to be merged to obtain the multichannel image, and the port number of the testing image is corresponding
Port number for n, the multichannel image after merging corresponds to n+1.
In order to solve the above-mentioned technical problem, the present invention also provides a kind of image classification network optimized approach, including walk as follows
It is rapid: T1, to provide the testing image at least one target to be identified;T2, using detection disaggregated model by the testing image
In target to be identified detected to obtain mask image corresponding with the target to be identified;T3, will be in the step S1
Testing image and the step S2 in mask image merge to obtain multichannel image;And T4, by the multi-pass
Road image inputs trained sorter network as training set and is trained with the sorter network after being optimized.
In order to solve the above-mentioned technical problem, the present invention also provides a kind of image detection identifying systems, comprising: image obtains single
Member, for obtaining the testing image at least one target to be identified;Detection unit, for by the testing image to
Identification target is detected to obtain mask image corresponding with each target to be identified;Combining unit, being used for will be described to be measured
Image and the mask image are merged to obtain multichannel image;Taxon, for inputting the multichannel image
Trained sorter network is detected to classify to the target to be identified.
In order to solve the above-mentioned technical problem, the present invention also provides a kind of image classification network optimization systems, which is characterized in that
It include: image acquisition unit, for obtaining the testing image at least one target to be identified;Detection unit is used for institute
The target to be identified in testing image is stated to be detected to obtain mask image corresponding with each target to be identified;Merge single
Member, for merging the testing image and the mask image to obtain multichannel image;Training unit is used for institute
It states multichannel image and inputs trained sorter network and be trained with the sorter network after being optimized.
In order to solve the above-mentioned technical problem, also offer a kind of electronic equipment, including memory and processor is described by the present invention
Computer program is stored in memory, the computer program is arranged to execute image detection knowledge as described above when operation
Other method;The processor is arranged to execute image detection recognition methods as described above by the computer program.
Compared with the existing technology, when the detection for treating mapping piece starts, exposure mask is obtained using detection disaggregated model prediction
Image, mask image distinguish target to be identified with background, to improve knowledge of the detection disaggregated model to target to be identified
Other efficiency, while further merging mask image and testing image to obtain multichannel image, due to multichannel image
Represent target to be identified more fully information relative to testing image, be inputted trained sorter network detected with
Classify to the target to be identified, the accuracy rate of detection can be improved well and finer classification results can be obtained.
Determine whether the rectangle frame is qualified according to the size relation between confidence level and preset threshold value, with more in acquisition
The initial stage of channel image is managed, and the accuracy for treating the detection classification of mapping piece is further increased.
When the posting qualification, according to preset scaling to rectangle frame zoom in and out with obtain with each wait know
The different rectangle frame of the corresponding multiple sizes of other target, therefore, multiple multichannel images of acquisition improve the preparation of classification
Property, while the data set of abundant training sorter network, the performance of the sorter network after further increasing training.
Also trained sorter network is trained using multichannel image as training set after being optimized
Sorter network promotes the model performance of sorter network, to obtain more accurate inspection in subsequent picture detection identification process
Survey classification results
Image classification network optimized approach provided by the invention, electronic equipment has and described image detection recognition method phase
Same beneficial effect.
[specific embodiment]
In order to make the purpose of the present invention, technical solution and advantage are more clearly understood, below in conjunction with attached drawing and embodiment,
The present invention will be described in further detail.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention,
It is not intended to limit the present invention.
Referring to Fig. 1, first embodiment of the invention provides a kind of image detection recognition methods, include the following steps:
S1, the testing image at least one target to be identified is obtained;
S2, using detection disaggregated model by the target to be identified in the testing image detect with obtain with it is described to
Identify the corresponding mask image of target;
S3, the mask image in the testing image and the step S2 in the step S1 is merged it is more to obtain
Channel image;And it S4, the multichannel image is inputted into trained sorter network detects to the target to be identified
Classify.
In the step S1, the testing image is the picture or video obtained by camera shooting.When for video
When, the testing image is each frame image for intercepting out from video.It is appreciated that according to the analysis task of setting,
It may include a target to be identified or multiple targets to be identified in each testing image.For example, there is 1 bottle of mine in a picture
Spring and 3 bottles of colas, when need to carry out mineral water detection identification when, target to be identified be 1, when need to cola into
When row detection identification, target to be identified is 3.
Referring to Fig. 2, in the step S2, using detection disaggregated model by the target to be identified in the testing image
It is detected to obtain mask image corresponding with the target to be identified.Specifically comprise the following steps:
Step S21, positioning rectangle frame corresponding with each target to be identified;And
Step S22, mask image corresponding with the target to be identified is obtained according to the rectangle frame.
In the step S21, by detection disaggregated model positioning rectangle frame corresponding with each target to be identified,
The rectangular area where the maximum boundary of target to be identified is contained in the rectangle frame, as shown in Figure 2 a, is with bottled drink
, there is the first beverage 200 and the second beverage 300, rectangle frame 400 is accurately positioned the first beverage 200 respectively in testing image 20
With the rectangular area where 300 maximum boundary of the second beverage.It is appreciated that the detection algorithm of common detection disaggregated model is usual
Including any one of Faster R-CNN, Cascade R-CNN and Mask R-CNN, details are not described herein.
In the step S22, mask image corresponding with the target to be identified is obtained according to the rectangle frame, is had
Gymnastics is made as follows: in this step, a threshold value can be set based on empirical value or the characteristics of pretreatment image, with this threshold value
Binary conversion treatment is carried out, the pixel that all gray scales are more than or equal to threshold value is judged as belonging to the edge of bubble, gray value
(i.e. relative to be white) indicates for 255, sets 255 for the pixel value in the rectangle frame;Otherwise these pixels are arranged
In addition in object area, gray value is 0 (i.e. relative to for black) indicates, also i.e. by the region other than the rectangle frame
Pixel value is set as 0.It can carry out binary conversion treatment, institute to pretreatment image by two functions in OpenCV algorithm
Two functions stated are as follows:
(1) cvThreshold (dst, dst, 230,255, CV_THRE SH_BINARY_INV);
(2) cvAdaptiveThreshold (dst, dst, 255, CV_ ADAPTIVE_THRESH_MEAN_C,
CV_THRESH_BINARY, 9, -10)
Therefore, the bianry image is the mask image, as shown in Figure 2 a.
Referring to Fig. 3, the step S2 further comprise executed between the step S21 and the step S22 as
Lower step:
Step S21A, confidence level corresponding with each rectangle frame is obtained;
Step S21B, step S21B, according to the size relation between confidence level and preset threshold, determine that the rectangle frame is
No qualification;
If so, corresponding execute step S22;
If it is not, then returning to step S21.
In the step S21A, the confidence level corresponding with each rectangle frame of acquisition is also by making in the step s 21
Detect what disaggregated model obtained.That is, again by algorithm Faster R-CNN, Cascade R-CNN and Mask
What any one of R-CNN was obtained.
It is whether qualified according to rectangle frame described in the confidence declaration in the step S21B, it is by setting one
Threshold value, if the confidence level is more than or equal to the threshold value of setting, then it is assumed that the rectangle frame is qualified, otherwise it is assumed that the rectangle
Frame is unqualified.It is to be understood that the rectangle frame qualification, which just represents the rectangle frame, to carry out the target to be identified very
Good confines, for example, confining target to be identified 100% in the rectangle frame, alternatively, the region of 80%-95% wait know
Other target is confined in the rectangle frame, otherwise it is assumed that the rectangle frame is unqualified.When the rectangle frame is unqualified, need
Return to step S21.
Referring to Fig. 4, the step S2 further includes step S21C,
If so, namely when the rectangle frame qualification, then corresponding to and executing step S21C: by the rectangle frame according to preset
Scaling is zoomed in and out to obtain multiple different rectangle frames of size corresponding with each target to be identified;The step
S21C is between the step S21B and the step S22.It is usually a target to be identified in the rectangle frame that step 21 positions
A corresponding rectangle frame obtains and each after by zooming in and out to each rectangle frame according to preset scaling
The different rectangle frame of the corresponding multiple sizes of target to be identified, to form multiple with the to be measured of various sizes of rectangle frame size
Image.Optionally, the scaling is set according to empirical value, such as: it can be the rectangle frame in step 21
0.8 times, 0.85 times, 0.9 times, 1.05 times, 1.1 times, 1.2 times or other numerical value.By the rectangle frame according to preset scaling
Ratio is zoomed in and out to obtain the testing image collection for more representing each target to be identified, so that being based on the testing image collection training
Sorter network obtain better classification and Detection effect.
Referring to Fig. 1, in the step S3, by covering in the testing image and the step S2 in the step S1
Film image merge with obtain multichannel image be port number, width and height based on the mask image and it is described to
Port number, width and the height of altimetric image are done and are merged to obtain the multichannel image.The port number pair of the testing image
It should be n, the port number of the multichannel image after merging corresponds to n+1.For example, the width of testing image, height and port number
It is respectively as follows: W1, H1 and n;Width, height and the port number of mask image are respectively as follows: W2, H2 and 1, merge by the two
When, it is to be overlapped the width, height and port number respectively.The width of multichannel image after merging, height and
Port number is respectively as follows: W1+W2, H1+H2 and n+1.It is understood that testing image is usually color image, it is RGB threeway
Road image, i.e. its port number are 3.It is understood that due in step 21C by the rectangle frame according to preset pantograph ratio
Example is zoomed in and out to obtain multiple sizes corresponding with target to be identified not identical rectangular frame, therefore, in this step, with every
The corresponding multichannel image of testing image is multiple.
Referring to Fig. 1, in the step S4, the multichannel image S4, is inputted into trained sorter network
It is detected to classify to the target to be identified.In this step, the trained sorter network is existing normal
Sorter network, such as any one of SSD, yolo, faster-rcnn and mask-rcnn or other sorter networks.
Referring to Fig. 5, second embodiment of the invention provides a kind of image classification network optimized approach comprising first implements
Step S1- step S3 and step: the T4 of example offer, trained classification net is inputted using the multichannel image as training set
Network is trained with the sorter network after being optimized.
In the step T4, the trained sorter network be existing common sorter network, as SSD, yolo,
Faster-rcnn and any one of mask-rcnn or other sorter networks.
Referring to Fig. 6, the third embodiment of the present invention provides a kind of image detection identifying system 100 comprising: image obtains
Take unit 101, detection unit 102, combining unit 103 and taxon 104.
Image acquisition unit 101, for obtaining the testing image at least one target to be identified;
Detection unit 102, for by the target to be identified in the testing image detect with obtain with each wait know
The corresponding mask image of other target;
Combining unit 103, for merging the testing image and the mask image to obtain multichannel image;
Taxon 104 is detected for the multichannel image to be inputted trained sorter network to described
Target to be identified is classified.
Referring to Fig. 7, the detection unit 102 includes: posting generation unit 1021 and mask image generation unit
1022。
Wherein, posting generation unit 1021, for generating rectangle frame corresponding with each target to be identified;
Mask image generation unit 1022, for obtaining exposure mask corresponding with each target to be identified according to the rectangle frame
Image.
Referring to Fig. 8, the image classification network optimization system 200 that the fourth embodiment of the present invention provides comprising third
Detection unit 102, combining unit 103 and the training unit 205 that embodiment provides.The training unit 205 is used for will be described more
Channel image inputs trained sorter network and is trained with the sorter network after being optimized.
Referring to Fig. 9, the fifth embodiment of the present invention provides a kind of electronic equipment 700, including memory 701 and processor
702, computer program is stored in the memory 701, the computer program is arranged to be executed when operation as first is real
Apply image detection recognition methods described in example;
The processor 702 is arranged to execute image detection as in the first embodiment by the computer program
Recognition methods.
Below with reference to Figure 10, it illustrates the terminal device/server calculating for being suitable for being used to realize the embodiment of the present application
The structural schematic diagram of machine system 800.Terminal device/server shown in Fig. 8 is only an example, should not be implemented to the application
The function and use scope of example bring any restrictions.
As shown in Figure 10, computer system 800 includes central processing unit (CPU) 801, can be read-only according to being stored in
Program in memory (ROM) 802 is loaded into the program in random access storage device (RAM) 803 from storage section 808
And execute various movements appropriate and processing.In RAM803, also it is stored with system 800 and operates required various program sum numbers
According to.CPU801, ROM802 and RAM803 are connected with each other by bus 804.Input/output (I/O) interface 805 is also connected to
Bus 804.
I/O interface 805 is connected to lower component: the importation 806 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 807 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 808 including hard disk etc.;
And the communications portion 809 of the network interface card including LAN card, modem etc..Communications portion 809 via such as because
The network of spy's net executes communication process.Driver 810 is also connected to I/O interface 805 as needed.Detachable media 811, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 810, in order to read from thereon
Computer program be mounted into storage section 808 as needed.
Disclosed embodiment according to the present invention may be implemented as computer software above with reference to the process of flow chart description
Program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 809, and/or from detachable media
811 are mounted.When the computer program is executed by central processing unit (CPU) 801, limited in execution the present processes
Above-mentioned function.It should be noted that computer-readable medium described herein can be computer-readable signal media or
Computer readable storage medium either the two any combination.Computer readable storage medium for example can be-but not
Be limited to-electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.It calculates
The more specific example of machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, portable of one or more conducting wires
Formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory
(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or
The above-mentioned any appropriate combination of person.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereof
Machine program code, described program design language include object oriented program language-such as Java, Smalltalk, C+
+, it further include conventional procedural programming language-such as " such as " language or similar programming language.Program code can
Fully to execute, partly be executed on management end computer, as an independent software package on management end computer
It executes, partially part executes on the remote computer or completely in remote computer or server on management end computer
Upper execution.In situations involving remote computers, remote computer can pass through the network of any kind --- including local
Net (LAN) or the domain wide area network (WAN) are connected to management end computer, or, it may be connected to outer computer (such as using because
Spy nets service provider to connect by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Compared with the existing technology, when detecting beginning, detection disaggregated model prediction is utilized to obtain mask image, mask image
Target to be identified is distinguished with background, to improve detection disaggregated model to the recognition efficiency of target to be identified, while into
One step merges mask image and testing image to obtain multichannel image, and multichannel image is represented relative to testing image
Target to be identified more fully information, be inputted trained sorter network detected with to the target to be identified into
Row classification, can improve the accuracy rate of detection well and can obtain finer classification results.
Determine whether the rectangle frame is qualified according to the size relation between confidence level and preset threshold value, with more in acquisition
The initial stage of channel image is managed, and the accuracy for treating the detection classification of mapping piece is further increased.
When the posting qualification, according to preset scaling to rectangle frame zoom in and out with obtain with each wait know
The different rectangle frame of the corresponding multiple sizes of other target, therefore, multiple multichannel images of acquisition improve the preparation of classification
Property, while the data set of abundant training sorter network, the performance of the sorter network after further increasing training.
Also trained sorter network is trained using multichannel image as training set after being optimized
Sorter network promotes the model performance of sorter network, to obtain more accurate inspection in subsequent picture detection identification process
Survey classification results
The present invention, which provides image detection identifying system, electronic equipment and has, identical with described image detection recognition method to be had
Beneficial effect.
The foregoing is merely present pre-ferred embodiments, are not intended to limit the invention, it is all principle of the present invention it
Any modification made by interior, equivalent replacement and improvement etc. should all be comprising within protection scope of the present invention.