Early warning method and device for abnormal express parcel and storage medium
Through real-time collection and analysis of logistics data, the use of isolated forests and LightGBM models to identify abnormal packages is solved, and the problem of low processing efficiency of logistics abnormal data is improved.
Patent Information
- Application Number
- CN202411032412.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-17
AI Technical Summary
The processing efficiency of abnormal logistics data is low and the accuracy is poor, resulting in low logistics operation efficiency and it is difficult to detect and process abnormal express parcels in a timely manner.
By collecting express parcel data, pre-processing and classification using the isolated forest model and LightGBM model, abnormal parcels are identified and early warnings are issued to improve data processing efficiency and accuracy.
Real-time collection and analysis of logistics data is realized, abnormal data is discovered in a timely manner, data quality and availability are improved, abnormal express parcel processing efficiency is improved, and decision-making support is provided for logistics operations.
Smart Images

Figure CN119151400A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer data processing technology, and in particular to an early warning method, device and storage medium for abnormal express packages. Background Art
[0002] With the rapid development of e-commerce and the Internet, the logistics industry, as an important bridge connecting consumers and goods, has received increasing attention. However, in the logistics process, due to various reasons, logistics abnormalities frequently occur, such as cargo damage, loss, delays, etc., which bring many inconveniences and losses to consumers and merchants.
[0003] At the same time, logistics abnormal data is key information generated in the logistics operation process, which is of great significance for improving logistics efficiency and optimizing logistics services. However, due to the complexity of the logistics system and the diversity of data, how to effectively manage and utilize these abnormal data has become a challenge. The traditional logistics abnormal data processing method mainly relies on manual analysis and experience judgment, which has problems such as low efficiency and poor accuracy. Summary of the invention
[0004] The present invention provides an early warning method, device and storage medium for abnormal express parcels, which collect, process and analyze logistics data in real time, thereby discovering abnormal data, providing decision support for logistics operations, improving data quality and availability, and improving the efficiency of processing abnormal express parcels.
[0005] In a first aspect, the present invention provides an early warning method for abnormal express parcels, the method comprising the following steps:
[0006] S1. Collect the package data generated by each express package during transportation;
[0007] S2. Preprocess the package data to identify the package data corresponding to the abnormal package;
[0008] S3, sorting out the package data corresponding to the identified abnormal package, classifying the abnormal package data, and determining the abnormal type corresponding to the abnormal package;
[0009] S4. Publish the package data and abnormal type of the abnormal package, and issue an early warning for the abnormal package.
[0010] Optionally, before step S2, the method further includes:
[0011] Set a first current number of trees in each isolation forest and a second current number of sample fast wrapping, and construct multiple initial isolation forest models according to the first current number and the second current number;
[0012] For each initial isolation forest model, inputting the second current number of sample package data into the initial isolation forest model to obtain an initial package category prediction result corresponding to each sample express package;
[0013] According to the difference between the initial package category prediction result and the actual package category result corresponding to each sample express package, the prediction error of each sample express package is obtained;
[0014] Filtering an isolation forest model from the multiple initial isolation forest models according to the prediction error corresponding to each initial isolation forest model;
[0015] The isolation forest model is trained according to the sample package data to obtain an abnormal package recognition model;
[0016] In step S2, the package data is preprocessed to identify the package data corresponding to the abnormal package, including:
[0017] Inputting the package data of each express package into the abnormal package identification model to perform abnormal package identification processing, and obtaining a package identification result corresponding to each express package;
[0018] An express parcel with an abnormal parcel identification result is determined as an abnormal parcel, and abnormal parcel data corresponding to the abnormal parcel is obtained.
[0019] Optionally, the training of the isolation forest model according to the sample package data to obtain an abnormal package recognition model includes:
[0020] Input the sample package data of each sample express package into the isolation forest model, calculate the path length of the sample package data on each tree in the isolation forest model, and obtain the average sample path length; the sample express package is marked with a sample package category label, and the sample package category label includes a normal package category label and an abnormal package category label;
[0021] Obtaining a sample package category prediction result of the sample express package according to a difference between the average value of the sample path length and a preset threshold;
[0022] Determine sample loss data based on the difference between the sample package category prediction result corresponding to each sample express package and the sample package category label;
[0023] The isolation forest model is trained according to the sample loss data to obtain an abnormal package recognition model.
[0024] Optionally, before step S3, the method further includes:
[0025] Acquire preset package data of each preset express package in the preset express package set, wherein each preset express package is an abnormal package and is marked with a training abnormal type label;
[0026] Dividing the preset express package set into a training set and a validation set according to a preset ratio;
[0027] Input the training package data of each training express package in the training set into the LightGBM model, and perform abnormal feature extraction processing on each training package data based on the abnormal feature extraction network in the LightGBM model to obtain the training abnormal features of each training express package;
[0028] Based on the abnormal type prediction network in the LightGBM model, the training abnormality features of each training express package are processed for abnormal type prediction to obtain the training abnormal type result;
[0029] The LightGBM model is trained according to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set to obtain an initial abnormal type recognition model;
[0030] Verifying the initial abnormality type recognition model according to the verification set, and determining the abnormality type recognition model according to the verification result;
[0031] In step S3, the package data corresponding to the identified abnormal package is sorted, the abnormal package data is classified, and the abnormal type corresponding to the abnormal package is determined, including:
[0032] The package data corresponding to the abnormal package is input into the abnormal type recognition model for abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package.
[0033] Optionally, the verifying the initial abnormality type recognition model according to the verification set, and determining the abnormality type recognition model according to the verification result, includes:
[0034] Using a grid search algorithm and a K-fold cross validation method, the initial anomaly type recognition model is optimized and trained for hyperparameters to obtain an intermediate anomaly type recognition model;
[0035] Inputting the verification package data of each verified express package in the verification set into the intermediate abnormality type recognition model to obtain the verification abnormality type result of each verified express package;
[0036] Determining the verification parameters of the intermediate abnormal type identification model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0037] If the verification parameter satisfies a preset verification condition, determining the intermediate abnormality type recognition model as the abnormality type recognition model;
[0038] If the verification parameter does not meet the preset verification condition, the intermediate abnormal type recognition model is repeatedly trained to obtain the abnormal type recognition model.
[0039] Optionally, determining the verification parameters of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result of each verified express package and the verification abnormality type label includes:
[0040] Determining the accuracy of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package; and / or
[0041] Determining the recall rate of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package; and / or
[0042] Determining the F1 value of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0043] At least one of the precision rate, the recall rate, and the F1 value is determined as a verification parameter of the intermediate abnormality type recognition model.
[0044] Optionally, the verification parameter satisfies a preset verification condition including at least one of the following:
[0045] The accuracy rate reaches a preset accuracy rate threshold;
[0046] The recall rate reaches a preset recall rate threshold;
[0047] The F1 value reaches a preset F1 threshold.
[0048] The present invention also provides an early warning device for abnormal express parcels, comprising:
[0049] The data collection module is used to collect the package data generated by each express package during transportation;
[0050] An abnormal package identification module is used to pre-process the package data and identify the package data corresponding to the abnormal package;
[0051] An abnormality type determination module is used to sort out the package data corresponding to the identified abnormal package, classify the abnormal package data, and determine the abnormality type corresponding to the abnormal package;
[0052] The early warning module is used to publish the package data and abnormal type of abnormal packages and issue early warnings for the abnormal packages.
[0053] Optionally, the device further comprises:
[0054] An initial model building module, used to set a first current number of trees in each isolation forest and a second current number of sample fast wrapping, and build multiple initial isolation forest models according to the first current number and the second current number;
[0055] an initial result prediction module, for each initial isolation forest model, inputting the second current number of sample package data into the initial isolation forest model to obtain an initial package category prediction result corresponding to each sample express package;
[0056] An error determination module, for obtaining a prediction error for each sample express package according to a difference between an initial package category prediction result corresponding to each sample express package and a true package category result;
[0057] A model screening module, used for screening out an isolation forest model from the multiple initial isolation forest models according to the prediction error corresponding to each initial isolation forest model;
[0058] The abnormal package recognition model training module is used to train the isolation forest model according to the sample package data to obtain an abnormal package recognition model.
[0059] The abnormal package identification module includes:
[0060] A package identification unit, used for inputting the package data of each express package into the abnormal package identification model to perform abnormal package identification processing, and obtaining a package identification result corresponding to each express package;
[0061] The package data acquisition unit is used to determine the express package whose package identification result is an abnormal result as an abnormal package, and obtain the abnormal package data corresponding to the abnormal package.
[0062] Optionally, the abnormal package recognition model training module includes:
[0063] A sample data input unit is used to input the sample package data of each sample express package into the isolation forest model, calculate the path length of the sample package data on each tree in the isolation forest model, and obtain the average sample path length; the sample express package is marked with a sample package category label, and the sample package category label includes a normal package category label and an abnormal package category label;
[0064] A sample result prediction unit, used for obtaining a sample package category prediction result of the sample express package according to a difference between the average value of the sample path length and a preset threshold value;
[0065] A loss determination unit, used to determine sample loss data according to a difference between a sample package category prediction result corresponding to each sample express package and a sample package category label;
[0066] The model determination unit is used to train the isolation forest model according to the sample loss data to obtain an abnormal package recognition model.
[0067] Optionally, the device further comprises:
[0068] A preset data acquisition module, used to acquire preset package data of each preset express package in a preset express package set, wherein each preset express package is an abnormal package and is marked with a training abnormal type label;
[0069] A data partitioning module, used to divide the preset express package set into a training set and a verification set according to a preset ratio;
[0070] A feature extraction module is used to input the training package data of each training express package in the training set into the LightGBM model, and based on the abnormal feature extraction network in the LightGBM model, perform abnormal feature extraction processing on each training package data to obtain the training abnormal features of each training express package;
[0071] A training result determination module is used to perform abnormal type prediction processing on the training abnormality features of each training express package based on the abnormal type prediction network in the LightGBM model to obtain a training abnormality type result;
[0072] An initial model determination module is used to train the LightGBM model according to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set to obtain an initial abnormal type recognition model;
[0073] The abnormal model determination module is used to verify the initial abnormal type recognition model according to the verification set, and determine the abnormal type recognition model according to the verification result.
[0074] Correspondingly, the abnormal type determination module is further used to input the package data corresponding to the abnormal package into the abnormal type recognition model to perform abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package.
[0075] Optionally, the abnormal model determination module includes:
[0076] A parameter optimization unit, used to optimize and train the initial abnormal type recognition model using a grid search algorithm and a K-fold cross validation method to obtain an intermediate abnormal type recognition model;
[0077] A verification result determination unit, used for inputting the verification package data of each verified express package in the verification set into the intermediate abnormality type recognition model to obtain the verification abnormality type result of each verified express package;
[0078] A verification parameter determination unit, used to determine the verification parameters of the intermediate abnormality type identification model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package;
[0079] A model determination unit, configured to determine the intermediate abnormality type identification model as the abnormality type identification model if the verification parameter satisfies a preset verification condition;
[0080] A repeated training unit is used to obtain the abnormal type recognition model after repeatedly training the intermediate abnormal type recognition model if the verification parameter does not meet the preset verification condition.
[0081] Optionally, the verification parameter determination unit includes:
[0082] A first parameter determination subunit is used to determine the accuracy rate of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result of each verified express package and the verification abnormal type label; and / or
[0083] A second parameter determination subunit is used to determine the recall rate of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package; and / or
[0084] A third parameter determination subunit is used to determine the F1 value of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0085] The verification parameter determination subunit is used to determine at least one of the precision rate, the recall rate, and the F1 value as a verification parameter of the intermediate abnormality type recognition model.
[0086] Optionally, the verification parameter satisfies a preset verification condition including at least one of the following:
[0087] The accuracy rate reaches a preset accuracy rate threshold;
[0088] The recall rate reaches a preset recall rate threshold;
[0089] The F1 value reaches a preset F1 threshold.
[0090] The present invention also provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement an early warning method for abnormal express packages.
[0091] The present invention also provides a computer storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded by a processor and executed by the early warning method for abnormal express packages.
[0092] The abnormal express package early warning method, device and storage medium provided by the present invention have the following technical effects:
[0093] The present invention collects the parcel data generated by each express parcel during transportation, pre-processes the parcel data, identifies the parcel data corresponding to the abnormal parcel, classifies the abnormal parcel data, determines the abnormal type corresponding to the abnormal parcel, publishes the parcel data and the abnormal type of the abnormal parcel, and issues an early warning for the abnormal parcel. The present invention collects, processes and analyzes logistics data in real time, thereby being able to timely discover abnormal data, provide decision support for logistics operations, improve data quality and availability, and simultaneously improve the efficiency of processing abnormal express parcels. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] In order to more clearly illustrate the technical solutions and advantages of the embodiments of this specification or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0095] Figure 1 It is a structural schematic diagram of an early warning system for abnormal express parcels provided in an embodiment of this specification;
[0096] Figure 2 It is a flow chart of the early warning method for abnormal express parcels provided in the embodiment of this specification;
[0097] Figure 3 is a flow chart of a method for training an abnormal package recognition model provided by an embodiment of this specification;
[0098] Figure 4 It is a flowchart of a method for training the isolation forest model according to the sample package data to obtain an abnormal package recognition model provided by an embodiment of this specification;
[0099] Figure 5 It is a flowchart of a method for training an abnormal type recognition model provided by an embodiment of this specification;
[0100] Figure 6 It is a structural schematic diagram of an early warning device for abnormal express parcels provided in an embodiment of this specification;
[0101] Figure 7 It is a structural diagram of a server provided in an embodiment of this specification. DETAILED DESCRIPTION
[0102] 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.
[0103] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0104] See also Figure 1 , Figure 1 Schematic diagram of an early warning system for abnormal express parcels provided in an embodiment of this specification, such as Figure 1 As shown, the early warning system for abnormal express packages may include at least a server 01 and a client 02.
[0105] Specifically, in the embodiments of this specification, the server 01 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers, and may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, a memory, and the like. It can be used to identify abnormal packages and abnormal types from express parcels.
[0106] Specifically, in the embodiments of this specification, the client 02 may include physical devices such as smart phones, desktop computers, tablet computers, laptop computers, digital assistants, smart wearable devices, smart speakers, vehicle terminals, smart TVs, etc., and may also include software running in physical devices, such as web pages provided by some service providers to users, or applications provided by these service providers to users. The client 02 may display warning information corresponding to abnormal packages and their corresponding abnormal types.
[0107] The following introduces the early warning method for abnormal express parcels of the present invention. This specification provides the method operation steps as described in the embodiments or flow charts, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual system or server product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment). The early warning method for abnormal express parcels includes the following steps:
[0108] S1. Collect the package data generated by each express package during transportation;
[0109] S2. Preprocess the package data to identify the package data corresponding to the abnormal package;
[0110] In the embodiments of the present specification, after obtaining the package data, the data may be cleaned to remove abnormal values, blank values, etc., and then the cleaned package data may be preprocessed to identify abnormal package data corresponding to the abnormal package.
[0111] In the present disclosure, Figure 3 As shown, before step S2, the method further includes:
[0112] S301, setting a first current number of trees in each isolation forest and a second current number of sample fast wrapping, and constructing multiple initial isolation forest models according to the first current number and the second current number;
[0113] S303: for each initial isolation forest model, input the second current number of sample package data into the initial isolation forest model to obtain an initial package category prediction result corresponding to each sample express package;
[0114] S305, obtaining a prediction error for each sample express package according to a difference between an initial package category prediction result corresponding to each sample express package and a true package category result;
[0115] S307, selecting an isolation forest model from the multiple initial isolation forest models according to the prediction error corresponding to each initial isolation forest model;
[0116] S309: Train the isolation forest model according to the sample package data to obtain an abnormal package recognition model.
[0117] In the disclosed embodiment, multiple initial isolation forest models can be constructed by setting the first current number of trees in each isolation forest and the second current number of sample fast packages; based on the isolation forest algorithm, abnormal package data recognition is performed, the RANSAC algorithm is introduced, the minimum data set is randomly selected and the parameters a and b of the linear model are calculated, the predicted values of all points are calculated, and compared with the actual values to obtain the error, that is, the difference between the predicted value and the actual value, and the model with the largest number of points within the error range, that is, the model with the smallest error, is selected as the final model. According to the prediction error corresponding to each initial isolation forest model, the model with the smallest error can be screened out from the multiple initial isolation forest models as the isolation forest model, and the isolation forest model is trained according to the sample package data to obtain an abnormal package recognition model, thereby improving the convergence efficiency and accuracy of the abnormal package recognition model.
[0118] In the present disclosure, Figure 4 As shown, the isolation forest model is trained according to the sample package data to obtain an abnormal package recognition model, including:
[0119] S3091, inputting the sample package data of each sample express package into the isolation forest model, calculating the path length of the sample package data on each tree in the isolation forest model, and obtaining the average sample path length; the sample express package is marked with a sample package category label, and the sample package category label includes a normal package category label and an abnormal package category label;
[0120] S3093. Obtaining a sample package category prediction result of the sample express package according to a difference between the average value of the sample path length and a preset threshold value;
[0121] S3095. Determine sample loss data according to the difference between the sample package category prediction result corresponding to each sample express package and the sample package category label;
[0122] S3097. Train the isolation forest model according to the sample loss data to obtain an abnormal package recognition model.
[0123] In the disclosed embodiment, during the training process of the abnormal package recognition model, a new feature matrix can be constructed to determine the optimal parameters, such as the number of trees in the isolation forest, the sample size, etc. The path length of the sample point on each tree is calculated, and then the average of these path lengths is calculated. If this average is less than a predetermined threshold, the prediction result of the sample point is determined to be an abnormal point, that is, the sample package category prediction result is determined. The sample express parcels may include positive samples and negative samples, and the sample package category labels include normal package category labels and abnormal package category labels. The model parameters of the isolation forest model are adjusted according to the sample loss data until the training end conditions are met, and the isolation forest model at the end of the training is determined as the abnormal package recognition model.
[0124] This embodiment obtains a sample package category prediction result of the sample express package based on the difference between the average sample path length and a preset threshold; thereby determining sample loss data based on the difference between the sample package category prediction result corresponding to each sample express package and the sample package category label, and then training the isolation forest model based on the sample loss data, thereby improving the convergence efficiency of the model and improving the training efficiency of the abnormal package recognition model.
[0125] Exemplarily, in step S2, preprocessing the package data to identify the package data corresponding to the abnormal package includes:
[0126] Inputting the package data of each express package into the abnormal package identification model to perform abnormal package identification processing, and obtaining a package identification result corresponding to each express package;
[0127] An express parcel with an abnormal parcel identification result is determined as an abnormal parcel, and abnormal parcel data corresponding to the abnormal parcel is obtained.
[0128] In the disclosed embodiment, after the abnormal package recognition model is trained, the package data of each express package can be directly input into the abnormal package recognition model for abnormal package recognition processing to obtain the package recognition result corresponding to each express package, thereby quickly and accurately identifying the abnormal package.
[0129] S3, sorting out the package data corresponding to the identified abnormal package, classifying the abnormal package data, and determining the abnormal type corresponding to the abnormal package;
[0130] In the present disclosure, Figure 5 As shown, before step S3, the method further includes:
[0131] S501, obtaining preset package data of each preset express package in a preset express package set, wherein each preset express package is an abnormal package and is marked with a training abnormal type label;
[0132] S503, dividing the preset express package set into a training set and a verification set according to a preset ratio;
[0133] S505, inputting the training package data of each training express package in the training set into the LightGBM model, performing abnormal feature extraction processing on each training package data based on the abnormal feature extraction network in the LightGBM model, and obtaining the training abnormal features of each training express package;
[0134] S507, performing abnormal type prediction processing on the training abnormal features of each training express package based on the abnormal type prediction network in the LightGBM model to obtain a training abnormal type result;
[0135] S509, training the LightGBM model according to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set to obtain an initial abnormal type recognition model;
[0136] S5011. Verify the initial abnormality type recognition model according to the verification set, and determine the abnormality type recognition model according to the verification result.
[0137] In the disclosed embodiment, the preset ratio can be set according to the actual situation, for example, it can be set to 8:2, that is, the data ratio corresponding to the training set and the validation set is 8:2. The initial model is constructed based on LightGBM. The LightGBM model is an implementation of a gradient boosting decision tree (GBDT). Its essential principle is to use the base classifier training integration to obtain the optimal model. The sample set can be randomly divided into a data training set and a validation set in an 8:2 manner (ensuring that the ratio of positive and negative samples is consistent during division). Among them, the training set is used to construct an initial abnormal type recognition model and parameter optimization, and the validation set is used to evaluate the accuracy of the model. According to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set, the training loss data can be constructed, and the model parameters of the LightGBM model can be adjusted according to the training loss data until the training end condition is met, and the LightGBM model at the end of the training is determined as the initial abnormal type recognition model. Then, the initial abnormal type recognition model is verified according to the validation set, and the abnormal type recognition model is determined according to the verification result.
[0138] In the disclosed embodiment, the abnormal types at least include wrong address, customer refusal, abnormal delivery, change of delivery address, self-pickup, self-pickup at cooperative store, unknown address, delivery to unmanned customer whose mobile phone cannot be contacted, out-of-area items, no outlets. Contact xxx by phone, island entry fee, large cargo fee, paid delivery additional weight fee, warehouse entry fee, delivery fee, random charges, over-standard fees, damaged items, contaminated items, liquid paste express, short items, delivery bill detachment, customs detention, wrong delivery (division), headless items, intercepted items, returned items, contraband, empty delivery bill, mother-child items, double-sided bill, multiple items on one ticket, items in the same line, naked packaging, and rain-soaked items to be processed.
[0139] In the disclosed embodiment, by constructing a training set and a validation set to determine an abnormal type recognition model, the accuracy of the abnormal type recognition model in identifying the abnormal type of an abnormal package can be improved.
[0140] In some embodiments, the verifying the initial abnormality type recognition model according to the verification set and determining the abnormality type recognition model according to the verification result includes:
[0141] Using a grid search algorithm and a K-fold cross validation method, the initial anomaly type recognition model is optimized and trained for hyperparameters to obtain an intermediate anomaly type recognition model;
[0142] Inputting the verification package data of each verified express package in the verification set into the intermediate abnormality type recognition model to obtain the verification abnormality type result of each verified express package;
[0143] Determining the verification parameters of the intermediate abnormal type identification model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0144] If the verification parameter satisfies a preset verification condition, determining the intermediate abnormality type recognition model as the abnormality type recognition model;
[0145] If the verification parameter does not meet the preset verification condition, the intermediate abnormal type recognition model is repeatedly trained to obtain the abnormal type recognition model.
[0146] In the disclosed embodiment, the SMOTE algorithm can be applied to oversample the positive samples, and the grid search (GridSearch) and K-fold cross-validation method (K-foldcross-validation) can be applied to optimize and train the hyperparameters of the model, wherein the hyperparameter optimization is carried out according to the highest F1 principle, and the threshold is adjusted to achieve a relatively balanced model effect.
[0147] In the embodiment of the present disclosure, the verification parameter of the intermediate abnormal type identification model is determined according to the difference between the verification abnormal type result of each verified express package and the verification abnormal type label, including:
[0148] Determining the accuracy of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package; and / or
[0149] Determining the recall rate of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package; and / or
[0150] Determining the F1 value of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0151] At least one of the precision rate, the recall rate, and the F1 value is determined as a verification parameter of the intermediate abnormality type recognition model.
[0152] In the disclosed embodiment, evaluation indicators such as precision, recall, and F1 value can be used to evaluate the model. The predicted value represents the number of positive samples predicted by the model, and the actual hit represents the number of positive samples that are truly predicted accurately. The precision rate is the proportion of positive samples predicted correctly by the model in the validation set among all positive samples predicted by the model; the recall rate is the proportion of positive samples predicted correctly by the model in the validation set among all positive samples; the F1 value takes into account both the precision and recall of the classification model.
[0153] In the embodiment of the present disclosure, the verification parameter satisfies the preset verification condition including at least one of the following:
[0154] The accuracy rate reaches a preset accuracy rate threshold;
[0155] The recall rate reaches a preset recall rate threshold;
[0156] The F1 value reaches a preset F1 threshold.
[0157] Exemplarily, the verification parameter satisfying the preset verification condition may include that the precision reaches a preset precision threshold; the recall reaches a preset recall threshold; and the F1 value reaches a preset F1 threshold.
[0158] Exemplarily, in step S3, the package data corresponding to the identified abnormal package is sorted, the abnormal package data is classified, and the abnormal type corresponding to the abnormal package is determined, including:
[0159] The package data corresponding to the abnormal package is input into the abnormal type recognition model for abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package.
[0160] In the disclosed embodiment, after the abnormal type recognition model is trained, the package data corresponding to the abnormal package can be input into the abnormal type recognition model for abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package, thereby achieving fast and accurate prediction of the abnormal type corresponding to the abnormal package.
[0161] S4. Publish the package data and abnormal type of the abnormal package, and issue an early warning for the abnormal package.
[0162] In the embodiment of the present disclosure, after the abnormal package data and the abnormal type of the abnormal package are identified, the package data and the abnormal type of the abnormal package can be published, and an early warning can be issued for the abnormal package; wherein the early warning can include generating early warning information according to the package data and the abnormal type of the abnormal package, and sending the early warning information to the terminal to implement an early warning of the abnormal package, so that the user can formulate an abnormal handling strategy corresponding to the abnormal package according to the abnormal type and the abnormal package data, thereby improving the handling efficiency of the abnormal package.
[0163] It can be seen from the technical solutions provided in the above embodiments of this specification that the embodiments of this specification collect the package data generated by each express package during the transportation process, pre-process the package data, identify the package data corresponding to the abnormal package, classify the abnormal package data, determine the abnormal type corresponding to the abnormal package, publish the package data and abnormal type of the abnormal package, and issue an early warning for the abnormal package. The present invention collects, processes and analyzes logistics data in real time, so as to timely discover abnormal data, provide decision support for logistics operations, improve the quality and availability of data, and at the same time improve the processing efficiency of abnormal express packages.
[0164] This embodiment also provides an early warning device for abnormal express parcels, such as Figure 6 As shown, the device comprises:
[0165] The data collection module 610 is used to collect the package data generated by each express package during the transportation process;
[0166] An abnormal package identification module 620 is used to pre-process the package data and identify the package data corresponding to the abnormal package;
[0167] The abnormality type determination module 630 is used to sort out the package data corresponding to the identified abnormal package, classify the abnormal package data, and determine the abnormality type corresponding to the abnormal package;
[0168] The warning module 640 is used to publish the package data and abnormal type of the abnormal package and issue a warning for the abnormal package.
[0169] Optionally, the device further comprises:
[0170] An initial model building module, used to set a first current number of trees in each isolation forest and a second current number of sample fast wrapping, and build multiple initial isolation forest models according to the first current number and the second current number;
[0171] an initial result prediction module, for each initial isolation forest model, inputting the second current number of sample package data into the initial isolation forest model to obtain an initial package category prediction result corresponding to each sample express package;
[0172] An error determination module, for obtaining a prediction error for each sample express package according to a difference between an initial package category prediction result corresponding to each sample express package and a true package category result;
[0173] A model screening module, used for screening out an isolation forest model from the multiple initial isolation forest models according to the prediction error corresponding to each initial isolation forest model;
[0174] The abnormal package recognition model training module is used to train the isolation forest model according to the sample package data to obtain an abnormal package recognition model.
[0175] The abnormal package identification module includes:
[0176] A package identification unit, used for inputting the package data of each express package into the abnormal package identification model to perform abnormal package identification processing, and obtaining a package identification result corresponding to each express package;
[0177] The package data acquisition unit is used to determine the express package whose package identification result is an abnormal result as an abnormal package, and obtain the abnormal package data corresponding to the abnormal package.
[0178] Optionally, the abnormal package recognition model training module includes:
[0179] A sample data input unit is used to input the sample package data of each sample express package into the isolation forest model, calculate the path length of the sample package data on each tree in the isolation forest model, and obtain the average sample path length; the sample express package is marked with a sample package category label, and the sample package category label includes a normal package category label and an abnormal package category label;
[0180] A sample result prediction unit, used for obtaining a sample package category prediction result of the sample express package according to a difference between the average value of the sample path length and a preset threshold value;
[0181] A loss determination unit, used to determine sample loss data according to a difference between a sample package category prediction result corresponding to each sample express package and a sample package category label;
[0182] The model determination unit is used to train the isolation forest model according to the sample loss data to obtain an abnormal package recognition model.
[0183] Optionally, the device further comprises:
[0184] A preset data acquisition module, used to acquire preset package data of each preset express package in a preset express package set, wherein each preset express package is an abnormal package and is marked with a training abnormal type label;
[0185] A data partitioning module, used to divide the preset express package set into a training set and a verification set according to a preset ratio;
[0186] A feature extraction module is used to input the training package data of each training express package in the training set into the LightGBM model, and based on the abnormal feature extraction network in the LightGBM model, perform abnormal feature extraction processing on each training package data to obtain the training abnormal features of each training express package;
[0187] A training result determination module is used to perform abnormal type prediction processing on the training abnormality features of each training express package based on the abnormal type prediction network in the LightGBM model to obtain a training abnormality type result;
[0188] An initial model determination module is used to train the LightGBM model according to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set to obtain an initial abnormal type recognition model;
[0189] The abnormal model determination module is used to verify the initial abnormal type recognition model according to the verification set, and determine the abnormal type recognition model according to the verification result.
[0190] Correspondingly, the abnormal type determination module is further used to input the package data corresponding to the abnormal package into the abnormal type recognition model to perform abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package.
[0191] Optionally, the abnormal model determination module includes:
[0192] A parameter optimization unit, used to optimize and train the initial abnormal type recognition model using a grid search algorithm and a K-fold cross validation method to obtain an intermediate abnormal type recognition model;
[0193] A verification result determination unit, used for inputting the verification package data of each verified express package in the verification set into the intermediate abnormality type recognition model to obtain the verification abnormality type result of each verified express package;
[0194] A verification parameter determination unit, used to determine the verification parameters of the intermediate abnormality type identification model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package;
[0195] A model determination unit, configured to determine the intermediate abnormality type identification model as the abnormality type identification model if the verification parameter satisfies a preset verification condition;
[0196] A repeated training unit is used to obtain the abnormal type recognition model after repeatedly training the intermediate abnormal type recognition model if the verification parameter does not meet the preset verification condition.
[0197] Optionally, the verification parameter determination unit includes:
[0198] A first parameter determination subunit is used to determine the accuracy rate of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result of each verified express package and the verification abnormal type label; and / or
[0199] A second parameter determination subunit is used to determine the recall rate of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package; and / or
[0200] A third parameter determination subunit is used to determine the F1 value of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package;
[0201] The verification parameter determination subunit is used to determine at least one of the precision rate, the recall rate, and the F1 value as a verification parameter of the intermediate abnormality type recognition model.
[0202] Optionally, the verification parameter satisfies a preset verification condition including at least one of the following:
[0203] The accuracy rate reaches a preset accuracy rate threshold;
[0204] The recall rate reaches a preset recall rate threshold;
[0205] The F1 value reaches a preset F1 threshold.
[0206] The device and method embodiments in the described device embodiments are based on the same inventive concept.
[0207] This embodiment also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement an early warning method for abnormal express packages.
[0208] This embodiment also provides a computer storage medium, in which at least one instruction or at least one program is stored. The at least one instruction or the at least one program is loaded and executed by a processor to implement an early warning method for abnormal express packages.
[0209] Optionally, in the embodiments of this specification, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0210] The memory described in the embodiments of this specification can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0211] The abnormal express package warning method, device and storage medium provided in the embodiments of this specification can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. For example, running on a server.
[0212] Figure 7 1 is a hardware structure diagram of a server of an abnormal express package early warning method provided in an embodiment of this specification. Figure 7As shown, the server 700 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 710 (the central processing unit 710 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 730 for storing data, and one or more storage media 720 (such as one or more mass storage devices) for storing application programs 723 or data 722. Among them, the memory 730 and the storage medium 720 can be short-term storage or permanent storage. The program stored in the storage medium 720 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 710 can be configured to communicate with the storage medium 720 and execute a series of instruction operations in the storage medium 720 on the server 700. The server 700 may also include one or more power supplies 760, one or more wired or wireless network interfaces 750, one or more input and output interfaces 740, and / or one or more operating systems 721, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0213] The input / output interface 740 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 700. In one example, the input / output interface 740 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 740 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0214] It can be understood by those skilled in the art that Figure 7 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 7 More or fewer components as shown, or with Figure 7 Different configurations shown.
[0215] It should be noted that the above sequence of the embodiments of this specification is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0216] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0217] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0218] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A warning method for abnormal express parcels, characterized in that: The method comprises the following steps: S1. Collect the package data generated by each express package during transportation; S2. Preprocess the package data to identify the package data corresponding to the abnormal package; S3, sorting out the package data corresponding to the identified abnormal package, classifying the abnormal package data, and determining the abnormal type corresponding to the abnormal package; S4. Publish the package data and abnormal type of the abnormal package, and issue an early warning for the abnormal package.
2. The method according to claim 1, characterized in that Before step S2, the method further includes: Set a first current number of trees in each isolation forest and a second current number of sample fast wrapping, and construct multiple initial isolation forest models according to the first current number and the second current number; For each initial isolation forest model, inputting the second current number of sample package data into the initial isolation forest model to obtain an initial package category prediction result corresponding to each sample express package; According to the difference between the initial package category prediction result and the actual package category result corresponding to each sample express package, the prediction error of each sample express package is obtained; Filtering an isolation forest model from the multiple initial isolation forest models according to the prediction error corresponding to each initial isolation forest model; The isolation forest model is trained according to the sample package data to obtain an abnormal package recognition model; In step S2, the package data is preprocessed to identify the package data corresponding to the abnormal package, including: Inputting the package data of each express package into the abnormal package identification model to perform abnormal package identification processing, and obtaining a package identification result corresponding to each express package; An express parcel with an abnormal parcel identification result is determined as an abnormal parcel, and abnormal parcel data corresponding to the abnormal parcel is obtained.
3. The method according to claim 2, characterized in that The step of training the isolation forest model according to the sample package data to obtain an abnormal package recognition model includes: Input the sample package data of each sample express package into the isolation forest model, calculate the path length of the sample package data on each tree in the isolation forest model, and obtain the average sample path length; the sample express package is marked with a sample package category label, and the sample package category label includes a normal package category label and an abnormal package category label; Obtaining a sample package category prediction result of the sample express package according to a difference between the average value of the sample path length and a preset threshold; Determine sample loss data based on the difference between the sample package category prediction result corresponding to each sample express package and the sample package category label; The isolation forest model is trained according to the sample loss data to obtain an abnormal package recognition model.
4. The method according to claim 1, characterized in that: Before step S3, the method further includes: Acquire preset package data of each preset express package in the preset express package set, wherein each preset express package is an abnormal package and is marked with a training abnormal type label; Dividing the preset express package set into a training set and a validation set according to a preset ratio; Input the training package data of each training express package in the training set into the LightGBM model, and perform abnormal feature extraction processing on each training package data based on the abnormal feature extraction network in the LightGBM model to obtain the training abnormal features of each training express package; Based on the abnormal type prediction network in the LightGBM model, the training abnormality features of each training express package are processed for abnormal type prediction to obtain the training abnormal type result; The LightGBM model is trained according to the difference between the training abnormal type result and the training abnormal type label of each training express package in the training set to obtain an initial abnormal type recognition model; Verifying the initial abnormality type recognition model according to the verification set, and determining the abnormality type recognition model according to the verification result; In step S3, the package data corresponding to the identified abnormal package is sorted, the abnormal package data is classified, and the abnormal type corresponding to the abnormal package is determined, including: The package data corresponding to the abnormal package is input into the abnormal type recognition model for abnormal type recognition processing to obtain the abnormal type corresponding to the abnormal package.
5. The method according to claim 4, characterized in that The verifying the initial abnormality type recognition model according to the verification set and determining the abnormality type recognition model according to the verification result includes: Using a grid search algorithm and a K-fold cross validation method, the initial anomaly type recognition model is optimized and trained for hyperparameters to obtain an intermediate anomaly type recognition model; Inputting the verification package data of each verified express package in the verification set into the intermediate abnormality type recognition model to obtain the verification abnormality type result of each verified express package; Determining the verification parameters of the intermediate abnormal type identification model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package; If the verification parameter satisfies a preset verification condition, determining the intermediate abnormality type recognition model as the abnormality type recognition model; If the verification parameter does not meet the preset verification condition, the intermediate abnormal type recognition model is repeatedly trained to obtain the abnormal type recognition model.
6. The method according to claim 5, characterized in that Determining the verification parameters of the intermediate abnormal type identification model according to the difference between the verification abnormal type result of each verified express package and the verification abnormal type label includes: Determining the accuracy of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package; and / or Determining the recall rate of the intermediate abnormality type recognition model according to the difference between the verification abnormality type result and the verification abnormality type label of each verified express package; and / or Determining the F1 value of the intermediate abnormal type recognition model according to the difference between the verification abnormal type result and the verification abnormal type label of each verified express package; At least one of the precision rate, the recall rate, and the F1 value is determined as a verification parameter of the intermediate abnormality type recognition model.
7. The method according to claim 6, characterized in that The verification parameter satisfies the preset verification condition, which includes at least one of the following: The accuracy rate reaches a preset accuracy rate threshold; The recall rate reaches a preset recall rate threshold; The F1 value reaches a preset F1 threshold.
8. An early warning device for abnormal express parcels, characterized in that: The device comprises: The data collection module is used to collect the package data generated by each express package during transportation; An abnormal package identification module is used to pre-process the package data and identify the package data corresponding to the abnormal package; An abnormality type determination module is used to sort out the package data corresponding to the identified abnormal package, classify the abnormal package data, and determine the abnormality type corresponding to the abnormal package; The early warning module is used to publish the package data and abnormal type of abnormal packages and issue early warnings for the abnormal packages.
9. An electronic device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the early warning method for abnormal express packages as described in any one of claims 1-7.
10. A computer storage medium, characterized in that: The computer storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the early warning method for abnormal express packages as described in any one of claims 1-7.
