CN106651883B - Excrement form identification method based on machine vision - Google Patents

Excrement form identification method based on machine vision Download PDF

Info

Publication number
CN106651883B
CN106651883B CN201611261590.9A CN201611261590A CN106651883B CN 106651883 B CN106651883 B CN 106651883B CN 201611261590 A CN201611261590 A CN 201611261590A CN 106651883 B CN106651883 B CN 106651883B
Authority
CN
China
Prior art keywords
image
excrement
color
stool
value
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.)
Active
Application number
CN201611261590.9A
Other languages
Chinese (zh)
Other versions
CN106651883A (en
Inventor
罗林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Orienter Biotechnology Co Ltd
Original Assignee
Sichuan Orienter Biotechnology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Orienter Biotechnology Co Ltd filed Critical Sichuan Orienter Biotechnology Co Ltd
Priority to CN201611261590.9A priority Critical patent/CN106651883B/en
Publication of CN106651883A publication Critical patent/CN106651883A/en
Application granted granted Critical
Publication of CN106651883B publication Critical patent/CN106651883B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20224Image subtraction

Landscapes

  • Investigating Or Analysing Biological Materials (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of image processing, and discloses a stool form identification method based on machine vision. The method comprises the steps of extracting an excrement area image from an excrement sample image, carrying out color matching on pixels one by one and an excrement standard color card, and finally obtaining the color of the excrement sample image based on statistics, so that the color of excrement can be effectively identified. Meanwhile, the shape of the excrement can be effectively recognized based on a convolutional neural network model. In addition, the method has the advantages of high identification precision, high processing speed, good user experience and the like, and is convenient for practical application and popularization.

Description

Excrement form identification method based on machine vision
Technical Field
the invention relates to the technical field of image processing, in particular to a stool form identification method based on machine vision.
Background
Although the starting time is later, a real-time detection system and an automatic device based on the color recognition technology emerge like spring shoots after rain and gradually enter the daily life of people. For example, in the medical field, the health condition of teeth is judged according to the color of the teeth; judging the content of glucose in blood according to the color change condition of the blood glucose test paper; analyzing the components of the urine according to the color change condition of the urine test strip; the color of the cells is used for classifying the cells and analyzing the condition of the cells. For example, in agriculture, weeds, insects, and the like in crops are identified based on the color of plants; judging the growth condition and whether the insect pest exists according to the color of the leaves of the crops; judging whether the crops are mature according to the color of the fruits, and the like. At present, the color recognition system developed in China is still in the starting stage, and is inferior to the foreign system in the aspects of recognition accuracy, sensitivity and efficiency. The color recognition system is widely used, and the color recognition system of the vehicle body, the color recognition system of the remote sensing image, the color recognition system of industrial products and crops and the like make great contribution to our lives.
For the examination of the feces (commonly known as stool, food residue and excrement of human or animal) which are frequently contacted in medical diagnosis, the disease condition is mainly judged according to the stool form (including color and shape).
For the color of the feces, the possibility of the existence of the fecal blood is preliminarily diagnosed according to the determination of the color of the feces, so that a patient with the gastrointestinal hemorrhage is preliminarily screened, which is often combined with a fecal occult blood test. Stool color varies from food to food, and certain medications can change color. It is generally normal for adults to be tan and infants to be golden. And (3) abnormal results: when the upper gastrointestinal bleeding occurs, the feces are black and glossy, namely asphalt-like, and hemoglobin is decomposed and forms black iron sulfide when blood passes through the intestinal tract; the administration of active carbon, bismuth agent, iron agent, Chinese herbal medicine, etc. has gray black color, but no luster; the surface layer can also become grey black after the excrement specimen is placed for a long time, and the excrement of the obstructive jaundice patient is lack of bile pigment and is white argil-colored excrement; after the barium meal of the digestive tract is developed, the excrement is grey white; in the case of dyspepsia of infants, the feces contain biliverdin and thus are green and thin due to the fact that the intestinal peristalsis is too fast. The people needing to be checked: patients who are suspected to have upper gastrointestinal hemorrhage and need to be diagnosed are patients with symptoms of hemoptysis and hematemesis.
For stool shape: the examination of the shape of the stool can help diagnose various intestinal diseases. Since three quarters of the feces are water, the rest are mostly protein, inorganic substances, fat, undigested dietary fiber, dehydrated digestive juice residue, and cells and dead bacteria shed from the intestinal tract, as well as vitamin K and vitamin B. The normal condition is soft stool, and the abnormal result is: the feces of the patients with constipation are spherical hard blocks; porridge-like or watery stool is caused by diarrhea caused by various reasons; rice soup-like is found in cholera and also in patients with parachoea; dark or pitch-like bleeding is a bleeding which is usually caused by the esophagus, stomach and duodenum; bleeding of stool, bright red as near blood, and bleeding in large intestine or hemorrhoid; a loose stool with poor appetite and an abdominal distention indicates a deficiency of spleen yang. The people needing to be checked: abnormal stool, abnormal defecation.
Until now, color and shape detection of feces has been carried out by visual observation, and the shape of feces (hard stool, soft stool, loose stool, watery stool, pasty or thin juice-like stool, loose stool, rice-swill-like stool, frozen stool, white pottery-like stool, thin strip-like stool) is mainly concerned. There are no studies on color recognition and naming, but stool color recognition naming is not studied, and stool shape automatic recognition is not studied at present. Each person perceives a different color and thus the human eye can make a relatively large difference in the nomenclature for stool color. Meanwhile, because of the particularity of the stool, nausea is easily brought to people, so that automatic identification of the color and the shape of the stool is very necessary.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a stool form identification method based on machine vision, which comprises the steps of extracting a stool area image from a stool sample image, carrying out color matching on pixels one by one with a stool standard color card, and finally obtaining the color of the stool sample image based on statistics, so that the stool color can be effectively identified. Meanwhile, the shape of the excrement can be effectively recognized based on the neural network model. In addition, the method has the advantages of high identification precision, high processing speed, good user experience and the like, and is convenient for practical application and popularization.
The technical scheme adopted by the invention provides a stool form identification method based on machine vision, aiming at stool color identification, the method comprises the following steps:
S101, introducing a stool sample image ISPAnd a background image IBG
S102, applying the background image IBGFor the fecal sample image ISPDifference processing is carried out to extract an excrement area image IFA
S103, aiming at the excrement area image IFAEach pixel point in the image is respectively subjected to Min-type distance operation based on RGB value, HSV value and/or Lab value with various excrement standard colors, and the excrement standard color with the minimum Min-type distance is used as the excrement standard color of the pixel point;
S104, counting the night soil region image IFAMarking the standard color with the maximum number of pixel points as the image I of the fecal regionFAThe color of (c).
Optimized when said stool specimen image ISPWith the background image IBGWhen the luminance difference value is lower than the first threshold value, the step S102 includes the steps of:
S201, aiming at the excrement sample image ISPAnd the background image IBGRespectively carrying out image normalization processing to obtain corresponding normalized images NI of the fecal samplesSPAnd background normalized image NIBG
S202, respectively obtaining the normalized image NI of the excrement sample according to the following formulaSPMinimum value of RGB of each pixel pointAnd said background normalized image NIBGMinimum value of RGB of each pixel point
Where min () is the minimum function, NI(i,j)(R) is the R color component value, NI, of the pixel point (i, j) in the normalized image NI(i,j)(i, G) is the G color component value of the pixel point (i, j) in the normalized image NI, NI(i,j)(ii), (i, j) is the pixel coordinate in the normalized image NI;
S203, normalizing image NI in the fecal sampleSPin (1), extractingObtaining the image I of the excrement area in the pixel point area larger than the second threshold valueFA
Optimized when said stool specimen image ISPwith the background image IBGIs higher than or equal to the first threshold, the step S102 includes the steps of:
S301, enabling the excrement sample image I to beSPAnd the background image IBGRespectively converting from RGB space to HSV space;
S302, feces sample image I in HSV spaceSPAnd a background image IBGRespectively carrying out image normalization processing to obtain corresponding fecal samplesNormalized image NISPAnd background normalized image NIBG
s303, normalizing the image NI in the excrement sampleSPIn (1), extractingObtaining a feces region image under HSV space by pixel point regions larger than a third threshold value, wherein NIH(i,j)is the H component value of the pixel point (i, j) in the normalized image NI, (i, j) is the pixel point coordinate in the normalized image NI;
S304, converting the excrement area image in the HSV space from the HSV space to an RGB space to obtain an excrement area image IFA
optimally, in the step S103, a minmi distance operation based on the RGB value, HSV value and Lab value is performed according to the following formula:
In the formula, DRGBIs a minz-like distance under the RGB space,AndRespectively as the fecal region image IFARespective component values, L, in RGB spaceR、LGAnd LBRespectively are all component values D of the feces standard color L in RGB spaceLabIs the mink distance under the Lab space,AndRespectively as the fecal region image IFARespective component value, L, in Lab spaceL、LaAnd LbRespectively the components of the standard color L of the excrement in Lab spaceMagnitude, gamma1、γ2And gamma3The weight coefficients corresponding to the components in the Lab space are respectively, the value ranges of the weight coefficients are respectively 0.1-0.3, 0.3-0.5 and 0.3-0.5, and DHSVis the mink distance under the LSV space,Andrespectively as the fecal region image IFARespective component values, L, in LSV spaceH、LSAnd LVRespectively are all component values, kappa, of the fecal standard color L in HSV space1、κ2And kappa3The weighting coefficients corresponding to all components in HSV space respectively have the value ranges of 0.4-0.6, 0.2-0.4 and 0.1-0.2, n is a natural number between 4-8, and D is the sum of Min-type distances in three spaces.
Optimally, an SSE instruction set is selected to perform acceleration operation on the step S103.
optimized for stool shape recognition, comprising the steps of:
S601, aiming at various standard shapes of the excrement shape, training a convolutional neural network model of the standard shape by applying a corresponding sample image training set and a corresponding sample image testing set to obtain a corresponding convolutional neural network matching model;
S602, applying various standard-shaped convolutional neural network matching models to respectively conduct import fecal sample images ISPCarrying out matching identification, and marking the standard shape with the highest matching rate as the feces sample image ISPThe shape of (2).
And further optimally, the convolution neural network model adopts an Alex-net convolution neural network model.
in summary, the stool form identification method based on machine vision provided by the invention has the following beneficial effects: (1) firstly, extracting an excrement area image from an excrement sample image, then carrying out color matching on the excrement area image and an excrement standard color card one by one, and finally obtaining the color of the excrement sample image based on statistics, so that the color of excrement can be effectively identified; (2) the shape of the excrement can be effectively recognized based on a convolutional neural network model; (3) the method also has the advantages of high identification precision, high processing speed, good user experience and the like, and is convenient for practical application and popularization.
Drawings
in order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a stool form identification method based on machine vision provided by the invention.
fig. 2 is an extraction illustration of a stool region image under normal conditions, provided by the present invention, wherein (a) is a stool sample image, and (b) is an extracted stool region image.
Fig. 3 is an extraction illustration of a stool region image under an overexposure condition, wherein (a) is a stool sample image, and (b) is an extracted stool region image.
Fig. 4 is a flowchart of a color matching process performed by applying the SEE instruction set according to the present invention.
Detailed Description
hereinafter, a stool form recognition method based on machine vision according to the present invention will be described in detail by way of embodiments with reference to the accompanying drawings. It should be noted that the description of the embodiments is provided to help understanding of the present invention, but the present invention is not limited thereto.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, B exists alone, and A and B exist at the same time, and the term "/and" is used herein to describe another association object relationship, which means that two relationships may exist, for example, A/and B, may mean: a alone, and both a and B alone, and further, the character "/" in this document generally means that the former and latter associated objects are in an "or" relationship.
Example one
Fig. 1 is a schematic flow chart of a stool form recognition method based on machine vision according to the present invention, fig. 2 is a diagram illustrating a stool region image extracted under normal conditions according to the present invention, fig. 3 is a diagram illustrating a stool region image extracted under overexposure conditions according to the present invention, and fig. 4 is a flowchart illustrating a color matching process performed by applying an SEE instruction set according to the present invention.
The stool form recognition method based on machine vision provided by the embodiment comprises a stool color recognition method and a stool shape recognition method, wherein the stool color recognition method comprises the following steps.
s101, introducing a stool sample image ISPAnd a background image IBG
In the step S101, the stool sample image ISPAnd the background image IBGthe method is based on images shot by the same camera at the same angle and the same background, and is different in that the former also comprises a stool sample. Further, the background image IBGMay be, but is not limited to, a sampling tube.
S102, applying the background image IBGFor the fecal sample image ISPDifference processing is carried out to extract an excrement area image IFA
in said step S102, the stool sample image I is taken into accountSPWill be applied to the image I of the fecal areaFAthe extraction quality of (a) is greatly influenced, so before the step S102, the fecal sample image I needs to be judged firstSPWhether or not overexposure is present, i.e. calculating the image I of the stool sampleSPWith the background image IBGthen comparing the obtained brightness difference with a first threshold value, if the brightness is highif the degree difference value is lower than a first threshold value, judging the fecal sample image ISPNormal and proper exposure, otherwise, judging the image I of the fecal sampleSPOverexposure. For said difference in brightnessthis can be calculated, but is not limited to, according to the following formula:
Wherein M and N are the fecal sample image ISPOr the background image IBG(due to the stool specimen image ISPAnd the background image IBGImages shot by the same camera, the same background, and the same angle are based on the same image size), the number of pixels in the longitudinal direction and the number of pixels in the width direction, for example, when the image size is (1280 × 720), M is 1280, and N is 720;In the stool sample image ISPThe R color component value of the (i, j) th pixel point,in the stool sample image ISPThe G color component value of the (i, j) th pixel point,In the stool sample image ISPThe B color component value of the (i, j) th pixel point;For in the background image IBGThe R color component value of the (i, j) th pixel point,For in the background image IBGThe (i, j) thThe value of the G color component of a pixel,For in the background image IBGAnd B color component values of the (i, j) th pixel points. The first threshold value can be a default value or a value set manually, and the value of the first threshold value is between 0.08 and 0.12. For example, in this embodiment, the first threshold value is 0.1. For step S102 in the foregoing two cases, the present embodiment provides the following two corresponding extraction methods, respectively.
(1) The first extraction method comprises the following steps: when the fecal sample image ISPWith the background image IBGwhen the luminance difference value is lower than the first threshold value, the step S102 includes the steps of:
S201, aiming at the excrement sample image ISPAnd the background image IBGrespectively carrying out image normalization processing to obtain corresponding normalized images NI of the fecal samplesSPAnd background normalized image NIBG
S202, respectively obtaining the normalized image NI of the excrement sample according to the following formulaSPMinimum value of RGB of each pixel pointAnd said background normalized image NIBGminimum value of RGB of each pixel point
Where min () is the minimum function, NI(i,j)(R) is the R color component value, NI, of the pixel point (i, j) in the normalized image NI(i,j)(i, G) is the G color component value of the pixel point (i, j) in the normalized image NI, NI(i,j)(ii), (i, j) is the pixel coordinate in the normalized image NI;
s203, normalizing image NI in the fecal sampleSPin (1), extractingObtaining the image I of the excrement area in the pixel point area larger than the second threshold valueFA
In the step S203, a value range of the second threshold is between 0.1 and 0.2, and as an optimization, in this embodiment, the second threshold is set to be 0.16. As shown in fig. 2, after the difference processing described in steps S201 to S203 is performed on the stool sample image shown in (a), a stool region image I shown in (b) is extractedFA
(2) The second extraction method comprises the following steps: when the fecal sample image ISPWith the background image IBGis higher than or equal to the first threshold, the step S102 includes the steps of:
S301, enabling the excrement sample image I to beSPand the background image IBGConverting from RGB (Red, Green, Blue, Red, Green, Blue) space to HSV (Hue, Saturation, Value) space respectively;
S302, feces sample image I in HSV spaceSPAnd a background image IBGRespectively carrying out image normalization processing to obtain corresponding normalized images NI of the fecal samplesSPAnd background normalized image NIBG
s303, normalizing the image NI in the excrement sampleSPIn (1), extractingObtaining a feces region image under HSV space by pixel point regions larger than a third threshold value, wherein NIH(i,j)Is the H component value of the pixel point (i, j) in the normalized image NI, (i, j) is the pixel point coordinate in the normalized image NI;
S304, converting the excrement area image in the HSV space from the HSV space to an RGB space to obtain an excrement area image IFA
In the step S301, the stool sample image ISPand the background image IBGThe equations for converting from the RGB space to the HSV space, respectively, are as follows:
V=max(R,G,B)
if H < 0, H +360
0≤V≤1,0≤S≤1,0≤H≤360
In the color model of the HSV space, the H component value is a main factor for determining a color; the larger the value of the S component is (the closer to 1), the purer the color is, the smaller the S component is (the closer to 0), and the closer the color is to pure gray; whereas the V component value resembles spatial luminance information and is closely related to the way a person perceives color, each homogeneous region in a color image corresponds to a relatively uniform hue and saturation (the V component is independent of the color information). Therefore, when overexposure occurs in the photographed stool sample image, it is difficult to obtain the stool object through the brightness information of the image, and thus the stool region image needs to be extracted based on the color component value H.
In the step S304, a value range of the third threshold is between 0.3 and 0.4, and as an optimization, in this embodiment, the third threshold is set to be 0.35. As shown in FIG. 3, after the difference processing described in steps S301 to S304 is performed on the stool sample image shown in (a), a stool region image I shown in (b) is extractedFA
S103, aiming at the excrement area image IFAAnd each pixel point in the image is respectively subjected to Min-type distance operation based on RGB values, HSV values and/or Lab values with various excrement standard colors, and the excrement standard color with the minimum Min-type distance is used as the excrement standard color of the pixel point.
the standard colors of the feces are various colors for effectively distinguishing the colors of the feces, and after a large number of feces region images obtained through the processing of the step S102 are identified according to clinical experience, color naming is performed on the basis of a pandone color chart (i.e., a color chart based on a pandone color chart color matching system, the english name of the pandone color chart color matching system is pandone matchsystem, the name of a chinese official name is "color communication", which is a color communication system covering the fields of printing, weaving, plastics, drawing, science and technology, etc., of the reputable world, and has become a true international color standard language), and part of tables are shown in the following table 1:
TABLE 1 nomenclature table of standard color parts of feces
In table 1 above, for non-classified color values of the color charts, the corresponding stool standard colors may be named "other" because these color chart colors are rare or even not encountered in stool detection.
In step S103, in order to reduce the calculation error caused by directly comparing the RGB values in the image pixel value homochrome, a mink distance operation based on the RGB values, HSV values and Lab (i.e., Lab color model, L represents lightness, a represents a range from magenta to green, and b represents a range from yellow to blue) values is further optimized according to the following formula:
In the formula, DRGBIs a minz-like distance under the RGB space,AndRespectively as the fecal region image IFARespective component values, L, in RGB spaceR、LGAnd LBRespectively are all component values D of the feces standard color L in RGB spaceLabIs Lab spacethe lower minh-like distance is,AndRespectively as the fecal region image IFArespective component value, L, in Lab spaceL、LaAnd LbRespectively, the component values of the standard color L of the excrement in the Lab space, gamma1、γ2And gamma3The weight coefficients corresponding to the components in the Lab space are respectively, the value ranges of the weight coefficients are respectively 0.1-0.3, 0.3-0.5 and 0.3-0.5, and DHSVIs the mink distance under the LSV space,AndRespectively as the fecal region image IFARespective component values, L, in LSV spaceH、LSAnd LVRespectively are all component values, kappa, of the fecal standard color L in HSV space1、κ2And kappa3the weighting coefficients corresponding to all components in HSV space respectively have the value ranges of 0.4-0.6, 0.2-0.4 and 0.1-0.2, n is a natural number between 4-8, and D is the sum of Min-type distances in three spaces. By way of example, in this example, take γ1=0.2;γ2=γ3=0.4;κ1=0.5;κ2=0.3;κ30.2 (since both the L and V components represent luminance characteristics, their corresponding weight coefficients are reduced); n is 6.
the conversion of image colors from RGB space to HSV space, which has been described above, is now described as follows: since the RGB space cannot be directly converted into the Lab space, it needs to be converted into the XYZ space (three-dimensional space for expressing the RBG space, which represents red, green, and blue as X, Y and Z coordinate axes, respectively) and then converted into the Lab, that is: RGB > XYZ > Lab. The conversion formula is thus divided into two parts as follows.
(1) RGB changes XYZ, and assuming R, G, B as three channels of pixels, the value is [0,255], the conversion formula is as follows:
(2) XYZ to Lab, the conversion equation is as follows:
L*=116f(Y/Yn)-16
a*=500[f(X/Xn)-f(Y/Yn)]
b*=200[f(Y/Yn)-f(Z/Zn)]
In the above two formulae, L*,a*And b*The final values for the three channels in the Lab color space, respectively. X, Y and Y are respectively the corresponding coordinate values calculated after RGB is converted into XYZ, Xn、Ynand ZnDefault to 95.047, 100.0, and 108.883, respectively.
In step S103, since the colors of the stool standard color chart are more than 1000, and the number of pixels in the stool region image is at least 8000 (the size of the general stool sample image is 320 × 240, and the extracted stool region image is between 1/10 and 1/6), 800 ten thousand cycles of calculation are required, and if no acceleration process is performed, about 30 seconds are consumed, and the actual application requirements cannot be met. Considering this step as the basic addition, subtraction, multiplication and division operations, the SSE instruction set is chosen to speed up the process. The SSE (streaming SIMD extensions) instruction set is 3D Now!of Intel in AMD (Advanced Micro Devices, Inc. of ultra Micro semiconductors, USA)! (a set of SIMD MultiMedia Instruction set developed by AMD, supporting Single precision floating point vector operations, for enhancing the performance of x86 architecture computers on three-dimensional image processing, SSID (Single Instruction Multiple Data), a Single Instruction Multiple Data stream, which is a set of Instruction sets that can copy Multiple operands and pack them in large registers) was released for one year, and the Instruction set introduced in its computer chip Pentium III was a superset of MMX (MultiMedia eXtensions). AMD has later added support for this instruction set in Athlon XP (a chip product) so that each register can store 4 single-precision floating-point numbers.
Data conversion: since the SSE instruction set can process 4 single-precision floating-point numbers at a time during the computational process, the data needs to be translated before processing. Meanwhile, each pixel point in the excrement area image is stored according to the RGB component values, so that the RGB value of each pixel point is firstly put into one register, but each register stores 4 single-precision floating point numbers, the RGB value of each pixel point is filled, and the fourth single-precision floating point number is filled to be 0. Part of the program code may be, but is not limited to, the following:
Where fecesArea is a fecal region image, and fecesada is a data class that can be calculated using SSE commands after conversion. And converting the Lab and HSV components of the image and the data in the color card table in the same way, wherein the fourth floating point number needs to be filled, and the filling value is 0.
SSE calculation: through SSE calculation color matching, each register stores three-component values of one pixel point, 0 filling is carried out on the fourth single-precision floating point number, namely, one more characteristic value is added during Min distance calculation, but the value is 0, and therefore the result is not affected. The SSE mainly processes the calculation of Min's distance and stores the calculated color distance into the corresponding color index. SSE instructions as used herein primarily include: instruction _ mm _ sub _ ps () for floating-point subtraction, instruction _ mm _ mul _ ps () for floating-point multiplication, and instruction _ mm _ add _ ps () for floating-point addition. The detailed process flow is shown in fig. 4.
through experimental comparison, after the SSE instruction set is adopted for acceleration, the processing time consumption can be shortened from about 30 seconds per picture before non-acceleration to about 0.5 second per picture on average, so that the acceleration ratio is 60, the acceleration effect is obvious, and the actual application requirement is met.
s104, counting the night soil region image IFAMarking the standard color with the maximum number of pixel points as the image I of the fecal regionFAThe color of (c).
In the step S104, the stool region image I may be counted in a histogram mannerFAthe number of the pixel points of the various stool standard colors is counted, and then the stool standard color with the maximum numerical value (namely the number of the pixel points is maximum) in the histogram is marked as the image I of the stool regionFAthe color of (c). By testing 10000 fecal sample images, the accuracy of color identification can reach about 80%.
The method for identifying the shape of the feces comprises the following steps.
S601, aiming at various standard shapes of the excrement shape, a corresponding sample image training set and a corresponding sample image testing set are applied to train the convolutional neural network model of the standard shape, and a corresponding convolutional neural network matching model is obtained.
In step S601, the various standard shapes of the stool shape are effectively differentiated types according to clinical experience, such as but not limited to the following: the 6 types of the excrement are ' semi-loose ' excrement, ' loose ' excrement ', ' soft ' excrement ', ' dry ' excrement ', ' water-like excrement ' and ' other ', wherein ' other ' is some excrement types which are difficult to distinguish. For each standard shape, 8000 stool sample images can be prepared as a sample image training set, 1000 stool sample images are prepared as a sample image testing set, and then the samples are imported into a convolutional neural network model of the standard shape for training to obtain a corresponding convolutional neural network matching model. The convolutional neural network model may be, but is not limited to, an Alex-net convolutional neural network model.
The Alex-net convolutional neural network model (Geoffrey and other students Alex in 2012 came up with image classification in the contest of ImageNet for responding to the challenger, refreshing the record of image classification, and laying the place of deep learning in computer vision at all, the structure used by Alex in this contest is called AlexNet) has a total of 8 layers, of which the first 5 layers are "fundamental-connected" layers (prior art in this field, no corresponding chinese translation, the same below), the last 3 layers are "full-connected", the output of the last "full-connected" layer is "softmax" with 1000 outputs, and the final optimization goal is to maximize the average "multinomial regression". Directly following the first layer conv1 (i.e., the first "contained" layer) and conv2 (i.e., the second "contained" layer) is a "Response-normalization layer", i.e., the norm1 layer and norm2 layer. The operation immediately following each of the "conditional" and "full-connected" layers is a "ReLU" operation. The "Maxpooling" operation is followed by the first norm1 and norm2 layers, and the fifth "conditional" layer, i.e., conv 5. The Dropout operation is at the last two "full-connected" layers.
The finally obtained convolution neural network matching model is that after a caffe deep learning framework is utilized and an Alex-net neural network model is established, a large amount of data is used for carrying out iterative parameter adjustment to obtain a deep learning model, and then the deep learning model can be applied to realize the task of identifying the shape of the excrement. In the context of deep learning, the trained model file is ". The model", before "fine-tuning" parameter tuning, the trained Alex model needs to be downloaded at "git" first, and then "fine-tuning" parameter tuning is performed through the following fine-tuning steps: (1) adjusting network layer parameters, wherein the classification output in the imagenet is set to be 1000 types, so that a vector of 1000 types is formed in the final output layer, the classification types to be made are 6 types, the final output layer needs to be modified, the learning rate of the final output layer is adjusted, and the learning rate of the final output layer needs to be adjusted because the final output layer is relearning, so that the learning rate of the weight and the bias is increased by 10 times, and the learning rate of the rest layers is reduced by 10 times, so that the previous information is reserved; and meanwhile, the number of output nodes of the 'softmax' of the last layer is changed to 6 (corresponding to the type of the standard shape). (2) And modifying the 'Solver' parameter, and setting parameter information required by network training in the 'proto' file. The basic learning rate is reduced to 1/100, the maximum iteration time "max _ iter" is modified to 30000 times, and the modification step size is 20000.
S602, applying various standard-shaped convolutional neural network matching models to respectively conduct import fecal sample images ISPCarrying out matching identification, and marking the standard shape with the highest matching rate as the feces sample image ISPthe shape of (2). By testing 10000 fecal sample images, the identification accuracy of various shapes can reach about 84.2%.
In summary, the stool form identification method based on machine vision provided by the embodiment has the following beneficial effects: (1) firstly, extracting an excrement area image from an excrement sample image, then carrying out color matching on the image with an excrement standard color card pixel by pixel, and finally obtaining the color of the excrement sample image based on statistics, thereby effectively identifying the color of excrement; (2) the shape of the excrement can be effectively recognized based on a convolutional neural network model; (3) the method also has the advantages of high identification precision, high processing speed, good user experience and the like, and is convenient for practical application and popularization.
As described above, the present invention can be preferably realized. It would be obvious to those skilled in the art that the inventive labor is not required to design different forms of machine vision-based stool morphology recognition methods in accordance with the teachings of the present invention. Variations, modifications, substitutions, integrations and variations of these embodiments may be made without departing from the principle and spirit of the invention, and still fall within the scope of the invention.

Claims (6)

1. A stool form recognition method based on machine vision is characterized in that:
Aiming at stool color identification, the method comprises the following steps:
S101, introducing a stool sample image ISPAnd a background image IBG
S102, applying the background image IBGFor the fecal sample image ISPDifference processing is carried out to extract an excrement area image IFA
S103, aiming at the excrement area image IFAEach pixel point in the image is respectively subjected to Min-type distance operation based on RGB value, HSV value and/or Lab value with various excrement standard colors, and the excrement standard color with the minimum Min-type distance is used as the excrement standard color of the pixel point;
s104, counting the night soil region image IFAMarking the standard color with the maximum number of pixel points as the image I of the fecal regionFAThe color of (a);
Aiming at stool shape recognition, the method comprises the following steps:
S601, aiming at various standard shapes of the excrement shape, training a convolutional neural network model of the standard shape by applying a corresponding sample image training set and a corresponding sample image testing set to obtain a corresponding convolutional neural network matching model;
S602, applying various standard-shaped convolutional neural network matching models to respectively conduct import fecal sample images ISPCarrying out matching identification, and marking the standard shape with the highest matching rate as the feces sample image ISPThe shape of (2).
2. As claimed in claim 1The stool form recognition method based on machine vision is characterized in that when the stool sample image I is usedSPWith the background image IBGWhen the luminance difference value is lower than the first threshold value, the step S102 includes the steps of:
S201, aiming at the excrement sample image ISPAnd the background image IBGRespectively carrying out image normalization processing to obtain corresponding normalized images NI of the fecal samplesSPAnd background normalized image NIBG
S202, respectively obtaining the normalized image NI of the excrement sample according to the following formulaSPminimum value of RGB of each pixel pointAnd said background normalized image NIBGminimum value of RGB of each pixel point
where min () is the minimum function, NI(i,j)(R) is the R color component value, NI, of the pixel point (i, j) in the normalized image NI(i,j)(i, G) is the G color component value of the pixel point (i, j) in the normalized image NI, NI(i,j)(ii), (i, j) is the pixel coordinate in the normalized image NI;
S203, normalizing image NI in the fecal sampleSPin (1), extractingObtaining the image I of the excrement area in the pixel point area larger than the second threshold valueFA
3. Machine vision-based stool morphology recognition method according to claim 1Characterized in that when said stool sample image ISPWith the background image IBGis higher than or equal to the first threshold, the step S102 includes the steps of:
S301, enabling the excrement sample image I to beSPAnd the background image IBGRespectively converting from RGB space to HSV space;
s302, feces sample image I in HSV spaceSPAnd a background image IBGRespectively carrying out image normalization processing to obtain corresponding normalized images NI of the fecal samplesSPAnd background normalized image NIBG
S303, normalizing the image NI in the excrement sampleSPIn (1), extractingObtaining a feces region image under HSV space by pixel point regions larger than a third threshold value, wherein NIH(i,j)is the H component value of the pixel point (i, j) in the normalized image NI, (i, j) is the pixel point coordinate in the normalized image NI;
S304, converting the excrement area image in the HSV space from the HSV space to the RGB space to obtain the excrement area image IFA
4. The machine vision-based stool form recognition method according to claim 1, wherein in said step S103, mink distance operation based on RGB value, HSV value and Lab value is performed according to the following formula:
in the formula, DRGBIs a minz-like distance under the RGB space,AndRespectively as the fecal region image IFARespective component values, L, in RGB spaceR、LGAnd LBRespectively are all component values D of the feces standard color L in RGB spaceLabIs the mink distance under the Lab space,AndRespectively as the fecal region image IFArespective component value, L, in Lab spaceL、LaAnd LbRespectively, the component values of the standard color L of the excrement in the Lab space, gamma1、γ2And gamma3The weight coefficients corresponding to the components in the Lab space are respectively, the value ranges of the weight coefficients are respectively 0.1-0.3, 0.3-0.5 and 0.3-0.5, and DHSVIs the mink distance under the LSV space,andRespectively as the fecal region image IFARespective component values, L, in LSV spaceH、LSand LVrespectively are all component values, kappa, of the fecal standard color L in HSV space1、κ2And kappa3The weighting coefficients corresponding to all components in HSV space respectively have the value ranges of 0.4-0.6, 0.2-0.4 and 0.1-0.2, n is a natural number between 4-8, and D is the sum of Min-type distances in three spaces.
5. The stool form recognition method based on machine vision as claimed in claim 1, wherein SSE instruction set is selected to perform acceleration operation on the step S103.
6. The stool form recognition method based on machine vision as claimed in claim 1, wherein the convolutional neural network model adopts Alex-net convolutional neural network model.
CN201611261590.9A 2016-12-30 2016-12-30 Excrement form identification method based on machine vision Active CN106651883B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611261590.9A CN106651883B (en) 2016-12-30 2016-12-30 Excrement form identification method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611261590.9A CN106651883B (en) 2016-12-30 2016-12-30 Excrement form identification method based on machine vision

Publications (2)

Publication Number Publication Date
CN106651883A CN106651883A (en) 2017-05-10
CN106651883B true CN106651883B (en) 2019-12-17

Family

ID=58838051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611261590.9A Active CN106651883B (en) 2016-12-30 2016-12-30 Excrement form identification method based on machine vision

Country Status (1)

Country Link
CN (1) CN106651883B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108009567B (en) * 2017-11-10 2021-11-02 电子科技大学 Automatic excrement character distinguishing method combining image color and HOG and SVM
CN109580618A (en) * 2018-11-23 2019-04-05 鞍钢集团矿业有限公司 A method of floating product grade is judged based on foam color
CN111296300A (en) * 2018-12-11 2020-06-19 中国联合网络通信集团有限公司 Cat excrement treatment method and intelligent cat toilet
CN109670544A (en) * 2018-12-13 2019-04-23 广州小狗机器人技术有限公司 A kind of object detecting apparatus and its acquisition methods, object detecting system
CN109557093A (en) * 2018-12-18 2019-04-02 无锡益诺华科技发展有限公司 A kind of urine detection test paper color measuring algorithm
CN111839446A (en) * 2019-04-25 2020-10-30 天津御锦人工智能医疗科技有限公司 Colonoscope excrement and liquid dung detection method based on deep learning
CN111860533B (en) * 2019-04-30 2023-12-12 深圳数字生命研究院 Image recognition method and device, storage medium and electronic device
CN110222713A (en) * 2019-05-05 2019-09-10 深圳先进技术研究院 A kind of infant's excrement sampled images specification processing system and method
CN110298836A (en) * 2019-07-05 2019-10-01 张文华 The methods, devices and systems of INTESTINAL CLEANSING quality are judged by artificial intelligence
CN112577905A (en) * 2019-09-30 2021-03-30 苏州迈瑞科技有限公司 Urine color detection method and analyzer
CN111183917B (en) * 2019-11-14 2022-02-01 京东科技信息技术有限公司 Animal abnormity monitoring and image processing method and device
CN111709333B (en) * 2020-06-04 2022-05-20 南京农业大学 Tracing early warning system based on abnormal excrement of cage-raised chickens and health monitoring method
CN112183674B (en) * 2020-11-06 2022-06-10 南昌航空大学 Multi-task identification method and system for color and character of macroscopic image of excrement
WO2022132804A1 (en) * 2020-12-14 2022-06-23 Mars, Incorporated Systems and methods for classifying pet information
CN114511585A (en) * 2022-02-17 2022-05-17 Szm株式会社 Excrement analysis method and system
CN116580828B (en) * 2023-05-16 2024-04-02 深圳弗瑞奇科技有限公司 Visual monitoring method for full-automatic induction identification of cat health

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012168085A (en) * 2011-02-16 2012-09-06 Ncd:Kk Method for detecting specific microbial components
CN103136764A (en) * 2011-11-25 2013-06-05 捷达世软件(深圳)有限公司 Method and system for analyzing picture foreground colors
CN105488820A (en) * 2016-02-25 2016-04-13 曹溯 Color comparing method and device
CN105654469A (en) * 2015-12-22 2016-06-08 深圳贝申医疗技术有限公司 Infant stool color automatic analysis method and system
CN205691511U (en) * 2016-06-04 2016-11-16 深圳灵喵机器人技术有限公司 A kind of animal excrements composition detection system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013179581A1 (en) * 2012-05-30 2013-12-05 パナソニック株式会社 Image measurement device, image measurement method and image measurement system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012168085A (en) * 2011-02-16 2012-09-06 Ncd:Kk Method for detecting specific microbial components
CN103136764A (en) * 2011-11-25 2013-06-05 捷达世软件(深圳)有限公司 Method and system for analyzing picture foreground colors
CN105654469A (en) * 2015-12-22 2016-06-08 深圳贝申医疗技术有限公司 Infant stool color automatic analysis method and system
CN105488820A (en) * 2016-02-25 2016-04-13 曹溯 Color comparing method and device
CN205691511U (en) * 2016-06-04 2016-11-16 深圳灵喵机器人技术有限公司 A kind of animal excrements composition detection system

Also Published As

Publication number Publication date
CN106651883A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN106651883B (en) Excrement form identification method based on machine vision
CN106934799B (en) Capsule endoscope visual aids diagosis system and method
JP6999812B2 (en) Bone age evaluation and height prediction model establishment method, its system and its prediction method
CN108830144B (en) Lactating sow posture identification method based on improved Faster-R-CNN
CN110705440B (en) Capsule endoscopy image recognition model based on neural network feature fusion
TWI696145B (en) Colonoscopy image computer-aided recognition system and method
CN109635871B (en) Capsule endoscope image classification method based on multi-feature fusion
CN105657580B (en) A kind of capsule endoscope video abstraction generating method
CN110367913B (en) Wireless capsule endoscope image pylorus and ileocecal valve positioning method
CN104778374A (en) Automatic dietary estimation device based on image processing and recognizing method
CN107330876A (en) A kind of image automatic diagnosis method based on convolutional neural networks
CN106910184B (en) Endoscope image intestinal bleeding detection method based on deep convolutional neural network
CN109934276A (en) Capsule endoscope image classification system and method based on transfer learning
CN104658014A (en) Method for detecting in-vivo chromaticity abnormality
CN102117329B (en) Capsule endoscope image retrieval method based on wavelet transformation
CN116778430B (en) Disease monitoring system and method for beef cattle cultivation
CN105069131A (en) Capsule endoscopy image retrieval method based on visual vocabularies and local descriptors
CN109242792B (en) White balance correction method based on white object
Dewi et al. Retracted: Stomach disorder detection through the Iris Image using Backpropagation Neural Network
CN109241963B (en) Adaboost machine learning-based intelligent identification method for bleeding point in capsule gastroscope image
Fu et al. Computerized tongue coating nature diagnosis using convolutional neural network
CN111784669B (en) Multi-range detection method for capsule endoscopic images
CN103985113B (en) Tongue is as dividing method
Orillo et al. Rice plant nitrogen level assessment through image processing using artificial neural network
US20090080768A1 (en) Recognition method for images by probing alimentary canals

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant