A smart home-based desktop item rapid positioning method
By constructing a multi-level branch decision tree using principal component analysis and clustering algorithms, the problem of complex feature combinations in the location of items on home desktops is solved, enabling accurate item location and dynamic updates in complex environments, thus improving location efficiency and accuracy.
Patent Information
- Application Number
- CN202510050911.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-01-13
AI Technical Summary
In the location of items on a home desktop, there is a wide variety of items and complex and ever-changing combinations of features, making it difficult to quickly select the most representative and distinctive feature combinations. Furthermore, existing methods are not able to achieve accurate location in complex environments.
Principal component analysis is used to reduce the dimensionality of the multidimensional feature vectors of items. Similar items are grouped into one class by clustering algorithm. A multi-level branch decision tree is constructed, and the feature with the highest discriminative power is selected as the basis for branching in the decision tree. By combining similarity calculation and dynamic updating of the decision tree, intelligent positioning of items can be achieved.
It achieves intelligent and precise positioning of objects in complex environments, improving positioning efficiency and accuracy. It can handle occlusion or stacking situations and dynamically update the decision tree to adapt to changing object characteristics.
Smart Images

Figure CN119963644B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information technology, and in particular to a method for quickly locating desktop items based on smart home. BACKGROUND
[0002] In the positioning of home desktop items, there are many problems such as a large variety of items, complex and variable feature combinations. Each item has its unique features, such as color, shape, size, material, etc. The number of combinations of these features is huge, making it very difficult to find the optimal branch decision path in the vast number of feature combinations. At the same time, the similarity and difference between different items also bring challenges to the positioning. How to quickly filter out the feature combination with the most representative and discriminative degree from the numerous feature combinations, and build an efficient branch decision path based on these feature combinations, is a key technical problem that needs to be solved. In addition, the vector representation needs to accurately capture the key features of the items and have good generalization ability to adapt to the constantly changing variety of items and feature combinations. When evaluating the pros and cons of different branch decision paths, how to quantify the performance of the branch through the vector representation of the feature combination is also a problem worth exploring in depth. SUMMARY
[0003] The present application provides a method for quickly locating desktop items based on smart home, mainly comprising:
[0004] According to the pre-established item feature library, the multi-dimensional feature vector representation of the item to be positioned is obtained, including color, shape, size and material features;
[0005] The principal component analysis method is used to reduce the dimension of the multi-dimensional feature vector of the item, and the reduced feature vector is obtained, while retaining the discriminative degree of the features;
[0006] The clustering algorithm is used to cluster the reduced item feature vectors, similar items are clustered into a class, and the feature vector of each cluster center is calculated as the representative vector of the class of items;
[0007] Based on the item clustering results, a multi-level branch decision tree is constructed, each node represents a single item category, and the branches of the node represent different feature values;
[0008] For the item to be positioned, starting from the root node, matching its feature vector with the feature values of the branch nodes, recursively traversing the decision tree downward until reaching the leaf node, and obtaining the positioning result of the item;
[0009] If the item cannot be accurately located in the current decision tree, the feature vector of the item is calculated for similarity with the representative vectors of various types of items, the type of item with the highest similarity is selected as the positioning result, and the item is added to the corresponding type, the decision tree is updated, the generalization performance of the decision tree is evaluated by cross-validation method, and the complexity of the tree is controlled by using regularization technique.
[0010] The technical scheme provided by the embodiment of the application can include the following beneficial effects:
[0011] The application discloses a kind of based on smart home's desktop article rapid positioning method.The method first obtains the multidimensional feature vector of the article to be positioned, reduces dimension by principal component analysis and keeps discriminant degree.Then the feature vector after dimension reduction is clustered, and a multi-level branch decision tree is constructed.In each node of the decision tree, the feature with the highest discriminant degree is selected as the branch basis.For the article to be positioned, the final positioning result is obtained by recursive traversal of the decision tree through feature matching.For the shielding or stacking situation, the application uses region division and feature matching method to determine the article category and position.When accurate positioning is not possible, the best matching category is selected by similarity calculation, and the decision tree is dynamically updated.The application realizes the intelligent accurate positioning of article in complex environment, improves the positioning efficiency and accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0012] Fig. 1 It is a flow chart of the application of a kind of based on smart home's desktop article rapid positioning method.
[0013] Fig. 2 It is a schematic diagram of the application of a kind of based on smart home's desktop article rapid positioning method.
[0014] Fig. 3 It is still another schematic diagram of the application of a kind of based on smart home's desktop article rapid positioning method. DETAILED DESCRIPTION
[0015] The technical scheme in the embodiments of the application will be described clearly and in detail below with reference to the drawings in the embodiments of the application. The described embodiments are only a part of the embodiments of the application.
[0016] As Figs. 1-3 , the application of a kind of based on smart home's desktop article rapid positioning method specifically can include:
[0017] Step S101, according to the pre-established article feature library, the multidimensional feature vector representation of the article to be positioned is obtained, including color, shape, size and material characteristics.
[0018] According to a pre-established feature library, obtain the article image data, perform noise reduction processing on the article image data through a Gaussian filter to obtain a pre-processed article image; extract an edge contour point set for the pre-processed article image, and calculate the edge contour point set to obtain an article shape vector through a Fourier descriptor; divide an image region according to the article shape vector, and calculate the image region to obtain a material feature vector through a gray level co-occurrence matrix; perform normalization processing on the article shape vector and the material feature vector, and obtain an article multi-dimensional feature representation vector through weighted summation; perform principal component analysis dimension reduction on the article multi-dimensional feature representation vector to obtain an article feature vector.
[0019] Specifically, read the article image data from the pre-established feature library, denoise the image by a Gaussian filter, and obtain the preprocessed article image according to the image gray information. Extract the edge contour point set for the preprocessed article image, calculate the article shape feature by the Fourier descriptor, and obtain the article shape vector. Divide the area according to the article shape vector, calculate the article surface texture feature by the gray level co-occurrence matrix, and obtain the normalized material feature vector by the contrast, entropy value and energy value. Establish the pixel color histogram by using the article preprocessed image, reduce the dimension of the color space by the mean shift clustering, and obtain the main color tone distribution feature vector. Calculate the image proportion based on the article preprocessed image, calibrate the actual size according to the preset reference scale benchmark library, and obtain the article size feature vector. Normalize the article shape vector, the material feature vector, the main color tone distribution feature vector and the size feature vector, and obtain the article multi-dimensional feature representation vector by weighted summation. Perform principal component analysis dimension reduction on the article multi-dimensional feature representation vector, and obtain the final article feature vector representation. For the article image preprocessing process, the Gaussian filter is set to 5*5 by setting the filter window size, and the sigma value is 1.2. The original image is convolved pixel by pixel to reduce noise interference and enhance image data quality. The article image gray processing adopts the weighted average method, the red component weight is 0.299, the green component weight is 0.587, and the blue component weight is 0.114. The gray value is calculated. When the Fourier descriptor extracts the article shape feature, the Fourier transform is performed on the edge contour point set, and the first 32 Fourier coefficients are taken as the shape feature. The edge contour point set is extracted by the sobel operator, the horizontal direction gradient operator is [-1, 0, 1; -2, 0, 2; -1, 0, 1], the vertical direction gradient operator is [-1, -2, -1; 0, 0, 0; 1, 2, 1], and the edge point is calculated by the gradient amplitude. When the gray level co-occurrence matrix calculates the material feature, the pixel interval is set to 1, the direction angle is set to 0 degrees, 45 degrees, 90 degrees and 135 degrees, and four co-occurrence matrices are obtained. The contrast reflects the local change degree of the image, the entropy value represents the texture complexity, and the energy value represents the texture distribution uniformity. For smooth material, the energy value is large and the entropy value is small. For rough material, the energy value is small and the entropy value is large. The mean shift clustering is used for dimension reduction of the color space, the bandwidth parameter is set to 16, the pixel points are traversed, the distance between the current point and the neighborhood point is calculated, and the center point position is updated by iteration. The main color tone extraction sets the cluster number to 8, and the main color distribution of the article is obtained. The article size calibration is based on the preset reference scale benchmark library, which contains multiple standard object size data. The ratio relationship between the article pixel proportion in the image and the standard object pixel proportion in the benchmark library is calculated, and the actual size of the measured article is obtained combined with the actual size of the standard object. When the feature vectors are fused, the principal component analysis method is used for dimension reduction, and the feature components with a cumulative contribution rate of 95% are retained.The shape feature vector is 32-dimensional, the material feature vector is 12-dimensional, the color feature vector is 24-dimensional, and the size feature vector is 3-dimensional. The 71-dimensional feature vector is obtained by feature normalization and weighted summation, and is reduced to a 20-dimensional feature vector by principal component analysis. The weight coefficients are obtained by least square optimization. The shape feature weight is 0.3, the material feature weight is 0.25, the color feature weight is 0.25, and the size feature weight is 0.2.
[0020] In step S102, the multi-dimensional feature vector of the object is processed by principal component analysis to obtain a reduced dimension feature vector, while the discrimination of the feature is retained.
[0021] The original feature vector is normalized by a zero-mean normalization method, and the standardized feature data is obtained by calculating the mean vector and the standard deviation vector of the feature data. A covariance matrix is constructed according to the standardized feature data, and the eigenvalue descending order arrangement result and the feature vector are obtained by solving the covariance matrix by Jacobi iteration method. The cumulative variance contribution rate is calculated for the eigenvalue, and the feature vector mapping basis matrix is obtained by setting the variance contribution rate threshold. The reduced dimension feature data is obtained by linear transformation of the standardized feature data according to the feature vector mapping basis matrix. The reconstructed feature vector is obtained by linear reconstruction through the transpose matrix of the feature vector mapping basis matrix. If the reconstruction loss value is greater than the reconstruction threshold, the number of eigenvalues is increased.
[0022] Specifically, for the original feature vector of the item, a zero-mean normalization method is used to normalize the feature data, and the standardized feature data is obtained by calculating the mean vector and standard deviation vector of the feature data. A covariance matrix is constructed according to the standardized feature data, and the eigenvalues and eigenvectors of the covariance matrix are solved by the Jacobi iteration method to obtain the eigenvalue descending order result. The cumulative variance contribution rate formula is used to calculate the eigenvalue proportion, and the dimension number after dimension reduction is determined by setting the variance contribution rate threshold to obtain the feature vector mapping basis matrix. The standardized feature data is linearly transformed according to the feature vector mapping basis matrix to obtain the dimension reduction feature data, and the feature discriminability is judged by calculating the inter-class dispersion and intra-class dispersion. Linear reconstruction calculation is performed on the dimension reduction feature data, and the original dimension feature data is restored by the transpose matrix of the feature vector mapping basis matrix to obtain the reconstructed feature vector. The reconstruction loss value between the original feature vector and the reconstructed feature vector is calculated by the root mean square error, and if the loss value is greater than the reconstruction threshold, step 3 is returned to increase the number of eigenvalues. In the zero-mean normalization process, the original feature vector X=(2.1, 3.4, 1.8, 4.2, 2.7) is processed, the mean μ=2.84 and the standard deviation σ=0.924 are calculated, and the feature vector Z=(-0.801, 0.606, -1.126, 1.472, -0.152) is obtained after normalization. When constructing the covariance matrix, assume that there are 3 feature dimension sample data, the covariance matrix size is 3x3, and the matrix is filled by calculating the covariance value between different features. The covariance calculation uses the formula Cov(X, Y)=E[(X-μx)(Y-μy)], and the covariance matrix C=[[1.2, 0.8, -0.3], [0.8, 1.5, 0.4], [-0.3, 0.4, 0.9]] is obtained. The eigenvalues are solved by the Jacobi iteration method, the convergence threshold is set to 0.0001, and the maximum iteration number is set to 100, and the eigenvalues λ1=2.1, λ2=0.9, λ3=0.6 are obtained. When calculating the cumulative variance contribution rate, the formula η=λi / Σλi is used, and the variance contribution rates of the three eigenvalues are 58.3%, 25%, and 16.7%, respectively. Set the variance contribution rate threshold to 85%, select the feature vectors corresponding to the first two eigenvalues to construct the mapping basis matrix P=[[0.707, 0.577], [-0.707, 0.577], [0, -0.577]]. The mapping transformation is performed on the standardized feature data Z, and the new feature data Y=P^T×Z is obtained, which realizes the reduction from 3D to 2D. In the calculation of inter-class dispersion and intra-class dispersion, assume that there are two classes of samples, the first class of samples has a mean m1=(1.2, -0.8), the second class of samples has a mean m2=(-1.5, 0.6), and the overall mean M=(0.3, -0.2). The inter-class dispersion Sb is calculated by the weighted sum of squares of the two class means and the overall mean, and the intra-class dispersion Sw is calculated by the dispersion sum of squares of each class sample and the class mean.In the reconstruction process, the transpose of the mapping basis matrix is used to realize the reduction of the feature data to the original dimension, Z' = P x Y. The root mean square error RMSE = sqrt(∑(zi - zi')^2 / n) between the original standardized feature data Z and the reconstructed feature data Z' is calculated, and the reconstruction loss value 0.156 is obtained. If the loss value exceeds the preset reconstruction threshold 0.2, the number of feature values needs to be increased to re-map the dimension reduction. Through repeated iteration optimization, the appropriate number of dimension reduction features is determined.
[0023] In step S103, the dimension-reduced item feature vectors are clustered by a clustering algorithm, similar items are clustered into a class, and the feature vector of each cluster center is calculated as the representative vector of the class of items.
[0024] According to the feature vector set, the maximum and minimum distance values are calculated, the local density calculation and distance measurement method are used to obtain the density peak point number, and the initial cluster number is determined; for the initial cluster number, the initial cluster centroids are selected by data density distribution, the Euclidean distance formula is used to calculate the distance values of the feature vectors to each cluster centroid, and the cluster labels are obtained according to the minimum distance principle; according to the cluster labels, the mean of the feature vectors in each category is calculated as the new cluster centroid, and the new cluster centroid set is obtained by updating the centroid position coordinates; for the new cluster centroid set, the distance calculation and cluster labeling are repeated, if the position offset amount of the adjacent two rounds of cluster centroids is less than a preset threshold, the clustering effect is evaluated, and the clustering division result is obtained.
[0025] Specifically, according to the item dimension reduction feature vector set, the feature space distribution range is obtained by maximum minimum distance calculation, the density peak point number is determined by local density calculation and distance measurement method, and the initial clustering number is obtained. According to the data density distribution in the feature space, a plurality of initial clustering centroids are selected, the distance value of each feature vector to each clustering centroid is calculated by using the Euclidean distance formula, and the feature vectors are marked by clustering according to the minimum distance principle. According to the clustering marking result, the mean value of all feature vectors in each class is calculated as a new clustering centroid, and a new round of clustering centroid set is obtained by updating the centroid position coordinates. The feature vector distance calculation and clustering marking are repeated for the new round of clustering centroid set, and the iteration termination condition is judged by calculating the position offset of adjacent two rounds of clustering centroids. The intra-class dispersion and inter-class dispersion of the clustering result are calculated, the clustering effect is evaluated by the Davies-Bouldin index, and the final clustering division result is obtained. The weighted average value of the intra-class feature vector is calculated for each cluster, and the representative feature vector of the item in the class is obtained by the feature importance weight. After the item dimension reduction feature vector is normalized, the maximum minimum distance calculation is performed on the feature space, assuming that the feature vector is a two-dimensional space, the x-axis range is [-2.5, 3.2], and the y-axis range is [-1.8, 2.6]. The density distribution map is obtained by calculating the local density of each data point, wherein di j represents the distance between points i and j, dc is set to 0.4, χ(x) is 1 when x<0, otherwise it is 0. Assuming that there are 100 data points in the feature space, three local density peak points P1(1.2, 0.8), P2(-0.9, -0.5) and P3(2.1, 1.6) are calculated. For any feature vector V(x, y), the distance between the vector and each centroid is calculated by using the Euclidean distance formula d=sqrt((x-x i)^2+(y-yi)^2), such as the distance between the vector V(0.5, 0.3) and the three centroids is 0.85, 1.62 and 1.93 respectively, and the vector is divided into the first class according to the minimum distance principle. The new centroid position of each class after division is calculated, assuming that the first class contains 35 feature vectors, the new centroid P1'(1.1, 0.7) is obtained by calculating the average value of x coordinate and y coordinate. The position offset δ of the new and old centroids is calculated as 0.141, and the iteration termination threshold is set to 0.1. The intra-class dispersion Si is calculated as the average distance between all points in the class and the centroid, and the inter-class dispersion M ij is calculated as the distance between the centroids of two classes. Taking the first class as an example, Si=0.38, and the inter-class dispersion M12 between the first class and the second class is 2.15. The Davies-Bouldin index DB=(Si+Sj) / Mi j, the smaller the DB value, the better the clustering effect, and the overall DB index is calculated as 0.42.The importance weight of each class feature vector is calculated, and the weight wi = 1 / (1 + di) is defined by the distance to the centroid, di being the distance of the ith vector to the centroid. The weight of the vector closest to the centroid in the first class is 0.91, and the weight of the farthest vector is 0.45. The class representative vector R1 = (1.15, 0.75) is calculated by using the weighted average method. In this way, a representative vector that can reflect the feature distribution of each class is obtained for each cluster.
[0026] In step S104, based on the item clustering result, a multi-level branch decision tree is constructed, each node representing a single item category, and the branches of the node representing different feature values.
[0027] For the representative feature vector of each category in the item clustering result, the information gain ratio formula is used to calculate the discrimination of each feature dimension, and a feature priority sequence is obtained; the Gini coefficient is calculated according to the feature priority sequence to obtain the best split point of the feature, and the root node split rule is obtained through the split threshold; the sample space is divided using the root node split rule, and whether the node reaches the termination condition is judged by calculating the sample point category distribution entropy value in the subspace; for the subspace node that does not reach the termination condition, the branch node structure is generated in a recursive manner, and the branch path rule sequence is recorded by recording the split feature and the threshold.
[0028] Specifically, according to the representative feature vector of each category in the item clustering result, the information gain ratio formula is used to calculate the discrimination of each feature dimension, and the feature priority sequence is obtained by sorting the feature importance score. For the feature priority sequence, the Gini coefficient is calculated to obtain the best split point for each feature, and the sample space is divided into left and right subspaces through the split threshold to obtain the root node split rule. The sample space is bisected according to the root node split rule, the sample point category distribution entropy value in the subspace is calculated, and whether the termination condition is reached is judged by the node category entropy value. The feature splitting process is repeated for the non-terminated subspace node, and the child node branches are generated in a recursive manner, and the branch path rule is obtained by recording the split feature and the threshold. The cost complexity of the generated node branches is calculated, the pruning threshold is determined by the ratio of the node classification error rate to the node number, and the optimized node structure is obtained. The decision path is constructed in a depth-first traversal manner, the complete decision tree structure is generated by the node category label and the branch rule sequence, and the hierarchical representation of the item category is obtained. In the smart home system, in order to improve the accuracy of desktop item classification and positioning, the information gain ratio of the 4-dimensional feature vector, shape, color, size, and material, is calculated to determine the importance of each feature, and the information gain ratio = information gain / feature entropy. For a sample set containing three different categories of items, the number of samples in each category is 50, 30, and 20 respectively, and the total sample entropy value =-
[0029] (0.5 log 0.5 + 0.3 log 0.3 + 0.2 log 0.2) = 1.485. The information gain of the shape feature after partitioning is 0.6, and the feature entropy is 1.2. The information gain ratio is 0.5. Similarly, the priority sequence of other features is shape > material > color > size. Based on the highest priority shape feature, the Gini coefficient is calculated to determine the optimal split point. Assuming that the shape feature value range is [0, 1], the Gini coefficient is minimized at 0.28 when the split point is at 0.4. After partitioning, the left subspace contains 60 samples, and the right subspace contains 40 samples. The class entropy of the left subspace is calculated, with class 1 accounting for 0.6, class 2 accounting for 0.3, and class 3 accounting for 0.1. The entropy value is calculated to be 1.157. During the recursive partitioning process, the node entropy threshold is set to 0.3. If the node entropy is greater than the threshold, the partitioning continues. For the left subspace, the material feature is selected, and the split point at 0.6 results in four child nodes. The class entropy of each child node is 0.25, 0.42, 0.18, and 0.35, respectively. The nodes with entropy values of 0.42 and 0.35 need to be further partitioned, and the color feature is selected for partitioning. In the cost complexity pruning process, the node classification error rate is calculated using the formula e = (n - m) / n, where n is the number of node samples, and m is the number of dominant class samples. Assuming that a node contains 20 samples, with 12 samples of class 1, 5 samples of class 2, and 3 samples of class 3, the classification error rate is 0.4. The pruning parameter is set to α = 0.1, and the node cost is calculated as classification error rate + α × node size. If the subtree cost is greater than the single node cost, pruning is performed. By performing a depth-first traversal, a decision path is constructed from the root node to the leaf node, forming a complete classification rule. For example, the path rule "shape
[0030] ≤0.4 & material ≤0.6 & color ≤0.5" corresponds to class 1, containing 35 samples. The final generated decision tree contains 15 nodes, with an average depth of 3.2 and an average leaf node class purity of 0.85. The decision tree structure reflects the hierarchical partitioning of features, with higher-level nodes using more discriminative features and lower-level nodes using local discriminative features, forming a multi-level representation of item classes.
[0031] At each node of the branch decision tree, the feature with the highest discriminative power is selected as the basis for branching. Based on the selected branching feature, a binary method is used to determine the branching threshold. If the feature value is greater than the threshold, it is divided into the right branch, otherwise it is divided into the left branch.
[0032] According to the sample set, a category distribution entropy value is calculated by using an information entropy formula, a conditional entropy value is calculated by traversing a feature to obtain an information gain index; the information gain index is sorted in descending order, a maximum gain feature is used as a segmentation feature, a candidate segmentation point set is obtained by traversing a value interval of the segmentation feature; left and right subspace category distribution impurities are calculated from the candidate segmentation point set; an optimal segmentation threshold is determined by a minimum Gini index value; the sample space is bisected according to the optimal segmentation threshold, a subspace purity value is obtained by counting the number of categories, and a branch rule set is generated.
[0033] Specifically, for the node sample set, the class distribution entropy value is calculated by using the information entropy formula H=-∑(pi×log2pi), and the conditional entropy value is calculated by traversing all features to obtain the information gain index of each feature, where pi represents the proportion of the ith class sample. According to the feature information gain value, the descending order is sorted, the maximum gain feature is used as the splitting feature of the current node, and the candidate splitting point set is obtained by traversing the feature value interval. For the candidate splitting point set, the class distribution impurity of the left and right subspaces is calculated by using the Gini index formula Gini=1-∑(pi^2), and the optimal splitting threshold is determined by the minimum Gini index. According to the optimal splitting threshold, the sample space is divided into two parts, the subspace purity is calculated by using the class number statistics method, and the branch rule is generated by recording the splitting feature identifier and the threshold. The generated branch rule is cross-validated, the classification accuracy is calculated by using the leave-one-out method, and the effectiveness of the branch rule is judged by the accuracy threshold. For the subspace node that passes the verification, the feature selection process is repeated, the branch structure is constructed in a recursive manner, and the splitting termination is controlled by the node depth limit and the sample number constraint. Taking the item classification scene as an example, the node sample contains 3 categories, category A has 40 samples, category B has 35 samples, and category C has 25 samples, with a total of 100 samples. The class distribution entropy value of the current node is calculated by using the information entropy formula H=-0.4×log2(0.4)-0.35×log2(0.35)-0.25×log2(0.25)=1.543. In feature selection, assume that there are shape, material, and color three feature dimensions. For the shape feature, after dividing at the value 0.5, the left subspace contains 55 samples, 30 of which are A, 15 of which are B, and 10 of which are C, and the right subspace contains 45 samples, 10 of which are A, 20 of which are B, and 15 of which are C. The conditional entropy H(category|shape)=0.55×1.385+0.45×1.498=1.436 is calculated. The information gain value Gain=1.543-1.436=0.107 is obtained. Similarly, the material feature information gain is 0.085, and the color feature information gain is 0.063, and the shape feature is determined as the optimal splitting feature. Based on the value interval [0,1] of the shape feature, the step size 0.1 is set to traverse, and the Gini index is calculated at each candidate splitting point. Taking the splitting point 0.5 as an example, the left subspace Gini index Gini_left=1-(30 / 55)^2-(15 / 55)^2-(10 / 55)^2=0.614, the right subspace Gini index Gini_right=1-(10 / 45)^2-(20 / 45)^2-(15 / 45)^2=0.654, and the weighted average comprehensive Gini index is 0.632. The minimum Gini index 0.585 corresponding to the optimal splitting point 0.4 is obtained by traversing and comparing. The branch rule is cross-validated, 80% of the samples are used as the training set, and 20% of the samples are used as the validation set.The verification set contains 20 samples, 8 of which are of type A, 7 of type B, and 5 of type C. According to the segmentation rule "shape ≤ 0.4", the prediction classification is performed, and 16 correct classification samples are obtained, with a classification accuracy of 0.8, which is higher than the preset accuracy threshold of 0.75, and the verification is passed. When recursively constructing the branch structure, the maximum depth limit is set to 4 and the minimum sample number threshold is set to 10. For the 55 samples in the left subspace, feature selection is continued, and the maximum information gain of the material feature is calculated, and the segmentation is performed at the material feature value of 0.6. For the 45 samples in the right subspace, the color feature is selected, and the segmentation is performed at the color feature value of 0.3. When the node depth reaches 4 or the sample number is less than 10, the splitting is stopped to form a complete branch decision structure.
[0034] In step S105, for the object to be positioned, starting from the root node, the feature vector of the object is matched with the feature value of the branch node, and the decision tree is recursively traversed downward until the leaf node is reached, and the positioning result of the object is obtained.
[0035] The mean-variance standardization formula is used to calculate the mean and standard deviation of the feature dimension of the feature vector of the object to be positioned, and the standardized feature data is obtained. The feature value comparison method is used to determine the value interval according to the standardized feature data, and the next level branch node is selected through the split feature and threshold recorded by the root node of the decision tree. The access sequence of the next level branch node is stored in a depth-first manner, and the standardized feature data is matched with the feature threshold rule chain. The sample statistics of the leaf node matched by the hierarchical feature matching are obtained, and the class probability distribution of the leaf node is obtained by using the class frequency calculation method.
[0036] Specifically, for the feature vector of the to-be-positioned item, the mean-variance standardization formula Z=(X-μ) / σ is used to normalize the feature data, and the standardized feature data is obtained by calculating the mean and standard deviation of each feature dimension. According to the split feature and threshold recorded by the root node of the decision tree, the feature value size comparison method is used to determine the value interval of the standardized feature data in this dimension, and the next level branch is selected through the threshold judgment rule. According to the branch selection result, the node information is read, the depth-first method is used to store the node access sequence, and the feature threshold rule chain is used for step-by-step feature matching. For the case of missing features, a bidirectional branch search strategy is used to compensate for missing features, and the positioning results of multiple paths are combined through the weight voting method. The leaf node reached is statistically sampled, the class frequency calculation method is used to obtain the probability distribution of each class, and the optimal item class is obtained through the probability threshold screening. The positioning result is evaluated for confidence, the entropy calculation method is used to quantify the class distribution of the leaf node, and the reliability of the positioning result is judged through the confidence threshold. In the smart home environment, in order to realize the accurate positioning of the desktop item, the system calculates the mean μ=(2.0, 3.5, 1.5, 4.0) and standard deviation σ=(0.5, 0.3, 0.4, 0.2) of each feature dimension for the feature vector X=(2.5, 3.8, 1.2, 4.1) of the to-be-positioned item, and obtains the standardized feature vector Z=(1.0, 1.0, -0.75, 0.5) through the standardization formula. The standardization process eliminates the dimensional difference of different feature dimensions, so that the feature values are distributed in similar numerical intervals. In the decision tree traversal process, the split feature recorded by the root node is the first dimension, and the threshold value is 0.8. By comparing the standardized feature value 1.0>0.8, the right branch is selected to enter the next level node. The split feature recorded by this node is the third dimension, and the threshold is -0.5. By comparing the standardized feature value -0.75<-0.5, the left branch is selected for further traversal. The node access sequence [root node, right child node, left child node] is recorded during the depth-first search process, forming a complete feature matching path. For the case of missing features in the second dimension, both branches with feature values greater than and less than the threshold are traversed simultaneously. Assuming that the left branch reaches leaf node A, which contains 0.8 of class 1 samples and 0.2 of class 2 samples; the right branch reaches leaf node B, which contains 0.3 of class 1 samples and 0.7 of class 2 samples. Using the weighted voting method, the weight is proportional to the number of parent node samples, and the comprehensive probability of class 1 is calculated to be 0.65 and the comprehensive probability of class 2 is calculated to be 0.35. In the leaf node sample statistics, assuming that the node contains 50 samples, of which 35 are class 1, 10 are class 2, and 5 are class 3. The class probability distribution p1=0.7, p2=0.2, and p3=0.1 is calculated, and the final positioning result is determined to be class 1 through the preset probability threshold 0.6.The confidence evaluation of the positioning result adopts entropy value calculation, H = -∑(pi x log2pi) = -0.7 x log2(0.7) - 0.2 x log2(0.2) - 0.1 x log2(0.1) = 1.157. The smaller the entropy value is, the more concentrated the category distribution is, and the more reliable the positioning result is. The entropy value threshold is set to 1.5, and when the entropy value is less than the threshold, it is determined that the positioning result is reliable. In this example, the entropy value 1.157 is less than the threshold 1.5, the confidence of the positioning result meets the requirements, and the accuracy and reliability of the item positioning result are ensured through multiple verification mechanisms.
[0037] It is judged whether the to-be-positioned item exists shielding or stacking situation, if exists, the item is regionally divided, the independent region of the item is obtained, the feature matching method is adopted to compare with the preset item feature vector library, and the specific category and position information of the item are determined.
[0038] According to the Sobel edge detection operator, the edge point set is extracted from the item image, and the initial contour of the item is obtained by calculating the gradient amplitude and direction of the gray value of the adjacent pixel points; the edge breakpoint is identified from the initial contour of the item by using the contour tracking algorithm, and the shielding area of the item is obtained by calculating the curvature and gradient change rate of the contour; the region segmentation graph is constructed according to the shielding area of the item by using the watershed segmentation algorithm, and the independent contour of the item is obtained by region marking and boundary tracking; the Hu moment and Zernike moment are calculated for the independent contour of the item, and if the Euclidean distance of the Hu moment and the Zernike moment in the preset feature vector library is less than the distance threshold, the category of the item is obtained.
[0039] Specifically, according to the object image, Sobel edge detection operator is used to extract the object edge point set, the edge continuity is judged by calculating the gradient amplitude and direction of adjacent pixel points, and the initial contour of the object is obtained. For the initial contour, the edge breakpoint and overlapping area are identified by using the contour tracking algorithm, and the object shielding and stacking position are judged by calculating the curvature and gradient change rate of the contour. For the detected shielding area, the watershed segmentation algorithm is used to construct the region segmentation graph, and the independent contour of the object is obtained by region marking and boundary tracking. According to the independent contour, the region segmentation is refined by using the region growing method, and the optimized object region is obtained by analyzing the pixel connectivity and boundary smoothing. For the optimized region, the contour reconstruction is performed on the shielding part by using the Bezier curve fitting method, and the missing boundary is completed by control point interpolation. For the reconstructed complete contour, the Hu moment and Zernike moment are calculated to obtain the shape feature of the object, and the position information is determined by the object centroid coordinates and the principal axis direction. According to the extracted shape feature and position information, the Euclidean distance is used to measure the similarity in the preset feature vector library, and the object category is obtained by distance threshold judgment. When Sobel edge detection is used, the horizontal operator Gx = [-1, 0, 1; -2, 0, 2; -1, 0, 1] and the vertical operator Gy = [-1, -2, -1; 0, 0, 0; 1, 2, 1] are used for convolution operation on the image, and the gradient amplitude G = sqrt(Gx^2 + Gy^2) and the direction angle θ = arctan(Gy / Gx) are calculated. The gradient threshold is set to 100, and when the gradient amplitude is greater than the threshold, it is marked as an edge point, and the object edge point set is obtained. In the contour tracking process, the Euclidean distance and angle change between adjacent edge points are calculated. When the distance is greater than 5 pixels or the angle change is more than 45 degrees, it is determined as a contour breakpoint. The curvature is calculated as k = |x'y"-y'x"| / (x'^2+y'^2)^(3 / 2), and the area with a curvature value greater than 0.2 is marked as an overlapping area, and the shielding position of the object is obtained. In the watershed segmentation, the image gradient graph is calculated first, and the gradient value is taken as the terrain height. From the local minimum point, water is poured, and when the water level rises to the intersection of adjacent areas, the watershed line is formed. For the shielding object, two independent catchment basins are obtained, which are marked as region 1 and region 2 respectively, and the boundary point set constitutes the object segmentation line. Region growing starts from the region center point, and the difference between the 8-neighborhood pixels and the current region mean is calculated. If the difference is less than the threshold 15, the pixel is added to the region. The region boundary is smoothed by morphological operation, and the 3x3 structure element is used for open operation to remove burrs and close operation to fill small holes. In the Bezier curve reconstruction, control points P0(x0, y0), P1(x1, y1), P2(x2, y2) are selected at the contour breakpoint. The curve equation B(t) = (1-t)^2P0 + 2t(1-t)P1 + t^2P2, parameter t ∈ [0, 1]. The control point position is determined by least squares fitting of the known contour points to realize smooth contour completion.The central moment μpq=∑(x-x')^p(y-y')^q is calculated, where (x', y') is the centroid coordinate, p and q are non-negative integers representing the order of the moment, and (x, y) is the coordinate of each pixel in the image. The normalized central moment ηpq=μpq / μ00^((p+q) / 2+1) is calculated. For the object contour, the 3rd order moment is calculated to obtain 7 invariant moments. In the smart home environment, these invariant moments can help the system to more accurately identify and locate the desktop objects, even if the position, angle or size of these objects changes. The Zernike moment is calculated by the orthogonal polynomial expansion in polar coordinates to obtain a rotation-invariant shape descriptor. The extracted shape feature vector f=(η20, η02, η11, η30, η03, η21, η12) is matched with the pre-set feature library. The weighted Euclidean distance is used to calculate the similarity, and the weight wi reflects the importance of the feature. The distance threshold is set to 0.1, and when the minimum distance is less than the threshold, the object category is determined.
[0040] In step S106, if the object cannot be accurately located in the current decision tree, the feature vector of the object is calculated with the representative vector of each category of objects to obtain the highest similarity, and the object category with the highest similarity is selected as the positioning result. The object is added to the corresponding category, and the decision tree is updated. The generalization performance of the decision tree is evaluated by the cross-validation method, and the complexity of the tree is controlled by the regularization technique.
[0041] The cosine similarity is used to calculate the similarity value between the object feature vector and the representative vector of each category; the exponential weighted average method is used to update the representative vector of each category according to the similarity value, and the representative vector of each category is weighted by a decay factor to obtain the historical sample features; the K-fold cross-validation method is used to divide the training set and the validation set according to the representative vector of each category, and the optimal segmentation feature is selected by the Gini index criterion.
[0042] Specifically, for the unpositioned item feature vector, the cosine similarity formula cos(0) = (A■B) / (|A|■|B|) is used to calculate the similarity degree with each category representative vector, and the category to which the item belongs is determined by setting a similarity threshold. According to the similarity calculation result, the exponential weighted average method is used to update the target category representative vector, and the historical sample features are weighted by a decay factor to obtain the category representative vector after fusing the new sample. For the updated sample data, the K-fold cross-validation method is used to divide the data set into a training set and a validation set, and the optimal segmentation feature and threshold are selected by the Gini index criterion. According to the cross-validation result, the grid search method is used to determine the regularization parameter λ, and the number of decision tree nodes is controlled by the penalty term to obtain the optimized tree structure. For the optimized decision tree, the prediction accuracy and recall rate on the validation set are calculated, the generalization performance of the tree is evaluated by the F1 score, and the performance evaluation index is obtained. According to the performance evaluation result, the tree structure is pruned by the cost complexity parameter a, and the optimal tree size is determined by minimizing the loss function Loss = Error + a x |T|. For the unpositioned item feature vector A = (0.5, 0.8, 0.3) and a certain category representative vector B = (0.4, 0.7, 0.2), the cosine similarity is calculated as cos(0) = (0.5 x 0.4 + 0.8 x 0.7 + 0.3 x 0.2) / [sqrt(0.5^2 + 0.8^2 + 0.3^2) x sqrt(0.4^2 + 0.7^2 + 0.2^2)] = 0.985. Set the similarity threshold to 0.95, since 0.985 > 0.95, the item is determined to belong to this category. The category representative vector is updated, assuming the number of historical samples is 10, the exponential decay factor λ = 0.9, and the weight of the new sample is 1. The updated representative vector V_new is calculated as V_new = (λV_old x 10 + V_new) / (10 x λ + 1). Substituting the numerical values, the updated category representative vector (0.41, 0.71, 0.21) is obtained. Using 5-fold cross-validation, 100 samples are divided into 5 groups, with 20 samples in each group. In the first fold validation, 80 training samples are used to construct a decision tree, and the Gini index of feature A is calculated. Assuming that the threshold is 0.6, the left child node contains 50 samples, 40 of which belong to category 1 and 10 to category 2, and the right child node contains 30 samples, 5 of which belong to category 1 and 25 to category 2. The Gini index is calculated as Gini = 0.32. The regularization parameter λ is searched in the grid [0.01, 0.1, 1], and the validation set accuracy is 0.82, 0.88, and 0.75, respectively. Select λ = 0.1 as the optimal regularization parameter. The performance indicators on the validation set are calculated, the accuracy P = correct prediction sample number / total sample number = 16 / 20 = 0.8, the recall rate R = correct prediction positive sample number / actual positive sample number = 8 / 10 = 0.8, and the F1 score
[0043] = 2 x P x R / (P + R) = 0.8. In the cost complexity pruning, the parameter a e [0.001, 0.01, 0.1] is set. When a = 0.001, the tree size is 15 nodes and the training error is 0.15; when a = 0.01, the tree size is 10 nodes and the training error is 0.18; when a = 0.1, the tree size is 7 nodes and the training error is 0.25. The loss function Loss = Error + a x |T| is 0.165, 0.28, 0.95 respectively. The a = 0.001 is selected as the optimal pruning parameter, and the final decision tree structure of 15 nodes is obtained, which controls the complexity of the tree while maintaining a low prediction error, and improves the generalization ability of the model.
[0044] The above description is merely the preferred embodiments of the present application and the principle of the applied technology. It should be understood by those skilled in the art that the scope of the application involved in the present application is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the concept of the present application. For example, the above features are replaced with the technical features disclosed in the present application (but not limited to) having similar functions to form technical solutions.
Claims
1. A method for rapid location of desktop items in smart home systems, characterized in that, The method includes: Based on a pre-established object feature library, obtain a multi-dimensional feature vector representation of the object to be located, including color, shape, size, and material features; Principal component analysis is used to reduce the dimensionality of the multidimensional feature vectors of the items, resulting in dimensionality-reduced feature vectors while preserving the discriminative power of the features. Clustering algorithms are used to cluster the dimensionality-reduced item feature vectors, grouping similar items into one class, and calculating the feature vector of each cluster center as the representative vector of that class of items. Based on the item clustering results, a multi-level branch decision tree is constructed, where each node represents a single item category and the branches of the node represent different feature values. For the item to be located, starting from the root node, the decision tree is recursively traversed downwards based on its feature vector and the feature values of the branch nodes until a leaf node is reached, yielding the item's location result, including: For the feature vector of the item to be located, the mean and standard deviation of the feature dimension are calculated using the mean-variance standardization formula to obtain standardized feature data; The value range is determined by the feature value comparison method based on the standardized feature data, and the next-level branch node is selected by the segmentation features recorded by the root node of the decision tree and the threshold. The access sequence of the next-level branch node is stored in a depth-first manner, and the standardized feature data is matched step by step through a feature threshold rule chain; The leaf nodes matched by the stepwise features are statistically analyzed, and the class probability distribution of the leaf nodes is obtained by using the class frequency calculation method. It also includes: determining whether the item to be located is obstructed or stacked; if so, dividing the item into regions, obtaining the item's independent region, and comparing it with a preset item feature vector library using a feature matching method to determine the item's specific category and location information; If an item cannot be accurately located in the current decision tree, its feature vector is compared with the representative vectors of each item category. The category with the highest similarity is selected as the location result, and the item is added to the corresponding category. After updating the decision tree, the generalization performance of the decision tree is evaluated by cross-validation, and regularization is used to control the complexity of the tree.
2. The method according to claim 1, characterized in that, The process involves obtaining a multi-dimensional feature vector representation of the object to be located based on a pre-established object feature library, including color, shape, size, and material features, including: The object image data is obtained according to the pre-established feature library, and the object image data is denoised by a Gaussian filter to obtain the pre-processed object image. The edge contour point set is extracted from the preprocessed object image, and the object shape vector is obtained by calculating the edge contour point set using Fourier descriptors; The image region is divided according to the object shape vector, and the material feature vector of the image region is obtained by calculating the gray-level co-occurrence matrix. The object shape vector and the material feature vector are normalized, and a multidimensional feature representation vector of the object is obtained by weighted summation. Principal component analysis is performed on the multidimensional feature representation vector of the item to reduce its dimensionality, thereby obtaining the item feature vector.
3. The method according to claim 1, characterized in that, The method employs principal component analysis to reduce the dimensionality of the multidimensional feature vectors of the items, obtaining dimensionality-reduced feature vectors while preserving the discriminative power of the features, including: The original feature vectors are normalized using the zero-mean standardization method, and the standardized feature data are obtained by calculating the mean vector and standard deviation vector of the feature data. A covariance matrix is constructed based on the standardized feature data, and the covariance matrix is solved by the Jacobi iteration method to obtain the eigenvalues arranged in descending order and the eigenvectors. Calculate the cumulative variance contribution rate for each eigenvalue, and obtain the eigenvector mapping basis matrix by setting a variance contribution rate threshold. The standardized feature data is linearly transformed according to the feature vector mapping basis matrix to obtain dimensionality-reduced feature data. The reconstructed feature vector is obtained by linear reconstruction through the transpose of the feature vector mapping basis matrix. If the reconstruction loss value is greater than the reconstruction threshold, the number of feature values is increased.
4. The method according to claim 1, characterized in that, The process involves clustering the dimensionality-reduced item feature vectors using a clustering algorithm, grouping similar items into one class, and calculating the feature vector of each cluster center as the representative vector of that class of items. This includes: The maximum and minimum distance values are calculated based on the feature vector set. The number of density peak points is obtained by using local density calculation and distance measurement methods to determine the initial number of clusters. For the initial number of clusters, the initial cluster centroids are selected based on the data density distribution. The Euclidean distance formula is used to calculate the distance from the feature vector to each cluster centroid, and the cluster labels are obtained according to the minimum distance principle. Based on the clustering labels, the mean of the feature vectors in each category is calculated as the new cluster centroid, and a new set of cluster centroids is obtained by updating the centroid position coordinates. For the calculation of the repetition distance of the cluster centroid set and the cluster labeling in the new round, if the offset of the position of the cluster centroid between two adjacent rounds is less than a preset threshold, the clustering effect is evaluated and the clustering result is obtained.
5. The method according to claim 1, characterized in that, Based on the item clustering results, a multi-level branching decision tree is constructed. Each node represents a single item category, and the branches of the node represent different feature values, including: For the representative feature vector of each category in the item clustering results, the information gain ratio formula is used to calculate the discriminative power of each feature dimension, and a feature priority sequence is obtained. The Gini coefficient is calculated based on the feature priority sequence to obtain the optimal segmentation point of the feature, and the root node segmentation rule is obtained through the segmentation threshold. The sample space is divided using the root node segmentation rule, and the node is judged to have reached the termination condition by calculating the category distribution entropy value of the sample points in the subspace. For subspace nodes that do not meet the termination condition, a recursive method is used to generate branch node structures, and the segmented features and thresholds are recorded to obtain a branch path rule sequence. It also includes: at each node of the branch decision tree, selecting the feature with the highest discriminative power as the basis for branching that node; and using a binary method to determine the branch threshold based on the selected branch feature. If the feature value is greater than the threshold, it is divided into the right branch; otherwise, it is divided into the left branch.
6. The method according to claim 5, characterized in that, At each node of the branch decision tree, the feature with the highest discriminative power is selected as the basis for branching at that node. Based on the selected branch feature, a binary search method is used to determine the branch threshold. If the feature value is greater than the threshold, the node is assigned to the right branch; otherwise, it is assigned to the left branch. This includes: The information gain index is obtained by calculating the category distribution entropy value using the information entropy formula based on the sample set and by traversing the features to calculate the conditional entropy value. The information gain index is sorted in descending order, and the maximum gain feature is used as the segmentation feature. A set of candidate segmentation points is obtained by traversing the value range of the segmentation feature. The impurity of the left and right subspace category distribution is obtained by calculating the candidate segmentation point set, and the optimal segmentation threshold is determined by the minimum Gini index value; The sample space is bisected according to the optimal segmentation threshold, and the purity value of the subspace is obtained by counting the number of categories, thereby generating a set of branching rules.
7. The method according to claim 1, characterized in that, The process involves determining whether the item to be located is obstructed or stacked. If so, the item is divided into regions to obtain independent regions. A feature matching method is then used to compare these regions with a pre-defined item feature vector library to determine the item's specific category and location information, including: The Sobel edge detection operator is used to extract the set of edge points from the image of the object, and the initial outline of the object is obtained by calculating the gradient magnitude and direction of the gray values of adjacent pixels. The initial outline of the object is used to identify edge breakpoints, and the occlusion area of the object is obtained by calculating the outline curvature and gradient change rate. Based on the occlusion area of the object, a watershed segmentation algorithm is used to construct a region segmentation map, and the independent contour of the object is obtained through region marking and boundary tracking. For the independent contour of the item, calculate the Hude moment and Zernike moment. If the Euclidean distance between the Hude moment and Zernike moment in the preset feature vector library is less than the distance threshold, the item category is obtained.
8. The method according to claim 1, characterized in that, If an item cannot be accurately located in the current decision tree, its feature vector is compared with the representative vectors of each item category. The category with the highest similarity is selected as the location result, and the item is added to the corresponding category. After updating the decision tree, the generalization performance of the decision tree is evaluated using cross-validation, and regularization techniques are used to control the complexity of the tree, including: For the feature vector of an item, cosine similarity is used to calculate the similarity value with the representative vector of each category; Based on the similarity value, the category representative vector is updated using an exponentially weighted average method, wherein the category representative vector is obtained by weighting the historical sample features by a decay factor; For the representative vector of the category, the K-fold cross-validation method is used to divide the training set and the validation set. The training set and the validation set are obtained by selecting the optimal segmentation feature using the Gini index criterion.
Citation Information
Patent Citations
Article classification carrying method and system based on deep learning
CN118247732A
Bone tumor treatment scheme acquisition method and system, terminal and storage medium
CN118969172A
Textile woven structure anomaly detection method
CN119198586A