Garbage classification information acquisition method, device, equipment and storage medium
By acquiring and processing household spam information and building and training a garbage classification model, the problem of low accuracy of garbage classification in the existing technology is solved, and the accuracy and efficiency of garbage classification are improved.
Patent Information
- Application Number
- CN202111097362.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-17
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-09-17
AI Technical Summary
The accuracy of garbage classification in the prior art is low, and manual learning of garbage classification knowledge is required, resulting in classification difficulties and inefficient.
By obtaining the household spam information to be detected, performing feature extraction and classification processing, building a preset decision tree and initial network model, training the spam classification model, and input spam identity information to obtain spam classification information.
It improves the accuracy and efficiency of garbage classification, reduces the dependence of manual classification, and achieves more accurate and fast garbage identification.
Smart Images

Figure CN113963191B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a method, device, equipment and storage medium for obtaining garbage classification information. Background Art
[0002] At present, my country produces tens of thousands of tons of garbage every day, with household garbage accounting for the majority. The types are complex and difficult to classify, which brings great pressure and challenges to the living environment. In the existing technology, it is necessary to manually learn garbage classification knowledge to classify garbage. Due to the wide variety of garbage, the accuracy of garbage classification is low.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for obtaining garbage classification information, aiming at solving the technical problem of how to improve the accuracy of garbage classification.
[0005] To achieve the above object, the present invention provides a method for obtaining garbage classification information, the method comprising:
[0006] Obtain information about household waste to be tested;
[0007] Extracting features of the household garbage information to be detected to obtain target garbage feature information;
[0008] Determining spam identity information according to the target spam characteristic information;
[0009] The garbage identity information is input into a preset garbage classification model to obtain garbage classification information.
[0010] Optionally, before the step of obtaining the household garbage picture to be detected, the method further includes:
[0011] Acquire a household garbage data sample set, wherein the household garbage data sample set contains a plurality of household garbage data samples;
[0012] Classifying the plurality of household garbage data samples to obtain a plurality of household garbage data sample subsets and corresponding garbage sample feature information;
[0013] Determining information entropy corresponding to the household garbage data sample set;
[0014] Determine the conditional entropy corresponding to a plurality of household garbage data sample subsets respectively according to the garbage sample feature information;
[0015] Determine the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy;
[0016] Constructing a preset decision tree according to the information gain and the feature information of the junk samples;
[0017] The preset initial network model is trained according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
[0018] Optionally, the step of obtaining a household garbage data sample set includes:
[0019] The plurality of garbage data are divided and processed according to a preset division strategy to obtain a plurality of garbage data sets;
[0020] Selecting a plurality of junk data training sets from the plurality of junk data sets;
[0021] A household garbage data sample set is determined based on the multiple garbage data training sets.
[0022] Optionally, the step of training a preset initial network model according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model comprises:
[0023] Determining a preset crossover strategy based on a plurality of household garbage data sample sets;
[0024] The preset initial network model is trained according to the preset crossover strategy, multiple household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
[0025] Optionally, the step of training a preset initial network model according to the preset crossover strategy, a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model comprises:
[0026] Training a preset initial network model according to the preset crossover strategy, multiple household garbage data sample subsets and the preset decision tree to obtain an initial garbage classification model;
[0027] Get a test subset of household waste data samples;
[0028] Testing the initial garbage classification model using the household garbage data sample test subset to obtain a model test score;
[0029] When the model evaluation score is greater than a preset threshold, the initial garbage classification model is used as a preset garbage classification model.
[0030] Optionally, the step of determining the information entropy corresponding to the household garbage data sample set includes:
[0031] Obtaining the number of garbage category labels and the total number of household garbage data corresponding to the household garbage data sample set;
[0032] Calculate the information entropy corresponding to the household garbage data sample set according to the number of garbage category labels and the total number of household garbage data using a first preset formula;
[0033] The first preset formula is:
[0034]
[0035] Where H(D) is the information entropy corresponding to the household garbage data sample set, C m is the number of garbage category labels, and N is the total number of household garbage data.
[0036] Optionally, the step of determining the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy includes:
[0037] Calculate the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy by using a preset gain formula;
[0038] The preset gain formula is:
[0039] G(D,A)=H(D)-H(D|A)
[0040] Where G(D,A) is the information gain corresponding to the sample garbage feature information, H(D) is the information entropy, and H(DA) is the conditional entropy.
[0041] In addition, to achieve the above-mentioned purpose, the present invention also proposes a garbage classification information acquisition device, the garbage classification information acquisition device comprising:
[0042] An acquisition module, used for acquiring household garbage information to be detected;
[0043] An extraction module, used for extracting features of the household garbage information to be detected to obtain target garbage feature information;
[0044] A determination module, used to determine the spam identity information according to the target spam feature information;
[0045] The identification module is used to input the garbage identity information into a preset garbage classification model to obtain garbage classification information.
[0046] In addition, to achieve the above-mentioned purpose, the present invention also proposes a garbage classification information acquisition device, which includes: a memory, a processor, and a garbage classification information acquisition program stored on the memory and runnable on the processor, and the garbage classification information acquisition program is configured to implement the steps of the garbage classification information acquisition method described above.
[0047] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a garbage classification information acquisition program is stored, and when the garbage classification information acquisition program is executed by a processor, the steps of the garbage classification information acquisition method described above are implemented.
[0048] The present invention first obtains household garbage information to be detected, then extracts features of the household garbage information to be detected, obtains target garbage feature information, then determines garbage identity information based on the target garbage feature information, and inputs the garbage identity information into a preset garbage classification model to obtain garbage classification information. Compared with the prior art, which requires manual garbage classification in advance and determines garbage classification information based on manually set garbage classification labels, the present invention can input garbage identity information into a preset garbage classification model to obtain garbage classification information, thereby improving the accuracy of garbage classification and further improving the garbage classification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a structural diagram of a garbage classification information acquisition device in a hardware operating environment involved in an embodiment of the present invention;
[0050] Figure 2 This is a flow chart of a first embodiment of a method for obtaining garbage classification information according to the present invention;
[0051] Figure 3 This is a flow chart of a second embodiment of the method for obtaining garbage classification information of the present invention;
[0052] Figure 4 It is a decision tree logic diagram of the second embodiment of the method for obtaining garbage classification information of the present invention;
[0053] Figure 5 This is a model verification curve diagram of the second embodiment of the method for obtaining garbage classification information of the present invention;
[0054] Figure 6 This is a structural block diagram of the first embodiment of the garbage classification information acquisition device of the present invention.
[0055] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0057] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the structure of a garbage classification information acquisition device in a hardware operating environment according to an embodiment of the present invention.
[0058] like Figure 1 As shown, the garbage classification information acquisition device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0059] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the garbage classification information acquisition device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0060] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a garbage classification information acquisition program.
[0061] exist Figure 1 In the garbage classification information acquisition device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the garbage classification information acquisition device of the present invention can be set in the garbage classification information acquisition device, and the garbage classification information acquisition device calls the garbage classification information acquisition program stored in the memory 1005 through the processor 1001, and executes the garbage classification information acquisition method provided by the embodiment of the present invention.
[0062] The embodiment of the present invention provides a method for obtaining garbage classification information. Figure 2 , Figure 2 It is a flowchart of the first embodiment of the method for obtaining garbage classification information of the present invention.
[0063] In this embodiment, the garbage classification information acquisition method includes the following steps:
[0064] Step S10: Obtaining household garbage information to be detected.
[0065] It is easy to understand that the executor of this embodiment can be a garbage classification information acquisition device with functions such as image processing, data processing, network communication and program running. The garbage classification information acquisition device can also input garbage identity information into a preset garbage classification model to obtain garbage classification information, etc. It can also be other computer devices with similar functions, etc., and this embodiment does not limit it.
[0066] The household garbage information to be detected can be understood as garbage images or garbage voices that need to be classified in household garbage.
[0067] Step S20: extracting features of the household garbage information to be detected to obtain target garbage feature information.
[0068] It should be noted that if the household junk information to be detected is a junk image, image feature extraction is performed on the junk image to obtain target junk feature information corresponding to the junk image; if the household junk information to be detected is junk speech, voice-to-text extraction is performed on the junk speech to obtain speech keywords, and the speech keywords are used as target junk feature information, etc.
[0069] The method for performing image feature extraction on the garbage image to obtain the target garbage feature information corresponding to the garbage image can be to perform grayscale processing on the garbage image to obtain a garbage grayscale image, then obtain pixel point information of the garbage grayscale image, extract the garbage contour line from the garbage grayscale image according to the pixel point information, and determine the target garbage feature information according to the garbage contour line.
[0070] In a specific implementation, the user can transfer the captured garbage image to the preset garbage classification model, and the preset garbage classification model can extract the garbage contour line corresponding to the garbage image, and then match the garbage contour line with multiple pre-stored garbage contour line samples, and obtain the matching value between the garbage contour line and the multiple garbage contour line samples. When the matching value is greater than the preset matching threshold, the number of garbage contour line samples corresponding to the matching value greater than the preset matching threshold is obtained. When the number of garbage contour line samples is greater than the preset number threshold, the garbage contour line samples can be sorted according to the matching value to obtain the garbage matching sorting result, and the target garbage contour line sample is selected from the multiple garbage contour line samples according to the garbage matching sorting result, and the target garbage contour line sample is used as the target garbage feature information, etc. The preset matching threshold and the preset number threshold are both user-defined settings. The preset matching threshold can be 90%, etc., and the preset number threshold can be 2, etc.
[0071] In this embodiment, if the garbage contour line of the garbage image is A, the pre-stored multiple garbage contour line samples are A1, A2, A3, A4 and A5, the matching value between A and A1 is 80%, the matching value between A and A2 is 90%, the matching value between A and A3 is 95%, the matching value between A and A4 is 96%, the matching value between A and A5 is 93%, and the preset matching threshold is 90%. Then, A2, A3, A4 and A5 are sorted, and the garbage matching sorting result is A4-A3-A5-A2, and the target garbage contour line sample is A4, etc.
[0072] The junk speech is extracted from speech text to obtain speech keywords, which may be processed by converting the junk speech into speech text, extracting multiple speech words from the speech text, determining speech keywords based on the multiple speech words, and the like.
[0073] In a specific implementation, when a user needs to query the garbage classification information of the garbage to be detected, it is necessary to obtain the user's voice description information of the garbage to be detected, and then convert the voice description information into voice text, etc.
[0074] In this embodiment, if the voice description information is "black computer", the voice words are "black" and "computer" respectively. Since "black" is an adjective and "computer" is a noun, "computer" can be used as a voice keyword, etc.
[0075] Step S30: Determine spam identity information according to the target spam feature information.
[0076] Junk identity information can be understood as junk names, such as glass or wooden cabinets, etc.
[0077] It should be understood that if the target garbage feature information is a target garbage contour line sample, it is necessary to find the garbage identity information corresponding to the target garbage contour line sample from the preset garbage identity mapping relationship table. There are multiple garbage contour line samples and multiple garbage identity information in the preset garbage identity mapping relationship table, and there is a one-to-one correspondence between the garbage contour line sample and the multiple garbage identity information.
[0078] It should also be understood that if the target spam characteristic information is a voice keyword, the voice keyword is directly used as spam identity information, etc.
[0079] Step S40: inputting the garbage identity information into a preset garbage classification model to obtain garbage classification information.
[0080] In order to accurately query garbage classification information, a household garbage data sample set can be obtained. There are multiple household garbage data samples in the household garbage data sample set. The multiple household garbage data samples are classified and processed to obtain multiple household garbage data sample subsets and corresponding garbage sample feature information, and the information entropy corresponding to the household garbage data sample set is determined. According to the garbage sample feature information, the conditional entropy corresponding to the multiple household garbage data sample subsets is determined respectively, and the information gain corresponding to the garbage sample feature information is determined according to the information entropy and the conditional entropy. A preset decision tree is constructed according to the information gain and the garbage sample feature information. The preset initial network model is trained according to the multiple household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
[0081] Garbage classification information can be hazardous waste, wet garbage, recyclable garbage and other garbage.
[0082] In this embodiment, the user can use junk images or junk voices to determine junk identity information, and then display the junk identity information in a search box of a preset junk classification model. If the junk identity information does not match the actual object, the user can also manually enter the junk identity information in the search box.
[0083] The preset garbage classification model can also display multiple garbage identity information related to the garbage identity information and corresponding garbage classification information.
[0084] For example, if the garbage identity information in the search box is a bottle, then the related multiple garbage identity information may be plastic bottles or glass bottles, etc., among which the garbage classification information corresponding to plastic bottles is recyclable garbage, and the garbage classification information corresponding to glass bottles is recyclable garbage, etc.
[0085] In the specific implementation, in order to accurately query garbage classification information, after the user enters the garbage identity information, he can also click to set the characteristic information of the garbage identity information, such as whether it is toxic, whether it is perishable, whether it contains recycled materials, material and form, etc.
[0086] Feature selection determines the performance of the model, and feature selection is crucial. This article is mainly based on the experience of environmental experts and scholars and relevant books and materials. At the same time, it considers common household waste disposal methods and combines the characteristics of household waste to select material, form, toxicity, whether it is perishable and whether it contains recyclable materials as effective features.
[0087] Among household garbage, some are toxic, such as waste batteries, waste light bulbs, waste thermometers, waste medicines, waste paint, waste pesticides, waste photo paper, etc. These toxic household garbage can be clearly distinguished from the garbage category and are generally classified as non-recyclable. Therefore, toxicity is selected as the effective feature of this article. [“1” means toxic, “0” means non-toxic].
[0088] Perishable garbage (i.e. wet garbage) generated in household life mainly includes: leftovers, vegetable stems and leaves, meat and offal, fruit shells and melon peels, indoor green plants, etc. However, these rotten household garbage are a type of biological or organic matter, which can form biogas and organic fertilizer, which is the main source of nutrients needed by plants and can also improve soil fertility. Therefore, whether an object is perishable can be used as a dimensional feature for classification. Therefore, the perishability is selected as the effective feature of this article. [“1” means rotten, “0” means not rotten].
[0089] Among household garbage, some waste can be recycled, such as paper, plastic, glass, metal, fabric, and bottles, etc. These wastes can be reused through reprocessing. Therefore, reuse is an important characteristic dimension. [“1” means reusable, “0” means non-reusable].
[0090] In family life, different garbage has different material compositions. To a certain extent, the material determines the category, such as paper, glass, plastic, metal, rubber, wood, cotton fabric, electronic products, chemicals, meat, etc. Therefore, 9 main materials are selected as effective features in this paper. [“0” represents paper, “1” represents glass, “2” represents plastic, “3” represents rubber, “4” represents wood, “5” represents metal, “6” represents cotton fabric, “7” represents electronic products, “8” represents chemicals, and “9” represents meat].
[0091] The forms of household garbage are generally divided into solid (bench), liquid (soy sauce), and gas (oxygen in bottles and cans). It can clearly distinguish whether it is wet garbage or recycled garbage. Therefore, the form is selected as the effective feature of this article. Among them, ["0" represents solid, "1" represents liquid, and "2" represents gas].
[0092] In this embodiment, firstly, household garbage information to be detected is obtained, and then feature extraction is performed on the household garbage information to be detected to obtain target garbage feature information, and then garbage identity information is determined according to the target garbage feature information, and the garbage identity information is input into a preset garbage classification model to obtain garbage classification information. Compared with the prior art, which requires manual garbage classification in advance and determines garbage classification information according to manually set garbage classification labels, in this embodiment, garbage identity information can be input into a preset garbage classification model to obtain garbage classification information, thereby improving the accuracy of garbage classification and further improving the efficiency of garbage classification.
[0093] refer to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the method for obtaining garbage classification information of the present invention.
[0094] Based on the first embodiment above, in this embodiment, before step S10, the following steps are further included:
[0095] Step S01: obtaining a household garbage data sample set, wherein the household garbage data sample set contains a plurality of household garbage data samples.
[0096] A plurality of garbage data are divided and processed according to a preset division strategy to obtain a plurality of garbage data sets, a plurality of garbage data training sets are selected from the plurality of garbage data sets, and a household garbage data sample set is determined according to the plurality of garbage data training sets.
[0097] It should be noted that multiple garbage data can be collected manually and through web crawlers and other technologies, household garbage entity data can be collected from environmental protection websites and third-party websites, and environmental experts and scholars can be invited to perform data denoising and data cleaning, and classify the data according to the garbage classification standards, and save the training data and test data in text format with UTF-8.
[0098] The preset division strategy can be equal division. For example, the multiple garbage data in the household garbage corpus are 4,000 data items. The 4,000 data items are then evenly divided into 5 equal parts, and the 5 equal parts of the divided data sets are used as multiple garbage data sets. In the specific implementation, 4 parts can be selected from any one of the multiple garbage data sets as the household garbage data sample set, etc.
[0099] Step S02: Classify the plurality of household garbage data samples to obtain a plurality of household garbage data sample subsets and corresponding garbage sample feature information.
[0100] Since each household garbage data sample contains corresponding garbage sample characteristic information, multiple household garbage data samples can be classified and processed according to the garbage sample characteristic information to obtain multiple household garbage data sample subsets.
[0101] The characteristic information of garbage samples includes toxicity characteristics, decay characteristics and recycling characteristics.
[0102] Step S03: Determine the information entropy corresponding to the household garbage data sample set.
[0103] Obtaining the number of garbage category labels and the total amount of household garbage data corresponding to the household garbage data sample set; calculating the information entropy corresponding to the household garbage data sample set by a first preset formula according to the number of garbage category labels and the total amount of household garbage data;
[0104] The first preset formula is:
[0105]
[0106] Where H(D) is the information entropy corresponding to the household garbage data sample set, Cm is the number of garbage category labels, and N is the total number of household garbage data.
[0107] Garbage category labels can be hazardous waste labels, wet waste labels, recyclable waste and other waste, etc.
[0108] In this embodiment, the total number of household garbage data in the household garbage data sample set is 101, the data feature column C = {toxicity, decomposition, recycling}, and the category label S = {hazardous garbage, wet garbage, recyclable garbage, other garbage}. Among them, S1 (hazardous garbage) = 23, S2 (wet garbage) = 34, S3 (recyclable garbage) = 24, S4 (other garbage) = 20. The information entropy required to classify a given household garbage data set is calculated according to the first preset formula as follows: It can be seen that 1.970 is the information entropy corresponding to the household garbage data sample set.
[0109] Step S04: determining conditional entropies corresponding to a plurality of household garbage data sample subsets respectively according to the garbage sample feature information.
[0110] In the specific implementation, if the training set is D, the number of samples in D is N, and the data in D has m categories, namely C 1 ,C 2 ,C 3 ,...,C m , Category C m The number of data is |C m |, n different values of any feature, denoted as a 1 , a 2 , a 3 , …, a n . According to the n values of the feature, D is divided into n subsets D 1 ,D 2 ,D 3 ,...,D n For any subset D i ∈{a 1 ,a 2 ,a 3 ,...,a n}, let D i The number of samples is N i , D i Belongs to class C i ∈{C 1 ,C 2 ,C 3 ,...,C m The number of samples of} is |C i |, then the conditional entropy of feature A on the data set
[0111] Calculate the conditional entropy of the "toxicity" feature. Toxicity is divided into two groups: toxic waste (D 00 ), non-toxic waste (D 01 ). Among them, D 00 There are 28 pieces of data, 23 of which are harmful garbage and 5 are other garbage. 01 There are 73 data, including 34 wet garbage, 24 recyclable garbage, and 15 other garbage. Therefore, according to the conditional entropy formula, the conditional entropy of toxicity characteristics is calculated as follows:
[0112]
[0113] It can be seen that the conditional entropy of the "toxicity" feature is 1.278.
[0114] Calculate the conditional entropy of the "rot" feature. Rot is divided into two groups: perishable waste (D 10 ), non-perishable waste (D 11 ). 10 There are 64 data, including 23 hazardous waste, 2 wet waste, 19 recyclable waste, and 20 other waste. D11 has 37 data, including 32 wet waste and 5 recyclable waste. Therefore, according to the conditional entropy formula (2), the conditional entropy of whether it is perishable is calculated as follows:
[0115]
[0116] It can be seen that the conditional entropy of the "rotten" feature is 1.298.
[0117] Calculate the conditional entropy of the "reuse" feature. Reuse is divided into two groups: reused garbage (D 20 ), non-recyclable waste (D 21 ). Among them, D 20 There are 70 data items, including 23 items of hazardous waste, 34 items of wet waste, and 13 items of other waste. 21 There are 31 data, of which 24 are recyclable garbage and 7 are other garbage. Therefore, the conditional entropy of whether the reusability feature is included is calculated as follows:
[0118]
[0119] It can be seen that the conditional entropy of the “reuse” feature is 1.256.
[0120] Step S05: Determine the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy.
[0121] The information gain corresponding to the feature information of the junk sample is calculated by a preset gain formula according to the information entropy and conditional entropy;
[0122] The preset gain formula is:
[0123] G(D,A)=H(D)-H(D|A)
[0124] Where G(D,A) is the information gain corresponding to the sample garbage feature information, H(D) is the information entropy, and H(D|A) is the conditional entropy.
[0125] In this embodiment, the information gain of the three features can be calculated by subtracting the conditional entropy of each feature from the information entropy of the household garbage data set. The information gain of the toxicity feature is 0.692, the information gain of the decay feature is 0.672, and the information gain of the reuse feature is 0.714.
[0126] Step S06: constructing a preset decision tree according to the information gain and the junk sample feature information.
[0127] In the specific implementation, the one with the largest information gain can be selected from all feature columns as the root node or internal node - split the node, split the entire column, and generate a preset decision tree.
[0128] According to the different values of the partitioning nodes, the data set is split into several subsets, and then the current feature column is deleted, and the information entropy of the remaining feature columns is calculated. If there is information gain, it is repeated until the partition is completed. After the first partition, reuse and non-reuse contain multiple labels, so the partition can be continued. The sign of the end of the partition is: there is only one category label in the subset, and the partition is stopped. Reference Figure 4 , Figure 4 This is a decision tree logic diagram of the second embodiment of the method for obtaining garbage classification information of the present invention.
[0129] Step S07: training a preset initial network model according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
[0130] A preset crossover strategy is determined according to multiple household garbage data sample sets, and a preset initial network model is trained according to the preset crossover strategy, multiple household garbage data sample subsets and a preset decision tree to obtain a preset garbage classification model. The preset crossover strategy is a 5-fold crossover strategy.
[0131] The preset initial network model is trained according to the preset crossover strategy, multiple household garbage data sample subsets and a preset decision tree to obtain an initial garbage classification model, a household garbage data sample test subset is obtained, the initial garbage classification model is tested by the household garbage data sample test subset to obtain a model test score, and when the model test score is greater than a preset threshold, the initial garbage classification model is used as the preset garbage classification model.
[0132] In this embodiment, the model evaluation score, i.e., the accuracy rate, can be used as the evaluation standard for the household waste classification model. The accuracy rate calculation formula is:
[0133]
[0134] Among them, P is the accuracy, N r The number of correctly classified samples in the test subset of household garbage data samples, N c It is the total amount of garbage in the household garbage data sample set.
[0135] In order to further accurately evaluate the built preset garbage classification model, this experiment evenly divides the household garbage dataset into 8 groups of different training data scales of 500, 1000, 1500, 2000, 2500, 2500, 3500 and 4000 items, and conducts accuracy tests. Figure 5 , Figure 5 This is a model verification curve diagram of the second embodiment of the garbage classification information acquisition method of the present invention. Figure 5 It can be seen that based on the data scale of 8 experiments, the performance evaluation of the decision tree model shows that as the scale of experimental data continues to increase, the accuracy rate also increases. When it approaches 4000 data, the accuracy rate tends to stabilize at 83.52%.
[0136] In order to more accurately evaluate the constructed decision tree household waste classification model, this experiment uses a 5-fold crossover experiment to divide the 4,000 household waste corpus data set into 5 equal parts, 4 of which are
[0137] As training data, the other one is used as test data. The experimental results of the 5-fold crossover strategy are shown in Table 1.
[0138] Table 1
[0139] Serial number Training Data Test Data Accuracy 1 1st, 2nd, 3rd, 4th 5th Equal 83.53% 2 1st, 2nd, 3rd, 5th 4th Part 83.41% 3 1st, 2nd, 4th, and 5th parts 3rd Equal 84.16% 4 1st, 3rd, 4th, and 5th parts Second portion 83.21% 5 2nd, 3rd, 4th, and 5th portions 1st Equal 83.27%
[0140] As can be seen from the above table, in the 5-fold crossover strategy experiment, the performance evaluation of the decision tree model showed that the highest local accuracy was 84.16% and the lowest local accuracy was 83.21%. In order to accurately and objectively evaluate the model performance, the experimental accuracy adopted the average value of the five groups, which was 83.52%.
[0141] In this embodiment, a household garbage data sample set is first obtained, wherein there are multiple household garbage data samples in the household garbage data sample set, and then the multiple household garbage data samples are classified and processed to obtain multiple household garbage data sample subsets and corresponding garbage sample feature information, and the information entropy corresponding to the household garbage data sample set is determined. Then, the conditional entropies corresponding to the multiple household garbage data sample subsets are respectively determined according to the garbage sample feature information, and the information gain corresponding to the garbage sample feature information is determined according to the information entropy and the conditional entropy, and a preset decision tree is constructed according to the information gain and the garbage sample feature information. Finally, a preset initial network model is trained according to the multiple household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model. Compared with the manual classification in the prior art, which leads to low garbage classification efficiency and accuracy, more effective features can be extracted by constructing a preset garbage classification model in this embodiment, so that the category of household garbage can be identified more accurately, comprehensively and quickly.
[0142] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the garbage classification information acquisition device of the present invention.
[0143] like Figure 6 As shown, the garbage classification information acquisition device proposed in the embodiment of the present invention includes:
[0144] The acquisition module 6001 is used to acquire household garbage information to be detected.
[0145] The extraction module 6002 is used to extract features of the household garbage information to be detected to obtain target garbage feature information.
[0146] The determination module 6003 is used to determine the spam identity information according to the target spam feature information.
[0147] The identification module 6004 is used to input the garbage identity information into a preset garbage classification model to obtain garbage classification information.
[0148] In this embodiment, firstly, household garbage information to be detected is obtained, and then feature extraction is performed on the household garbage information to be detected to obtain target garbage feature information, and then garbage identity information is determined according to the target garbage feature information, and the garbage identity information is input into a preset garbage classification model to obtain garbage classification information. Compared with the prior art, which requires manual garbage classification in advance and determines garbage classification information according to manually set garbage classification labels, in this embodiment, garbage identity information can be input into a preset garbage classification model to obtain garbage classification information, thereby improving the accuracy of garbage classification and further improving the efficiency of garbage classification.
[0149] Other embodiments or specific implementations of the garbage classification information acquisition device of the present invention can refer to the above-mentioned method embodiments and will not be described in detail here.
[0150] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0151] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0153] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for obtaining garbage classification information, characterized in that: The method for obtaining garbage classification information comprises the following steps: Obtain information about household waste to be tested; Extracting features of the household garbage information to be detected to obtain target garbage feature information; Determining spam identity information according to the target spam characteristic information; Inputting the garbage identity information into a preset garbage classification model to obtain garbage classification information; Before the step of obtaining household garbage information to be detected, the method further includes: Acquire a household garbage data sample set, wherein the household garbage data sample set contains a plurality of household garbage data samples; Classifying the plurality of household garbage data samples to obtain a plurality of household garbage data sample subsets and corresponding garbage sample feature information; Determining information entropy corresponding to the household garbage data sample set; Determine the conditional entropy corresponding to a plurality of household garbage data sample subsets respectively according to the garbage sample feature information; Determine the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy; Constructing a preset decision tree according to the information gain and the feature information of the junk samples; The preset initial network model is trained according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
2. The method according to claim 1, characterized in that The step of obtaining a household garbage data sample set comprises: The plurality of garbage data are divided and processed according to a preset division strategy to obtain a plurality of garbage data sets; Selecting a plurality of junk data training sets from the plurality of junk data sets; A household garbage data sample set is determined based on the multiple garbage data training sets.
3. The method according to claim 2, characterized in that The step of training a preset initial network model according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model comprises: Determining a preset crossover strategy based on a plurality of household garbage data sample sets; The preset initial network model is trained according to the preset crossover strategy, multiple household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
4. The method according to claim 3, characterized in that The step of training the preset initial network model according to the preset crossover strategy, multiple household garbage data sample subsets and the preset decision tree to obtain the preset garbage classification model includes: Training a preset initial network model according to the preset crossover strategy, multiple household garbage data sample subsets and the preset decision tree to obtain an initial garbage classification model; Get a test subset of household waste data samples; Testing the initial garbage classification model using the household garbage data sample test subset to obtain a model test score; When the model evaluation score is greater than a preset threshold, the initial garbage classification model is used as a preset garbage classification model.
5. The method according to any one of claims 2 to 4, characterized in that: The step of determining the information entropy corresponding to the household garbage data sample set comprises: Obtaining the number of garbage category labels and the total number of household garbage data corresponding to the household garbage data sample set; Calculate the information entropy corresponding to the household garbage data sample set according to the number of garbage category labels and the total number of household garbage data using a first preset formula; The first preset formula is: Where H(D) is the information entropy corresponding to the household garbage data sample set, Cm is the number of garbage category labels, and N is the total number of household garbage data.
6. The method according to any one of claims 2 to 4, characterized in that: The step of determining the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy comprises: Calculate the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy by using a preset gain formula; The preset gain formula is: G(D,A)=H(D)-H(DA) Where G(D,A) is the information gain corresponding to the sample garbage feature information, H(D) is the information entropy, and H(D|A) is the conditional entropy.
7. A garbage classification information acquisition device, characterized in that: The garbage classification information acquisition device comprises: An acquisition module, used for acquiring household garbage information to be detected; An extraction module, used for extracting features of the household garbage information to be detected to obtain target garbage feature information; A determination module, used to determine the spam identity information according to the target spam feature information; An identification module, used for inputting the garbage identity information into a preset garbage classification model to obtain garbage classification information; The acquisition module is further used to acquire a household garbage data sample set, wherein the household garbage data sample set contains a plurality of household garbage data samples; Classifying the plurality of household garbage data samples to obtain a plurality of household garbage data sample subsets and corresponding garbage sample feature information; Determining information entropy corresponding to the household garbage data sample set; Determine the conditional entropy corresponding to a plurality of household garbage data sample subsets respectively according to the garbage sample feature information; Determine the information gain corresponding to the feature information of the junk sample according to the information entropy and the conditional entropy; Constructing a preset decision tree according to the information gain and the feature information of the junk samples; The preset initial network model is trained according to a plurality of household garbage data sample subsets and the preset decision tree to obtain a preset garbage classification model.
8. A garbage classification information acquisition device, characterized in that: The device comprises: a memory, a processor and a garbage classification information acquisition program stored in the memory and executable on the processor, wherein the garbage classification information acquisition program is configured to implement the steps of the garbage classification information acquisition method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a garbage classification information acquisition program, and when the garbage classification information acquisition program is executed by the processor, the steps of the garbage classification information acquisition method according to any one of claims 1 to 6 are implemented.
