CN115311505B - Silkworm cocoon classification method and purchase system based on cloud service big data platform - Google Patents

Silkworm cocoon classification method and purchase system based on cloud service big data platform Download PDF

Info

Publication number
CN115311505B
CN115311505B CN202211238417.2A CN202211238417A CN115311505B CN 115311505 B CN115311505 B CN 115311505B CN 202211238417 A CN202211238417 A CN 202211238417A CN 115311505 B CN115311505 B CN 115311505B
Authority
CN
China
Prior art keywords
silkworm
quality
silkworm cocoon
image
cocoons
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
CN202211238417.2A
Other languages
Chinese (zh)
Other versions
CN115311505A (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 Zhugan Information Technology Co ltd
Original Assignee
Sichuan Zhugan Information Technology 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 Zhugan Information Technology Co ltd filed Critical Sichuan Zhugan Information Technology Co ltd
Priority to CN202211238417.2A priority Critical patent/CN115311505B/en
Publication of CN115311505A publication Critical patent/CN115311505A/en
Application granted granted Critical
Publication of CN115311505B publication Critical patent/CN115311505B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume

Abstract

The invention relates to the field of image processing, in particular to a silkworm cocoon classification method and a purchasing system based on a cloud service big data platform, which comprise the following steps: the method comprises the steps of obtaining a rectangular surrounding frame of a silkworm cocoon image, reducing the rectangular surrounding frame of the silkworm cocoon image according to each reduction proportion to obtain a plurality of first surrounding frames, obtaining target pixel points, obtaining central pixel points of the silkworm cocoon image, obtaining a Gaussian fitting model according to the distance from each target pixel point to each central pixel point, obtaining a scatter diagram, fitting the scatter diagram by using least square to obtain a fitting curve, obtaining first quality of a silkworm cocoon sample corresponding to the silkworm cocoon image according to the scatter diagram, the fitting curve and the area of the silkworm cocoon image, obtaining second quality of the silkworm cocoon sample according to the same principle, obtaining the quality of the silkworm cocoon sample according to the first quality and the second quality of the silkworm cocoon sample, and purchasing the silkworm cocoon according to the quality of each silkworm cocoon sample. The invention ensures that the finally purchased silkworm cocoons with each quality more meet the actual requirements.

Description

Silkworm cocoon classification method and purchase system based on cloud service big data platform
Technical Field
The invention relates to the field of image processing, in particular to a silkworm cocoon classification method and a purchasing system based on a cloud service big data platform.
Background
The silkworm cocoons are also called silkworm clothes, and are the cocoons on the silkworm bodies as the name suggests, and the silkworm cocoons have wide functions in life, such as pharmacy, silk manufacturing, pupa oil extraction and livestock feed, so the silkworm cocoons have a wide market, a large amount of silkworm cocoon storage needs to be purchased when the factory produces and manufactures the silkworm cocoons, raw materials of the factory are guaranteed not to be interrupted, but the quality of the silkworm cocoons in the current market is uneven, so that the quality of the silkworm cocoons in each batch of the silkworm cocoons is uneven, if the silkworm cocoons are directly purchased according to the batch, the purchased silkworm cocoons with each quality do not correspond to the required silkworm cocoons with each quality of the silkworm cocoons, so the raw material cost and the storage cost of the factory are increased, and therefore, the classification and purchase of the silkworm cocoons with each quality is very important when the silkworm cocoons are purchased.
In the prior art, the evaluation of the quality of the silkworm cocoon is to divide a silkworm cocoon image by utilizing an Otsu threshold value division technology, divide spot areas in the silkworm cocoon image by an adaptive threshold value, and evaluate the quality of the silkworm cocoon according to the area of the spot areas, wherein the larger the spot area in the silkworm cocoon image is, the less the silk area of the silkworm cocoon is, the poorer the quality of the silkworm cocoon is; however, the cocoons themselves have certain colors, and the different colors of the cocoons can cause different quality of the cocoons, and the method only combines the areas of spot areas on the cocoons and does not combine the colors of the cocoons, so that the evaluation on the quality of the cocoons is inaccurate, and the classification of the cocoons is inaccurate.
Disclosure of Invention
The invention provides a silkworm cocoon classification method and a purchase system based on a cloud service big data platform, which aim to solve the problem of inaccurate classification of the existing silkworm cocoons.
The invention discloses a silkworm cocoon classification method based on a cloud service big data platform, which adopts the following technical scheme:
s1, acquiring a silkworm cocoon sample image, acquiring an HSV (hue, saturation and value) image of a silkworm cocoon according to the silkworm cocoon sample image, acquiring a rectangular enclosure frame of the HSV image, setting a plurality of reduction ratios, reducing the rectangular enclosure frame of the HSV image according to each reduction ratio to obtain a plurality of reduced rectangular enclosure frames, and taking the reduced rectangular enclosure frames as first enclosure frames;
s2, obtaining each symmetry axis of the rectangular surrounding frame, respectively obtaining target pixel points of the rectangular surrounding frame and each first surrounding frame on each symmetry axis, obtaining central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to each central pixel point to obtain Gaussian values of the corresponding target pixel points;
s3, obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the center pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve;
and S4, obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area, and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples.
Further, the silkworm cocoon image is determined according to the following method:
acquiring a front image and a back image of a silkworm cocoon sample, acquiring binary images of the front image and the back image of the silkworm cocoon sample according to the front image and the back image of the silkworm cocoon sample, and performing dot multiplication on the binary images of the front image and the back image of the silkworm cocoon sample and the front image and the back image of the corresponding silkworm cocoon sample to obtain a corresponding silkworm cocoon image;
and converting the silkworm cocoon image into an HSV space to obtain the HSV image of the silkworm cocoon.
Further, the plurality of reduced rectangular bounding boxes are determined as follows:
and reducing the rectangular surrounding frames in an equal proportion according to each reduction proportion to obtain a plurality of reduced rectangular surrounding frames, wherein when the rectangular surrounding frames are reduced in the equal proportion, the rectangular surrounding frames are reduced in the equal proportion from large to small according to the reduction proportion.
Further, the method for obtaining the gaussian value of the target pixel point comprises the following steps:
performing Gaussian fitting according to the distance difference between the distance from the target pixel point corresponding to the rectangular enclosure frame to the central pixel point and the distance from the target pixel point corresponding to each first enclosure frame to the central pixel point to obtain a Gaussian fitting model;
and obtaining the Gaussian value of the target pixel point according to the Gaussian fitting model.
Further, the quality of the silkworm cocoon sample is determined according to the following method:
acquiring the shortest distance from each point in the scatter diagram to the fitted curve;
acquiring the hue difference of each point in the scatter diagram and the point which is on the connection line of the shortest distance of each point or is near the connection line and is closest to the fitting curve;
acquiring the area of a silkworm cocoon image;
multiplying the shortest distance from each point in the scatter diagram to the fitting curve by the corresponding hue difference to obtain a plurality of products, and accumulating each product to obtain an accumulated product;
and obtaining the quality of the cocoon sample corresponding to the HSV image according to the ratio of the accumulated product to the area of the HSV image.
Further, the method for classifying the silkworm cocoons comprises the following steps:
acquiring the number of the silkworm cocoons in the batch where the silkworm cocoon sample is located, and acquiring the silkworm cocoon sample in the batch of silkworm cocoons under each quality according to the quality of each silkworm cocoon sample and a preset silkworm cocoon quality grade;
obtaining the content of the silkworm cocoons of each quality in the batch of silkworm cocoons according to the ratio of the number of the silkworm cocoon samples in the batch of silkworm cocoons of each quality to the number of the silkworm cocoons of the batch of silkworm cocoon samples;
and acquiring the quality of the batch of silkworm cocoons, and obtaining the quality of each quality silkworm cocoon in the batch of silkworm cocoons according to the product of the content of each quality silkworm cocoon in the batch of silkworm cocoons and the quality of the batch of silkworm cocoons.
Silkworm cocoon acquisition system based on cloud service big data platform includes:
the image acquisition module is used for acquiring images of the silkworm cocoon samples;
the image input module is used for inputting the obtained silkworm cocoon sample image into a processor of the acquisition system;
an image processing module comprising: the device comprises a Gaussian fitting unit, a curve fitting unit and a silkworm cocoon classifying unit; wherein:
the Gaussian fitting unit is used for acquiring each symmetry axis of the rectangular enclosing frame, respectively acquiring target pixel points of the rectangular enclosing frame and each first enclosing frame on each symmetry axis, acquiring central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to the central pixel points to obtain Gaussian values of corresponding target pixel points;
the curve fitting unit is used for obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the central pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve;
the silkworm cocoon classification unit is used for obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples;
and the output module is used for outputting the quality of each classified silkworm cocoon with each quality.
The invention has the beneficial effects that: according to the method, firstly, the silkworm cocoon samples in each batch of silkworm cocoons are extracted, the silkworm cocoon images corresponding to the silkworm cocoon samples are obtained according to the silkworm cocoon samples, the silkworm cocoon images are converted into HSV space, the silkworm cocoon quality can be evaluated in a mode of combining the color and the brightness of the silkworm cocoons, secondly, the distance between the central pixel point and the target pixel point of the silkworm cocoon images is used for replacing the brightness value in the silkworm cocoon images, not only is the calculated amount reduced, but also the final evaluation value of the silkworm cocoons is more accurate, and finally, gaussian fitting is performed on the silkworm cocoons of each quality in each batch of silkworm cocoons during purchase, the silkworm cocoon quality of each silkworm cocoon quality after Gaussian fitting is accumulated, the accumulated sum is matched with the real required quantity of the silkworm cocoons of each quality, the silkworm cocoon batch with the highest matching degree is purchased, the silkworm cocoons of each quality are purchased according to need, and the increase of factory storage cost and raw material cost is prevented.
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 embodiments or the description of 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 flowchart of an embodiment of a silkworm cocoon classification method based on a cloud service big data platform according to the present invention;
fig. 2 is a schematic diagram of a rectangular enclosing frame of a cocoon image in an embodiment of a cocoon classification method based on a cloud service big data platform according to the invention;
FIG. 3 is a schematic diagram of a plurality of rectangular bounding boxes in an embodiment of the cocoon classification method based on the cloud service big data platform of the present invention;
fig. 4 is a schematic diagram of a target pixel point in an embodiment of the method for classifying cocoons based on a cloud service big data platform according to the present invention;
FIG. 5 is a schematic diagram illustrating a distance difference in an embodiment of a method for classifying silkworm cocoons based on a cloud service big data platform according to the present invention;
fig. 6 is a flowchart of a silkworm cocoon purchasing system based on a cloud service big data platform according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the silkworm cocoon classification method based on the cloud service big data platform, as shown in fig. 1, includes:
the method comprises the steps of S1, obtaining a silkworm cocoon sample image, obtaining an HSV (hue, saturation, value) image of the silkworm cocoon according to the silkworm cocoon sample image, obtaining a rectangular surrounding frame of the HSV image, setting a plurality of reduction ratios, reducing the rectangular surrounding frame of the HSV image according to each reduction ratio to obtain a plurality of reduced rectangular surrounding frames, and taking the reduced rectangular surrounding frames as first surrounding frames.
The method for acquiring the front image of the silkworm cocoon sample comprises the following specific steps: determining the cocoons to be detected in the current batch, randomly extracting Q cocoons samples from the cocoons in the current batch by related purchasing staff, wherein the Q value is as large as possible, so that the integral counting detection result of the content of the cocoons in different types in the current batch is credible, and the Q cocoons samples are flatly laid on a detection device by the related purchasing staff, wherein two fixed cameras are erected above and below the cocoons detection device and are used for collecting images of the front and back sides of the cocoons to further obtain images of the front and back sides of the cocoons in the current batch, wherein the two cameras are used for preventing spots at the lower parts of the cocoons from being shot when the cocoons samples are placed to cause the counting of errors when the cocoons in the current batch are classified.
Graying the front image of the silkworm cocoon samples in the current batch of silkworm cocoons to obtain a gray image, carrying out image denoising on the gray image by adopting Gaussian filtering, carrying out edge detection on the denoised image by a canny algorithm to obtain an edge image after the edge detection, carrying out morphological filling treatment on the edge image to obtain a binary image of the front image of the corresponding silkworm cocoon sample, carrying out dot multiplication operation on the binary image of the front image of each silkworm cocoon sample and the front image of the silkworm cocoon sample to obtain the corresponding silkworm cocoon image, wherein spots exist in the silkworm cocoon, so that each silkworm cocoon image is converted into an HSV color space to obtain an HSV image of the silkworm cocoon.
The outline of each cocoon image is surrounded by a rectangle to obtain a rectangular surrounding frame of each cocoon image, and a specific schematic diagram is shown in fig. 2.
The specific steps for obtaining the first enclosure frame are as follows: providing a plurality of reduction ratios, each reduction ratio having an equal variation, e.g.
Figure 78045DEST_PATH_IMAGE001
The rectangular surrounding frame of each silkworm cocoon image is reduced according to the reduction ratio
Figure 791923DEST_PATH_IMAGE002
Sequentially reducing in equal proportion to obtain a plurality of reduced rectangular surrounding frames, the specific schematic diagram is shown in fig. 3, it should be said thatIt is to be noted that, in FIG. 3, only the rectangular bounding box of each cocoon image is drawn in a reduced scale
Figure 102819DEST_PATH_IMAGE003
And sequentially carrying out isometric reduction on the schematic diagram, and taking the reduced rectangular enclosure frame as a first enclosure frame.
S2, obtaining each symmetry axis of the rectangular surrounding frame, respectively obtaining target pixel points of the rectangular surrounding frame and each first surrounding frame on each symmetry axis, obtaining central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to each central pixel point to obtain Gaussian values of the corresponding target pixel points.
Each symmetry axis of the rectangular enclosure frame is obtained, pixel points of the rectangular enclosure frame and each first enclosure frame on each symmetry axis are obtained respectively, the specific schematic diagram is shown in fig. 4, and the pixel points of the rectangular enclosure frame and each first enclosure frame on each symmetry axis are used as target pixel points.
The brightness value of each target pixel point in each silkworm cocoon image in the HSV color space is obtained, and because the silkworm cocoons are in an oval shape, the gray value of the silkworm cocoons has the characteristics of high middle and low edge, the center pixel point of the silkworm cocoon image has the highest brightness value, and the brightness value is gradually decreased from the center pixel point to the edge. Therefore, the normal change of the brightness value on the silkworm cocoon image is approximately described by the two-dimensional single Gaussian model, wherein when the two-dimensional single Gaussian model is fitted, the central pixel point of the silkworm cocoon image is obtained, and the distance from the target pixel point to the central pixel point is used for fitting instead of the brightness value.
The specific steps of obtaining the Gaussian fitting model according to the distance from each target pixel point to the central pixel point are as follows: and performing Gaussian fitting according to the distance difference between the distance from the target pixel point corresponding to the rectangular enclosing frame to the central pixel point and the distance from the target pixel point corresponding to each first enclosing frame to the central pixel point to obtain a Gaussian fitting model. A schematic diagram of a specific distance difference is shown in figure 5,
Figure 29186DEST_PATH_IMAGE004
representing the rectangular bounding boxThe distance between the target pixel point and the central pixel point, OB and OC represent the distance between the central pixel point and different first enclosing frames,
Figure 577980DEST_PATH_IMAGE004
reducing
Figure 931600DEST_PATH_IMAGE005
Is greater than
Figure 729792DEST_PATH_IMAGE004
Reducing
Figure 459851DEST_PATH_IMAGE006
The distance difference is decreased from the center part to the edge part of the cocoon image, and is consistent with the brightness variation trend of the pixel points in the cocoon image. And obtaining the Gaussian value of each target pixel point in the Gaussian fitting model according to the Gaussian fitting model.
S3, obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the center pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve.
The Gaussian fitting model is obtained by the distance between the target pixel point and the central pixel point, so that each target pixel point necessarily has a corresponding point in the Gaussian fitting model, the difference value between the brightness value of each target pixel point and the Gaussian value of the corresponding point in the Gaussian fitting model is obtained, the difference value between the brightness value of each target pixel point and the Gaussian value of the corresponding point in the Gaussian fitting model is used as a first difference value of the target pixel point, and the distance from each target pixel point to the central pixel point is used
Figure 925467DEST_PATH_IMAGE007
As an abscissa, a first difference corresponding to each target pixel point
Figure 449989DEST_PATH_IMAGE008
Plotting a scatter diagram for the ordinate, proceeding with the scatter diagram using least squaresAnd performing line fitting to obtain a fitting curve.
And S4, obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area, and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples.
The specific steps for obtaining the first quality of the silkworm cocoon sample are as follows: acquiring a point on a shortest distance connecting line from each point in the scatter diagram to the fitting curve, acquiring a point on each connecting line or near the connecting line closest to the fitting curve, setting a specific range near the connecting line according to specific conditions, and acquiring the hue difference between each point and a point on the shortest distance connecting line or near the connecting line closest to the fitting curve
Figure 938740DEST_PATH_IMAGE009
(wherein each point in the scatter diagram is bound to correspond to a target pixel point, and the hue of the target pixel point is the component of an H channel in the HSV color space), and obtaining the shortest distance from each point in the scatter diagram to the fitting curve
Figure 472489DEST_PATH_IMAGE010
Obtaining area of cocoon image
Figure 541681DEST_PATH_IMAGE011
According to
Figure 502684DEST_PATH_IMAGE012
And
Figure 478730DEST_PATH_IMAGE011
obtaining a first quality of each silkworm cocoon sample, wherein a specific expression is as follows:
Figure 285012DEST_PATH_IMAGE013
in the formula:
Figure 725221DEST_PATH_IMAGE009
indicating the first in the scatter diagram
Figure 591546DEST_PATH_IMAGE014
Hue difference between a point and the closest point on or near the line connecting the points with the shortest distance,
Figure 54888DEST_PATH_IMAGE010
indicating the first in the scatter diagram
Figure 930440DEST_PATH_IMAGE014
The shortest distance of a point to the fitted curve,
Figure 959576DEST_PATH_IMAGE015
represents the area of the image corresponding to the silkworm cocoon,
Figure 465644DEST_PATH_IMAGE016
the first quality of the cocoon sample corresponding to the cocoon image is represented.
The fitting curve represents the normal quality of the target pixel points, and the quality of each point in the scatter diagram can be measured by calculating the color difference of each point and the point on the shortest distance connecting line or the point close to the connecting line and closest to the fitting curve, namely the quality of each target pixel point in the silkworm cocoon image can be measured; calculating the shortest distance from each point in the scatter diagram to the fitted curve, and measuring the quality of each point, namely measuring the quality of each target pixel point in the silkworm cocoon image; therefore, the quality of the silkworm cocoon image is measured from two dimensions of the shortest distance and the hue difference, and the larger the shortest distance and the hue difference is, the larger the deviation of the point from the fitting curve is, the worse the quality of the point is, namely
Figure 213020DEST_PATH_IMAGE016
The larger the cocoon image, the worse the quality of the cocoon sample corresponding to the cocoon image.
Thus, the first quality of the silkworm cocoon sample is obtained, and the first quality of each silkworm cocoon sample can be obtained according to the first quality calculation formula.
Obtaining a back image of each silkworm cocoon sample according to the steps S1-S4, and obtaining a second quality of each silkworm cocoon sample
Figure 829946DEST_PATH_IMAGE017
Obtaining the quality of each cocoon sample of the current batch according to the first quality and the second quality of each cocoon sample
Figure 979168DEST_PATH_IMAGE018
And the quality of each silkworm cocoon sample is the sum of the corresponding first quality and the second quality, and each silkworm cocoon sample necessarily corresponds to one silkworm cocoon.
The method for classifying the silkworm cocoons comprises the following steps: acquiring the number of the silkworm cocoons in the batch where the silkworm cocoon sample is located, acquiring the silkworm cocoon sample in the batch of the silkworm cocoons under each quality according to the quality of each silkworm cocoon sample and a preset silkworm cocoon quality grade, acquiring the content of the silkworm cocoons with each quality in the batch according to the ratio of the silkworm cocoon sample in the batch of the silkworm cocoons under each quality to the number of the silkworm cocoons in the batch where the silkworm cocoon sample is located, acquiring the quality of the batch of the silkworm cocoons, and acquiring the quality of the silkworm cocoons with each quality in the batch of the silkworm cocoons according to the product of the content of the silkworm cocoons with each quality in the batch and the quality of the batch of the silkworm cocoons, wherein the silkworm cocoon quality grade is set to take the quality of each single silkworm cocoon at an interval of 10 as a quality grade, for example, the silkworm cocoon quality grade is set
Figure 452874DEST_PATH_IMAGE019
Is a first-level one-step one,
Figure 625230DEST_PATH_IMAGE020
in the second level, by analogy, the interval division of the quality of a single silkworm cocoon can be adjusted according to the specific implementation requirements, and the empirical value obtained by the method is 10. Thus, the quality classification of the batch of silkworm cocoons is completed.
Silkworm cocoon purchasing system based on cloud service big data platform includes: image acquisition module, image input module, image processing module, output module, wherein image processing module includes: a Gaussian fitting unit, a curve fitting unit and a cocoon classification unit, as shown in FIG. 6.
The image acquisition module is used for acquiring images of the silkworm cocoon samples.
And the image input module is used for inputting the acquired silkworm cocoon sample image into a processor of the acquisition system.
An image processing module comprising: the device comprises a Gaussian fitting unit, a curve fitting unit and a silkworm cocoon classification unit; wherein:
and the Gaussian fitting unit is used for acquiring each symmetry axis of the rectangular surrounding frame, respectively acquiring target pixel points of the rectangular surrounding frame and each first surrounding frame on each symmetry axis, acquiring central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to the central pixel points to obtain Gaussian values of the corresponding target pixel points.
And the curve fitting unit is used for obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the central pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve.
And the silkworm cocoon classification unit is used for obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area, and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples.
And the output module is used for outputting the quality of each classified silkworm cocoon with each quality.
The method comprises the steps of obtaining the number of the cocoons of the current batch where the cocoons are located, dividing the cocoons samples according to quality grades to obtain the cocoons samples of the batch of cocoons under each quality, obtaining the content of the cocoons of each quality in the batch of cocoons according to the ratio of the cocoons samples of the batch of cocoons under each quality to the number of the cocoons of the batch, obtaining the quality of the batch of cocoons, and obtaining the quality of the cocoons of each quality in the batch of cocoons according to the product of the content of the cocoons of each quality in the batch of cocoons and the quality of the batch of cocoons.
After the mass of each quality of silkworm cocoons in the current batch is obtained, due to the fact that the demanded quantities of different types of silkworm cocoons in a factory are different and the purchase quantities are different, the stock quantity and the demanded quantity of each quality of silkworm cocoons are obtained, and the real demanded quantity of each quality of silkworm cocoons is obtained by subtracting the corresponding stock quantity according to the demanded quantity of each quality of silkworm cocoons.
The method comprises the steps of obtaining the quality of each quality silkworm cocoon in each batch of silkworm cocoons during purchase, carrying out Gaussian fitting on the quality of each quality silkworm cocoon in each batch of silkworm cocoons to obtain the quality of each quality silkworm cocoon in each batch of silkworm cocoons after Gaussian fitting, accumulating the quality of each quality silkworm cocoon in each batch of silkworm cocoons after Gaussian fitting to obtain the quality of each quality silkworm cocoon after accumulation, matching the quality of each quality silkworm cocoon after accumulation with the real demand of each quality silkworm cocoon, and purchasing the silkworm cocoon batch with the highest matching degree.
The specific steps of accumulating the quality of each quality silkworm cocoon in each batch of silkworm cocoons after Gaussian fitting are as follows: obtaining the total number of silkworm cocoon batches during purchase
Figure 577005DEST_PATH_IMAGE021
To, for
Figure 580733DEST_PATH_IMAGE021
Arranging and combining the silkworm cocoons in batches, wherein the number of the arranged and combined elements is
Figure 490920DEST_PATH_IMAGE022
And is and
Figure 947310DEST_PATH_IMAGE023
for example, two batches are first extracted from the total number of silkworm cocoon batches as a permutation and combination element, i.e.
Figure 906038DEST_PATH_IMAGE024
When in use, will
Figure 764273DEST_PATH_IMAGE021
And (3) arranging and combining every two silkworm cocoons in batches to obtain a plurality of combinations, repeating the steps to obtain all combinations, and accumulating the mass of each quality silkworm cocoon in each batch of silkworm cocoons after Gaussian fitting in each combination to obtain the accumulated mass of each quality silkworm cocoon.
And matching the quality of all the accumulated silkworm cocoons with the real demand of the quality of each silkworm cocoon, and purchasing the silkworm cocoons in the combination with the highest matching degree in batches. The highest matching degree is the combination of the quality of each type of silkworm cocoon and the real demand of each type of silkworm cocoon quality, which is the closest.
The beneficial effects of the invention are: according to the method, firstly, the silkworm cocoon samples in each batch of silkworm cocoons are extracted, the silkworm cocoon images corresponding to the silkworm cocoon samples are obtained according to the silkworm cocoon samples, the silkworm cocoon images are converted into HSV space, the silkworm cocoon quality can be evaluated in a mode of combining the color and the brightness of the silkworm cocoons, secondly, the distance between the central pixel point and the target pixel point of the silkworm cocoon images is used for replacing the brightness value in the silkworm cocoon images, not only is the calculated amount reduced, but also the final evaluation value of the silkworm cocoons is more accurate, and finally, gaussian fitting is performed on the silkworm cocoons of each quality in each batch of silkworm cocoons during purchase, the silkworm cocoon quality of each silkworm cocoon quality after Gaussian fitting is accumulated, the accumulated sum is matched with the real required quantity of the silkworm cocoons of each quality, the silkworm cocoon batch with the highest matching degree is purchased, the silkworm cocoons of each quality are purchased according to need, and the increase of factory storage cost and raw material cost is prevented.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (5)

1. A silkworm cocoon classification method based on a cloud service big data platform is characterized by comprising the following steps:
s1, acquiring a silkworm cocoon sample image, acquiring an HSV (hue, saturation and value) image of a silkworm cocoon according to the silkworm cocoon sample image, acquiring a rectangular enclosure frame of the HSV image, setting a plurality of reduction ratios, reducing the rectangular enclosure frame of the HSV image according to each reduction ratio to obtain a plurality of reduced rectangular enclosure frames, and taking the reduced rectangular enclosure frames as first enclosure frames;
s2, obtaining each symmetry axis of the rectangular enclosing frame, respectively obtaining target pixel points of the rectangular enclosing frame and each first enclosing frame on each symmetry axis, obtaining central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to the central pixel points to obtain Gaussian values of corresponding target pixel points;
s3, obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the center pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve;
s4, obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area, and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples;
the quality of the silkworm cocoon sample is determined according to the following method:
acquiring the shortest distance from each point in the scatter diagram to the fitted curve;
acquiring the hue difference of each point in the scatter diagram and the point which is on the connection line of the shortest distance of each point or is near the connection line and is closest to the fitting curve;
acquiring the area of a silkworm cocoon image;
multiplying the shortest distance from each point in the scatter diagram to the fitting curve by the corresponding hue difference to obtain a plurality of products, and accumulating each product to obtain an accumulated product;
obtaining the quality of the cocoon sample corresponding to the HSV image according to the ratio of the accumulated product to the area of the HSV image;
the method for classifying the silkworm cocoons comprises the following steps:
acquiring the number of the silkworm cocoons in the batch where the silkworm cocoon samples are located, and acquiring the silkworm cocoon samples in the batch of silkworm cocoons under each quality according to the quality of each silkworm cocoon sample and a preset silkworm cocoon quality grade;
obtaining the content of the silkworm cocoons of each quality in the batch of silkworm cocoons according to the ratio of the number of the silkworm cocoon samples in the batch of silkworm cocoons of each quality to the number of the silkworm cocoons of the batch of silkworm cocoon samples;
and acquiring the quality of the batch of silkworm cocoons, and acquiring the quality of each quality of silkworm cocoons in the batch of silkworm cocoons according to the product of the content of each quality of silkworm cocoons in the batch of silkworm cocoons and the quality of the batch of silkworm cocoons.
2. The silkworm cocoon classification method based on the cloud service big data platform according to claim 1, wherein the silkworm cocoon image is determined according to the following method:
acquiring a front image and a back image of a silkworm cocoon sample, acquiring binary images of the front image and the back image of the silkworm cocoon sample according to the front image and the back image of the silkworm cocoon sample, and performing dot multiplication on the binary images of the front image and the back image of the silkworm cocoon sample and the front image and the back image of the corresponding silkworm cocoon sample to obtain a corresponding silkworm cocoon image;
and converting the silkworm cocoon image into an HSV space to obtain the HSV image of the silkworm cocoon.
3. The silkworm cocoon classification method based on the cloud service big data platform according to claim 1, wherein the plurality of reduced rectangular bounding boxes are determined according to the following method:
and reducing the rectangular surrounding frames in an equal proportion according to each reduction proportion to obtain a plurality of reduced rectangular surrounding frames, wherein when the rectangular surrounding frames are reduced in the equal proportion, the rectangular surrounding frames are reduced in the equal proportion from large to small according to the reduction proportion.
4. The silkworm cocoon classification method based on the cloud service big data platform according to claim 1, wherein the gaussian value of the target pixel point is determined according to the following method:
performing Gaussian fitting according to the distance between the target pixel point corresponding to the rectangular enclosing frame and the central pixel point and the distance between the target pixel point corresponding to each first enclosing frame and the central pixel point to obtain a Gaussian fitting model;
and obtaining the Gaussian value of the target pixel point according to the Gaussian fitting model.
5. Silkworm cocoon purchasing system based on cloud service big data platform, its characterized in that includes:
the image acquisition module is used for acquiring a silkworm cocoon sample image;
the image input module is used for inputting the acquired silkworm cocoon sample image into a processor of the acquisition system;
an image processing module comprising: the device comprises a Gaussian fitting unit, a curve fitting unit and a silkworm cocoon classification unit; wherein:
the Gaussian fitting unit is used for acquiring each symmetry axis of the rectangular surrounding frame, respectively acquiring target pixel points of the rectangular surrounding frame and each first surrounding frame on each symmetry axis, acquiring central pixel points of the silkworm cocoon image, and performing Gaussian fitting according to the distance from each target pixel point to the central pixel points to obtain Gaussian values of the corresponding target pixel points;
the curve fitting unit is used for obtaining a first difference value of each target pixel point according to the brightness value of each target pixel point and the Gaussian value of the corresponding target pixel point, drawing a scatter diagram by using the first difference value of each target pixel point and the distance from each target pixel point to the central pixel point, and fitting the scatter diagram by using least square to obtain a fitting curve;
the silkworm cocoon classification unit is used for obtaining the quality of the silkworm cocoon sample corresponding to the HSV image according to the scatter diagram, the fitting curve and the silkworm cocoon image area and classifying the silkworm cocoons by using the quality of all the obtained silkworm cocoon samples;
the quality of the silkworm cocoon sample is determined according to the following method:
obtaining the shortest distance from each point in the scatter diagram to the fitted curve;
acquiring the hue difference of each point in the scatter diagram and the point which is on the connection line of the shortest distance of each point or is near the connection line and is closest to the fitting curve;
acquiring the area of a silkworm cocoon image;
multiplying the shortest distance from each point in the scatter diagram to the fitting curve by the corresponding hue difference to obtain a plurality of products, and accumulating each product to obtain an accumulated product;
obtaining the quality of the cocoon sample corresponding to the HSV image according to the ratio of the accumulated product to the area of the HSV image;
the method for classifying the silkworm cocoons comprises the following steps:
acquiring the number of the silkworm cocoons in the batch where the silkworm cocoon sample is located, and acquiring the silkworm cocoon sample in the batch of silkworm cocoons under each quality according to the quality of each silkworm cocoon sample and a preset silkworm cocoon quality grade;
obtaining the content of the silkworm cocoons of each quality in the batch of silkworm cocoons according to the ratio of the number of the silkworm cocoon samples in the batch of silkworm cocoons of each quality to the number of the silkworm cocoons of the batch of silkworm cocoon samples;
acquiring the quality of the batch of silkworm cocoons, and acquiring the quality of each quality of silkworm cocoons in the batch of silkworm cocoons according to the product of the content of each quality of silkworm cocoons in the batch of silkworm cocoons and the quality of the batch of silkworm cocoons;
and the output module is used for outputting the quality of each classified silkworm cocoon with each quality.
CN202211238417.2A 2022-10-11 2022-10-11 Silkworm cocoon classification method and purchase system based on cloud service big data platform Active CN115311505B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211238417.2A CN115311505B (en) 2022-10-11 2022-10-11 Silkworm cocoon classification method and purchase system based on cloud service big data platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211238417.2A CN115311505B (en) 2022-10-11 2022-10-11 Silkworm cocoon classification method and purchase system based on cloud service big data platform

Publications (2)

Publication Number Publication Date
CN115311505A CN115311505A (en) 2022-11-08
CN115311505B true CN115311505B (en) 2022-12-27

Family

ID=83868074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211238417.2A Active CN115311505B (en) 2022-10-11 2022-10-11 Silkworm cocoon classification method and purchase system based on cloud service big data platform

Country Status (1)

Country Link
CN (1) CN115311505B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109215015A (en) * 2018-07-24 2019-01-15 北京工业大学 A kind of online visible detection method of silk cocoon based on convolutional neural networks
CN109829905A (en) * 2019-01-30 2019-05-31 中国矿业大学 It is a kind of face beautification perceived quality without reference evaluation method
CN110567888A (en) * 2019-09-12 2019-12-13 中国计量大学 silkworm cocoon dry shell amount nondestructive testing method based on visible/near infrared spectrum and deep learning
CN110749598A (en) * 2019-11-05 2020-02-04 中国计量大学 Silkworm cocoon surface defect detection method integrating color, shape and texture characteristics
WO2020247594A1 (en) * 2019-06-04 2020-12-10 Cocoon Biotech Inc. Silk-based products, formulations, and methods of use

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106932408B (en) * 2017-03-20 2019-05-21 山东农业大学 A kind of paper cocooning frame pollution silk cocoon detection method based on image procossing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109215015A (en) * 2018-07-24 2019-01-15 北京工业大学 A kind of online visible detection method of silk cocoon based on convolutional neural networks
CN109829905A (en) * 2019-01-30 2019-05-31 中国矿业大学 It is a kind of face beautification perceived quality without reference evaluation method
WO2020247594A1 (en) * 2019-06-04 2020-12-10 Cocoon Biotech Inc. Silk-based products, formulations, and methods of use
CN110567888A (en) * 2019-09-12 2019-12-13 中国计量大学 silkworm cocoon dry shell amount nondestructive testing method based on visible/near infrared spectrum and deep learning
CN110749598A (en) * 2019-11-05 2020-02-04 中国计量大学 Silkworm cocoon surface defect detection method integrating color, shape and texture characteristics

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Research on the Identification Method of Silkworm Cocoon Species Based on Improved YOLOv3;Shijie Li等;《2020 5th International Conference on Mechanical, Control and Computer Engineering (ICMCCE)》;20210513;1119-1123 *
Research on the Non-destructive Testing Method of Pod Based on Neural Networks;Guangyou Yang等;《First International Conference on Innovative Computing, Information and Control-Volume I (ICICIC"06)》;20061016;1-4 *
基于FCM及HSV模型的方格蔟黄斑茧检测与剔除技术;刘莫尘等;《农业机械学报》;20180731;第49卷(第07期);31-38 *
基于机器学习的蚕茧疵点种类识别方法研究;黄志鹏等;《中国优秀硕士学位论文全文数据库 (农业科技辑)》;20220531(第05期);D051-37 *
基于椭圆重叠区域的蚕茧图像融合方法;孙卫红等;《纺织学报》;20220915;第043卷(第009期);82-83 *

Also Published As

Publication number Publication date
CN115311505A (en) 2022-11-08

Similar Documents

Publication Publication Date Title
Momin et al. Geometry-based mass grading of mango fruits using image processing
CN107798672B (en) Method and system for measuring width of cut tobacco or cut stem and server with system
Liu et al. A vision-based robust grape berry counting algorithm for fast calibration-free bunch weight estimation in the field
CN108230321A (en) Defect inspection method and device
CN107063099B (en) A kind of online quality monitoring method of machinery manufacturing industry of view-based access control model system
CN115018844B (en) Plastic film quality evaluation method based on artificial intelligence
CN110909640A (en) Method and device for determining water level line, storage medium and electronic device
CN112052822B (en) Road visibility detection method, system and device based on image multi-feature fusion
CN108765433A (en) One kind is for carrying high-precision leafy area measurement method
CN110782440B (en) Crop seed character measuring method
CN114241326B (en) Progressive intelligent production method and system for ground feature elements of remote sensing images
CN105391931A (en) Image processing apparatus, and method for processing image
CN114037835B (en) Grain quality estimation method, device, equipment and storage medium
CN115311505B (en) Silkworm cocoon classification method and purchase system based on cloud service big data platform
CN114563942A (en) Clock three-pointer parallelism measuring method, device and storage medium
CN111369531B (en) Image definition scoring method, device and storage device
CN111310571B (en) Hyperspectral image classification method and device based on spatial-spectral-dimensional filtering
CN106898010A (en) Particle copies the method and device planted
CN114882042B (en) Internet of things transmission method based on image quality evaluation
CN116246174A (en) Sweet potato variety identification method based on image processing
CN110580495A (en) automatic analysis method for leaf area and leaf surface anthracnose lesion number of pear
CN115147659A (en) Image analysis method and system for plant fruit external surface DUS test characters
CN111476253B (en) Clothing image classification method, device and equipment and image classification method and device
CN107516305A (en) Fog-level processing method drops in batch source images
CN114240924A (en) Power grid equipment quality evaluation method based on digitization technology

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