Device clustering method, device, computer device and storage medium
By acquiring the shooting number vector and similarity matrix of the imaging device, clustering of the imaging device is achieved, solving the problem of inefficiency in the prior art, and improving the accuracy and efficiency of application scenario classification.
Patent Information
- Application Number
- CN202110997621.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-27
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-08-27
AI Technical Summary
The prior art is difficult to cluster the camera equipment quickly and effectively, resulting in low manual labeling efficiency and the inability to quickly distinguish the camera equipment according to the application scenario.
By obtaining the number of shots of the camera device in a preset time period, calculating the similarity matrix, and clustering the camera device based on the similarity matrix to generate the device clustering results, realizing the application scenario classification of the camera device.
It improves the efficiency and accuracy of the classification of application scenarios of camera equipment, saves human resources, and simplifies the investigation and investigation process.
Smart Images

Figure CN113901981B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a device clustering method, device, computer device and storage medium. Background Art
[0002] With the rapid development of the Internet, the application of video equipment is becoming more and more widespread. Video equipment is installed in various application scenarios such as parking lots, libraries, and shopping malls, and is a means of supervision to maintain social order. When investigating cases and screening suspects, it is usually necessary to focus on screening the surveillance images of a certain type of application scenario. Then, it is necessary to effectively classify the application scenarios of video equipment, and then cluster the video equipment of the same application scenario into one category. At present, manually labeling the application scenarios of video equipment requires a lot of manpower and is very inefficient. How to quickly cluster video equipment according to the application scenarios to which the video equipment belongs has become an urgent problem to be solved. Summary of the invention
[0003] Based on this, it is necessary to provide a device clustering method, apparatus, computer equipment and storage medium to address the above technical issues, so as to solve the problem that the camera devices cannot be quickly clustered according to the application scenarios to which the camera devices belong.
[0004] A device clustering method, comprising:
[0005] Acquire a set of shooting number vectors, where the set of shooting number vectors includes shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on shooting data of the camera device within a preset time period;
[0006] Calculating the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix;
[0007] The camera devices are clustered based on the similarity matrix to obtain device clustering results corresponding to the camera devices.
[0008] A device clustering apparatus, comprising:
[0009] A shooting vector set module, used to obtain a shooting vector set, wherein the shooting vector set includes shooting vectors corresponding to each camera device to be clustered, and the shooting vectors are generated based on shooting data of the camera device within a preset time period;
[0010] A similarity matrix module is used to calculate the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix;
[0011] The device clustering result module is used to perform clustering processing on the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices.
[0012] A computer device comprises a memory, a processor and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the device clustering method when executing the computer-readable instructions.
[0013] One or more readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the device clustering method as described above.
[0014] In the above-mentioned device clustering method, apparatus, computer equipment and storage medium, the set of shooting number vectors includes the shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on the shooting data of the camera device within a preset time period. Since the shooting number vector reflects a kind of characteristic information of the image shooting number characteristics of the camera device within the preset time period, the characteristic information is associated with the application scenario to which the camera device belongs; similarity calculation is performed on any two shooting number vectors in the set of shooting number vectors to generate a similarity matrix; by clustering the camera devices based on the similarity matrix, the device clustering results corresponding to the camera devices are obtained, and the device clustering results include two or more device clustering clusters, and the devices in each device clustering cluster belong to the same application scenario, thereby realizing the clustering of camera devices based on the image shooting number characteristics of the camera devices within the preset time period to obtain device clustering results, which can effectively distinguish the application scenarios of the camera devices and improve the efficiency and accuracy of classifying the application scenarios of the camera devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0016] Figure 1 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0017] Figure 2 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0018] Figure 3 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0019] Figure 4 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0020] Figure 5 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0021] Figure 6 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0022] Figure 7 is a schematic diagram of a process of a device clustering method in one embodiment of the present invention;
[0023] Figure 8 is a structural schematic diagram of a device clustering apparatus in one embodiment of the present invention;
[0024] Fig. 9 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 creative work are within the scope of protection of the present invention.
[0026] In one embodiment, if Figure 1 As shown, a device clustering method is provided, which can be applied to a client or a server, wherein the client includes but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented with an independent server or a server cluster composed of multiple servers. The method is applied to the server as an example, and includes the following steps:
[0027] S10, obtaining a set of shooting number vectors; the set of shooting number vectors includes shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on shooting data of the camera device within a preset time period.
[0028] In one embodiment, the shooting number vector set is a vector set composed of multiple shooting number vectors. One shooting number vector corresponds to one camera device, that is, each shooting number vector is generated based on the shooting data of a single camera device within a preset time period.
[0029] In one embodiment, the camera device may be a semi-professional camera used in security, or may be other camera devices not used in security, which is not limited here.
[0030] In one embodiment, the shooting number vector is a kind of characteristic information reflecting the shooting number characteristics of the camera device within a preset time period, and the characteristic information is associated with the application scenario to which the camera device belongs.
[0031] For example, video cameras are widely used in many application scenarios such as schools, companies, banks, transportation, and safe cities. Video cameras detect whether there are passers-by 24 hours a day. When a passer-by enters the range monitored by the video camera, the video camera will take a picture of him or her and obtain a captured image. The more people pass through the range monitored by the video camera, the more times the video camera takes pictures, and the larger the number of images captured. Since the flow of people varies in different application scenarios, the flow of people passing through the application scenario in the same time period is different, so the number of images captured by the video camera in different application scenarios in the same time period is also different.
[0032] In one embodiment, the shooting data of the camera device within a preset time period can be obtained to generate a shooting vector corresponding to the camera device. The preset time period can be set according to the requirements. For example, the preset time period can be set to 24 hours. The shooting data includes each image shot by the camera device and the attribute information of each image. It can be understood that the above attribute information can include the shooting time. Of course, the attribute information can also include the identification information of the camera device, etc., which is not limited here.
[0033] Specifically, when generating the shooting number vector corresponding to the camera device based on the shooting data of the camera device within a preset time period, the shooting data within the preset time period can be obtained from each camera device to be clustered, and multiple time segments are divided from the preset time period according to the preset interval time. The number of images shot in each time segment is obtained according to the shooting data, and the number of images shot by the same camera in each time segment is determined. After obtaining the number of images shot by the same camera in each time segment, the time segments are sorted in order from the front to the back in time to generate a vector generated by the number of images shot in each time segment, which is used as the shooting number vector corresponding to the camera device. After generating the shooting number vectors corresponding to multiple camera devices respectively, a shooting number vector set can be generated according to the shooting number vectors corresponding to the multiple camera devices.
[0034] S20, performing similarity calculation on any two shooting number vectors in the shooting number vector set to generate a similarity matrix.
[0035] In one embodiment, it is necessary to calculate the similarity of any two shooting number vectors in the shooting number vector set, obtain the similarity between any two shooting number vectors, and generate a similarity matrix based on the similarity between any two shooting number vectors. The above similarity can reflect the degree of similarity between the two camera devices under the dimension feature of the number of image shots; the greater the similarity, the higher the degree of similarity between the two camera devices in the dimension feature of the number of image shots, and the smaller the similarity, the lower the degree of similarity between the two camera devices in the dimension feature of the number of image shots. It can be understood that the similarity model can be used to calculate the similarity of any two shooting number vectors in the shooting number vector set, and obtain the similarity between any two shooting number vectors. Among them, the similarity model includes the following formula SCR (X, Y), and the similarity is calculated by the formula SCR (X, Y).
[0036]
[0037] Wherein, X is the first camera device, and the first camera device belongs to any one of the camera devices to be clustered; Y is the second camera device, and the second camera device belongs to any one of the camera devices to be clustered; SCR (X, Y) represents the Spearman correlation coefficient between the first camera device X and the second camera device Y; i represents the time sequence number within the preset time period, wherein the time sequence number is a sequence number arranged in time order, and the value range of i is [1, m], where m is a positive integer greater than 1. i represents the number of images captured by the first camera device X at time sequence number i; i represents the number of images captured by the second camera device Y at time sequence number i; r x (x i ) represents the sequence number of the image capture number xi, wherein the sequence number is a sequence number arranged in the order of the image capture number; r y (y i ) represents the sequence number of the image capture number yi, where the sequence number is a sequence number in the order of the size of the image capture number.
[0038] It is understandable that the set of shooting number vectors includes shooting number vectors of several camera devices. The shooting number vector set is input into the similarity model, and the similarity between any two shooting number vectors in the shooting number vector set can be obtained by calculating the formula SCR (X, Y).
[0039] Optionally, the Euclidean distance function and the Pearson correlation coefficient function may be used to calculate the similarity between any two shooting number vectors in the shooting number vector set, thereby generating a similarity matrix.
[0040] In one example, for example, the set of shooting number vectors includes shooting number vectors of 6 camera devices, and the 6 camera devices are d1, d2, ..., d6 respectively. Then the generated similarity matrix is shown in Table 1.
[0041] Table 1 Similarity matrix
[0042] <![CDATA[d1]]> <![CDATA[d2]]> <![CDATA[d3]]> <![CDATA[d4]]> <![CDATA[d5]]> <![CDATA[d6]]> <![CDATA[d1]]> 1 <![CDATA[d2]]> 0.92 1 <![CDATA[d3]]> 0.78 0.68 1 d4 0.61 0.49 0.62 1 d5 0.77 0.57 0.96 0.74 1 d6 0.98 0.84 0.71 0.96 0.82 1
[0043] S30 , clustering the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices.
[0044] It is understandable that, since there are differences in the flow of people in different application scenarios, the flow of people passing through the application scenario in the same time period is different, so in the same time period, the number of images taken by the camera device in different application scenarios is also different. According to the difference in the number of images taken by the camera device, the camera devices are clustered according to the application scenarios to which the camera devices belong, and the device clustering results are obtained. The device clustering results include two or more device clustering clusters, and the devices in each device clustering cluster belong to the same application scenario. The device clustering model is used to cluster all camera devices to be clustered according to the similarity matrix. Before clustering all camera devices to be clustered, it is necessary to set the number of cluster categories M, and then cluster the camera devices into different M categories according to the preset number of categories M.
[0045] Clustering all the camera devices to be clustered can be achieved through a device clustering model, which includes but is not limited to a k-means algorithm. The k-means algorithm is a partition-based clustering method. The device clustering result refers to the clustering result of the camera devices. The device clustering result includes a number of device clustering clusters.
[0046] Specifically, a standard Laplace matrix can be constructed based on the similarity matrix, the eigenvector of the standard Laplace matrix can be calculated, and the eigenvector matrix can be generated based on the eigenvector. Each row of the eigenvector matrix F is used as a sample, with a total of n samples. The n samples are clustered using the device clustering model to obtain the clustering results C (C1, C2, ..., C M ).
[0047] In one example, there are 10 cameras (d1, d2, ..., d 10 ), M is set to 4, then the clustering results of the 10 camera devices are shown in Table 2. The clustering results of the 10 camera devices are shown in Table 2. Among them, the device cluster C1 includes (d1, d2, d4), and the device cluster C2 includes (d4, d6, d7, d 10 ), device cluster C3 includes (d5) and device cluster C4 includes (d3, d8).
[0048] Table 2 Clustering results
[0049] Camera equipment Device Clustering <![CDATA[d1、d2、d4]]> <![CDATA[C1]]> <![CDATA[d4、d6、d7、d 10 ]]> <![CDATA[C2]]> <![CDATA[d5]]> <![CDATA[C3]]> <![CDATA[d3、d8]]> <![CDATA[C4]]>
[0050] In steps S10-S30, the shooting number vector set includes the shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on the shooting data of the camera device within a preset time period. Since the shooting number vector reflects a kind of characteristic information of the image shooting number characteristics of the camera device within the preset time period, the characteristic information is associated with the application scenario to which the camera device belongs; similarity calculation is performed on any two shooting number vectors in the shooting number vector set to generate a similarity matrix; by clustering the camera devices based on the similarity matrix, the device clustering results corresponding to the camera devices are obtained, and the device clustering results include two or more device clustering clusters, and the devices in each device clustering cluster belong to the same application scenario, thereby realizing the clustering of the camera devices based on the image shooting number characteristics of the camera devices within the preset time period to obtain the device clustering results, which can effectively distinguish the application scenarios of the camera devices, improve the efficiency and accuracy of classifying the application scenarios of the camera devices, and then facilitate the centralized investigation of surveillance images belonging to a certain type of application scenario according to the clustering results of the camera devices when investigating cases and screening suspects, thereby accelerating the screening efficiency and saving human resources.
[0051] Optional, such as Figure 2 As shown, in step S10, a shooting number vector set is obtained; the shooting number vector set includes multiple shooting number vectors, including:
[0052] S101, obtaining shooting data of each camera device to be clustered within a preset time period;
[0053] S102, dividing the preset time period into a plurality of time segments according to preset intervals;
[0054] S103, determining the number of images captured by the camera device in multiple time segments according to the captured data;
[0055] S104 , sorting the image capture numbers of the camera device in multiple time segments in chronological order from the front to the back, and generating a capture number vector corresponding to the camera device.
[0056] It is understandable that the preset time period is a certain period of time set in advance, such as being set to 24 hours (a day).
[0057] The preset interval time refers to the time interval set according to the time setting instruction. Among them, the time setting instruction is generated after the operator (such as a tester) enters the preset interval time. For example, the interval time can be set to 6 minutes. The interval time can be set according to the actual situation of the device. For example, different devices process data at different speeds. The longer the interval time is set, the less data needs to be processed, and it is more suitable for devices with slower data processing speeds. The shorter the interval time is set, the more data needs to be processed, and it is more suitable for devices with faster data processing speeds. Optionally, different shooting number vectors can be obtained according to different interval time settings. The application scenarios of the camera equipment can be clustered according to different shooting number vectors to improve the accuracy of the clustering results.
[0058] One time segment corresponds to one image capture number, and the same camera device contains multiple image capture numbers. According to the time corresponding to the image capture number, the image capture numbers of the same camera device in different time segments are sorted in the order of time from the beginning to the end, and the capture number vector corresponding to the camera device is generated.
[0059] Specifically, the number of images captured and the shooting time of the camera device within a preset time period are obtained. The preset time period is divided into multiple time segments according to the set interval time. For example, as shown in Table 3, the preset interval time is 6 minutes, and the preset time period is 24 hours, then 240 time segments are obtained, and the number of images captured in each time segment is determined. According to the number of images captured in each time segment, each time segment is sorted in the order of time from the front to the back, and a shooting number vector corresponding to the camera device is generated. The shooting number vector is (1372, 5243, ..., 469).
[0060] Table 3 Time segments and image capture numbers corresponding to the interval time
[0061] Time Segment Number of images captured 00:00:00-00:06:00 1372 00:06:00-00:12:00 5243 ... ... 23:54:00-24:00:00 469
[0062] In steps S101-S103, the shooting data of each camera device to be clustered within a preset time period is obtained; the preset time period is divided into multiple time segments according to the preset interval time; the number of images shot by the camera device in the multiple time segments is determined according to the shooting data; the number of images shot by the camera device in the multiple time segments is sorted in the order of time from the front to the back, and the shooting number vector corresponding to the camera device is generated. By setting multiple time segments, the number of images shot by the camera device in different time segments can be determined, which can more accurately reflect the shooting number characteristics of the camera device at different points, thereby effectively improving the accuracy of clustering the application scenarios of the camera device according to the shooting number characteristics of the camera device in the preset time period.
[0063] Optional, such as Figure 3As shown, in step S20, similarity calculation is performed on any two shooting number vectors in the shooting number vector set to generate a similarity matrix, including:
[0064] S201, respectively calculating the similarity of any two shooting number vectors in the shooting number vector set to obtain the similarity between any two shooting number vectors;
[0065] S202: Generate a similarity matrix based on the similarity.
[0066] It can be understood that the similarity model is used to calculate the similarity of the set of shooting vectors to obtain a similarity matrix. Among them, the correlation coefficient algorithm is:
[0067]
[0068] Wherein, X is the first camera device, and the first camera device belongs to any one of the camera devices to be clustered; Y is the second camera device, and the second camera device belongs to any one of the camera devices to be clustered; SCR(X, Y) represents the Spearman correlation coefficient between the first camera device X and the second camera device Y; i represents the time sequence number within the preset time period, wherein the time sequence number is a sequence number in time order, and the value range of i is [1, m], where m is a positive integer greater than 1. i represents the number of images captured by the first camera device X at time sequence number i; i represents the number of images captured by the second camera device Y at time sequence number i; r x (x i ) represents the number of image captures x i The sequence number is the sequence number in the order of the number of image shots; y (y i ) represents the sequence number of the image capture number yi, where the sequence number is a sequence number in the order of the size of the image capture number.
[0069] It can be understood that the shooting number vector set includes a plurality of shooting number vectors. One camera device corresponds to one shooting number vector. The shooting number vector set is calculated according to the correlation coefficient algorithm to obtain the similarity between the plurality of camera devices.
[0070] Specifically, according to the correlation coefficient algorithm SCR (X, Y), the similarity between any two shooting number vectors is calculated respectively, and the similarity between any two shooting number vectors can be obtained. Furthermore, according to the similarity between any two shooting number vectors, a similarity matrix between several camera devices is constructed.
[0071] In steps S201 and S202, similarity calculations are performed on any two shooting number vectors in the shooting number vector set according to the correlation coefficient algorithm to obtain the similarity between any two shooting number vectors; based on the similarity, a similarity matrix is generated. The similarity between any two camera devices can be obtained by calculating the formula SCR (X, Y). The obtained similarity matrix takes into account the similarity between several camera devices in different time segments, making the clustering result more accurate.
[0072] Optional, such as Figure 4 As shown, in step S30, clustering the camera devices based on the similarity matrix to obtain the device clustering results corresponding to the camera devices, comprises:
[0073] S301, constructing a clustering matrix according to the similarity matrix;
[0074] S302, calculating the eigenvectors of the clustering matrix, and generating an eigenvector matrix according to the eigenvectors;
[0075] S303 , clustering the camera devices based on the eigenvector matrix to obtain device clustering results corresponding to the camera devices.
[0076] It can be understood that the clustering matrix is a Laplacian matrix. The Laplacian matrix is also called the admittance matrix, Kirchhoff matrix or discrete Laplacian operator. It is mainly used in graph theory as a matrix representation of a graph. First, the data needs to be converted into a graph, that is, all the data is regarded as points in space, and the points are connected by edges. The weight value of the edge between two points that are far away is lower, and the weight value of the edge between two points that are closer is higher. By cutting the graph composed of all data points, the sum of the edge weights between different subgraphs after cutting is as low as possible, and the sum of the edge weights within the subgraph is as high as possible, so as to achieve the purpose of clustering.
[0077] It can be understood that the Laplacian matrix is a semi-positive matrix. The number of times 0 appears in the eigenvalue is the number of connected regions of the graph. The minimum eigenvalue is 0 because the sum of each row of the Laplacian matrix is 0.
[0078] In one embodiment, Figure 5 As shown, step S301 of constructing a clustering matrix according to the similarity matrix may include:
[0079] S3011. According to the similarity matrix, construct an adjacency matrix and a degree matrix corresponding to the similarity matrix;
[0080] S3012. Construct a Laplacian matrix according to the adjacency matrix and the degree matrix;
[0081] S3013. Standardize the Laplace matrix to generate a clustering matrix.
[0082] It can be understood that the adjacency matrix and degree matrix can be obtained by the similarity matrix of the sample point distance measurement. The method of constructing the adjacency matrix includes but is not limited to the full connection method. The full connection method selects different kernel functions to define the edge weights. For example, the kernel function is the Gaussian kernel function RBF. The degree matrix is a diagonal matrix, and only the main diagonal has values, corresponding to the degree of the i-th point in the i-th row.
[0083] Specifically, after obtaining the adjacency matrix and the degree matrix, the adjacency matrix and the degree matrix corresponding to the similarity matrix are calculated according to formula L to obtain the Laplace matrix L.
[0084] L=DW
[0085] Where D is the degree matrix, D is a diagonal matrix with all off-diagonal elements being 0. W is the adjacency matrix. After obtaining the Laplace matrix L, according to the formula L sym =D-1 / 2LD-1 / 2, where D is the degree matrix and L is the Laplace matrix. The Laplace matrix L is standardized to obtain the standardized standard Laplace matrix L sym . Standardizing the Laplace matrix L is to standardize the elements in L so that the dimensions of different elements are normalized. For example, when the size of the edges between sample points in different subsets may vary greatly, this standard operation can normalize the elements in L to between [-1,1], so that the dimensions are consistent, which greatly improves the algorithm iteration speed and the accuracy of the results.
[0086] For example, the degree matrix is:
[0087]
[0088] The adjacency matrix is:
[0089]
[0090] Then the Laplace matrix is:
[0091]
[0092] In steps S3011-S3014, an adjacency matrix and a degree matrix corresponding to the similarity matrix are constructed according to the similarity matrix; a Laplace matrix is constructed according to the adjacency matrix and the degree matrix; and the Laplace matrix is normalized to generate a clustering matrix. Among them, the Laplace matrix is normalized so that the dimensions of different elements are normalized. For example, when the size of the edges between sample points may vary greatly for different subsets, this standard operation can normalize the elements in L between [-1,1], so that the dimensions are consistent, which can improve the algorithm iteration speed and accuracy.
[0093] After obtaining the clustering matrix, according to the calculation formula L = λE (L is the clustering matrix, E is a diagonal matrix and all diagonal elements are 1), the K minimum eigenvalues λ of the clustering matrix L can be calculated, and then according to the linear equation LV = λEV, V is solved to obtain the solution of V corresponding to the minimum eigenvalue λ, that is, the eigenvector f corresponding to the minimum eigenvalue λ. One minimum eigenvalue λ corresponds to one eigenvector f. The eigenvector matrix F is constructed according to the eigenvectors f corresponding to the K minimum eigenvalues λ. Among them, the eigenvector matrix F is a K*n-dimensional matrix, and n is the number of camera devices.
[0094] In one example, when K is 2 (i.e., there are two minimum eigenvalues λ1 and λ2), and n is 6, two eigenvectors f are obtained. If the two eigenvectors f1 and f2 are respectively:
[0095]
[0096] Then we can get the eigenvector matrix F:
[0097]
[0098] In steps S301-S303, the present invention constructs a feature vector matrix based on the similarity matrix, performs dimensionality reduction processing on the data, can more effectively process the clustering of high-dimensional data, and improve data processing efficiency.
[0099] Optional, such as Figure 6 As shown, after step S30 of inputting the feature vector matrix into the device clustering model and obtaining the device clustering result output by the device clustering model, the method includes:
[0100] S304, obtaining scene setting information corresponding to each device clustering cluster included in the device clustering result;
[0101] S305: Add scene tags to the camera devices in each device cluster according to the scene setting information.
[0102] It is understandable that the scene setting information is the scene information input by the operator according to the device clustering result. The scene setting information refers to the information of the application scene corresponding to the camera device. For example, the scene setting information may include application scenes such as restaurants, hotels, parking lots, cafes, bars, stadiums, parks, libraries, shopping malls (stores), waiting rooms, waiting rooms and public transportation. For example, the clustering result contains 6 device clustering clusters, and the scene setting information of the 6 device clustering clusters is (restaurant, hotel, parking lot, cafe, bar, stadium). The device clustering cluster refers to the category contained in the device clustering result. The scene setting information of the device clustering result is obtained, and according to the scene setting information, a scene label is added to the camera device corresponding to the shooting number vector. For example, the clustering result of the shooting number vector corresponding to the camera device d1 is category a, and the scene setting information of category a is parking lot, then the camera device d1 corresponding to the shooting number vector is added with a scene label, and the scene label is "parking lot".
[0103] In steps S304 and S305, corresponding scene labels are added to the camera devices according to the scene setting information of the clustering results, thereby facilitating corresponding data analysis based on the scene labels corresponding to the camera devices. For example, when investigating cases and screening suspects, surveillance images of a certain type of application scenario can be centrally screened based on the scene labels of the camera devices, thereby speeding up the screening efficiency and saving human resources.
[0104] In one embodiment, reference Figure 7 After performing clustering processing on the camera devices based on the similarity matrix to obtain the device clustering results corresponding to the camera devices in step S30, the method further includes:
[0105] S306, obtaining a shooting number vector corresponding to the camera device to be classified;
[0106] S307, for each device clustering cluster included in the device clustering result, respectively calculate the average vector of the number of shots corresponding to the camera devices in each device clustering cluster as the average vector of the number of shots corresponding to each device clustering cluster;
[0107] S308 : Determine the scene label to which the camera device to be classified belongs based on the shooting number vector corresponding to the camera device to be classified and the shooting number average vector corresponding to each device cluster.
[0108] It can be understood that the device cluster refers to the category of device clustering, and each category includes the shooting number vectors of several camera devices. According to the shooting number vectors of several camera devices, the average vector corresponding to the shooting number vector of each category can be calculated.
[0109] Specifically, the shooting number vector corresponding to the camera device to be classified is obtained, and based on the shooting number vector of the camera device of each device clustering cluster in the clustering result, the average vector corresponding to the shooting number vector of each device clustering cluster is calculated respectively, and the average vector corresponding to the shooting number vector of each device clustering cluster is used as the shooting number average vector corresponding to each device clustering cluster. Then, based on the shooting number vector corresponding to the camera device to be classified and the shooting number average vector corresponding to each device clustering cluster, the similarity between the two is determined, and the device clustering cluster corresponding to the maximum similarity is used as the device clustering cluster with the highest matching degree of the camera device to be classified, and the scene label corresponding to the device clustering cluster is used as the label of the camera device to be classified.
[0110] In steps S306-S308, based on the shooting number vector corresponding to the camera device to be classified and the shooting number average vector corresponding to each device cluster, the scene label to which the camera device to be classified belongs is determined. Since the shooting number average vector takes into account the shooting number vectors corresponding to all camera devices in the device cluster, the scene label of the camera device to be classified can be made more accurate, thereby improving the classification accuracy of the camera device to be classified.
[0111] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0112] In one embodiment, a device clustering apparatus is provided, and the device clustering apparatus corresponds one-to-one to the device clustering method in the above embodiment. Figure 8 As shown, the device clustering apparatus includes a shooting vector set module 10, a similarity matrix module 20, and a device clustering result module 30. The functional modules are described in detail as follows:
[0113] A shooting vector set module 10 is used to obtain a shooting vector set, wherein the shooting vector set includes shooting vectors corresponding to each camera device to be clustered, and the shooting vectors are generated based on shooting data of the camera device within a preset time period;
[0114] A similarity matrix module 20 is used to calculate the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix;
[0115] The device clustering result module 30 is used to perform clustering processing on the camera devices based on the similarity matrix, and obtain the device clustering results corresponding to the camera devices for obtaining a set of shooting number vectors; the set of shooting number vectors includes multiple shooting number vectors;
[0116] Optionally, the device clustering result module 30 includes:
[0117] A clustering matrix unit, used for constructing a clustering matrix according to the similarity matrix;
[0118] An eigenvector matrix unit, used to calculate the eigenvectors of the clustering matrix and generate an eigenvector matrix according to the eigenvectors;
[0119] A clustering processing unit is used to perform clustering processing on the camera devices based on the feature vector matrix to obtain device clustering results corresponding to the camera devices.
[0120] Optionally, the shooting data vector collection module 10 includes:
[0121] A shooting data unit, used to obtain shooting data of each camera device to be clustered within a preset time period;
[0122] A time division unit, used to divide the preset time period into a plurality of time segments according to preset intervals;
[0123] An image capture number unit, used to determine the number of images captured by the camera device within the multiple time segments according to the capture data;
[0124] The shooting number vector unit is used to sort the number of images shot by the camera device in the multiple time segments in chronological order from front to back, and generate a shooting number vector corresponding to the camera device.
[0125] Optionally, the similarity matrix module 20 includes:
[0126] A similarity unit, used to calculate the similarity of any two shooting number vectors in the shooting number vector set according to a correlation coefficient algorithm, so as to obtain the similarity between any two shooting number vectors;
[0127] A similarity matrix unit, used to generate the similarity matrix based on the similarity
[0128] Optionally, the device clustering result module 30 includes:
[0129] A similarity matrix processing unit, used to construct an adjacency matrix and a degree matrix corresponding to the similarity matrix according to the similarity matrix;
[0130] A Laplace matrix unit, configured to construct a Laplace matrix according to the adjacency matrix and the degree matrix;
[0131] The clustering matrix unit is used to perform standardization processing on the Laplace matrix to generate a clustering matrix.
[0132] Optionally, after the device clustering result module 30, the following steps are included:
[0133] A scene setting information module, used to obtain scene setting information corresponding to each device clustering cluster included in the device clustering result;
[0134] The scene label module is used to add scene labels to the camera devices in each device cluster according to the scene setting information.
[0135] Optionally, after the device clustering result module 30, the following further includes:
[0136] A shooting number vector acquisition unit, used to acquire the shooting number vector corresponding to the camera device to be classified;
[0137] An average vector unit, used to calculate an average vector of the number of shots vectors corresponding to the camera devices in the device clustering cluster as the average vector of the number of shots corresponding to each device clustering cluster;
[0138] The scene label determination unit is used to determine the scene label to which the camera device to be classified belongs based on the shooting number vector corresponding to the camera device to be classified and the shooting number average vector corresponding to each device cluster.
[0139] For the specific definition of the device clustering device, please refer to the definition of the device clustering method above, which will not be repeated here. Each module in the above-mentioned device clustering device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0140] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The readable storage medium stores an operating system, computer-readable instructions and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The database of the computer device is used to store data involved in the device clustering method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a device clustering method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0141] In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor executes the computer-readable instructions to implement the following steps:
[0142] Acquire a set of shooting number vectors, where the set of shooting number vectors includes shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on shooting data of the camera device within a preset time period;
[0143] Calculating the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix;
[0144] The camera devices are clustered based on the similarity matrix to obtain device clustering results corresponding to the camera devices.
[0145] In one embodiment, one or more computer-readable storage media storing computer-readable instructions are provided. The readable storage media provided in this embodiment include non-volatile readable storage media and volatile readable storage media. The readable storage media store computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the following steps are implemented:
[0146] Acquire a set of shooting number vectors, where the set of shooting number vectors includes shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on shooting data of the camera device within a preset time period;
[0147] Performing similarity calculation on any two shooting number vectors in the shooting number vector set to generate a similarity matrix;
[0148] The camera devices are clustered based on the similarity matrix to obtain device clustering results corresponding to the camera devices.
[0149] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0150] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0151] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A device clustering method, characterized in that: include: Acquire a set of shooting number vectors, where the set of shooting number vectors includes shooting number vectors corresponding to each camera device to be clustered, and the shooting number vectors are generated based on shooting data of the camera device within a preset time period; Calculating the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix; Performing clustering processing on the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices; Obtaining shooting data of each camera device to be clustered within a preset time period; Dividing the preset time period into a plurality of time segments according to preset intervals; Determining the number of images captured by the camera device within the plurality of time segments according to the captured data; The number of images captured by the camera device in the multiple time segments is sorted in chronological order from front to back, and a capture number vector corresponding to the camera device is generated.
2. The device clustering method according to claim 1, characterized in that: The similarity calculation is performed on any two shooting number vectors in the shooting number vector set to generate a similarity matrix, including: Calculating the similarity of any two shooting number vectors in the shooting number vector set to obtain the similarity between any two shooting number vectors; Based on the similarities, the similarity matrix is generated.
3. The device clustering method according to claim 1, characterized in that: The clustering process is performed on the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices, including: Constructing a clustering matrix according to the similarity matrix; Calculating the eigenvectors of the clustering matrix, and generating an eigenvector matrix according to the eigenvectors; Clustering processing is performed on the camera devices based on the eigenvector matrix to obtain device clustering results corresponding to the camera devices.
4. The device clustering method according to claim 3, characterized in that: The step of constructing a clustering matrix according to the similarity matrix comprises: According to the similarity matrix, construct an adjacency matrix and a degree matrix corresponding to the similarity matrix; constructing a Laplacian matrix according to the adjacency matrix and the degree matrix; The Laplace matrix is normalized to generate a clustering matrix.
5. The device clustering method according to claim 1, characterized in that: After clustering the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices, the method includes: Acquire scene setting information corresponding to each device clustering cluster included in the device clustering result; According to the scene setting information, scene tags are added to the camera devices in each device cluster.
6. The device clustering method according to claim 1, characterized in that: After clustering the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices, the method further includes: Obtain the shooting number vector corresponding to the camera device to be classified; For each device clustering cluster included in the device clustering result, respectively calculate the average vector of the number of shots corresponding to the camera devices in each device clustering cluster as the average vector of the number of shots corresponding to each device clustering cluster; Based on the shooting number vector corresponding to the camera device to be classified and the shooting number average vector corresponding to each device cluster, the scene label to which the camera device to be classified belongs is determined.
7. A device clustering device, characterized in that: include: A shooting vector set module, used to obtain a shooting vector set, wherein the shooting vector set includes shooting vectors corresponding to each camera device to be clustered, and the shooting vectors are generated based on shooting data of the camera device within a preset time period; A similarity matrix module is used to calculate the similarity of any two shooting number vectors in the shooting number vector set to generate a similarity matrix; A device clustering result module, used for performing clustering processing on the camera devices based on the similarity matrix to obtain device clustering results corresponding to the camera devices; The shooting number vector set module includes: A shooting data unit, used to obtain shooting data of each camera device to be clustered within a preset time period; A time division unit, used to divide the preset time period into a plurality of time segments according to preset intervals; An image capture number unit, used to determine the number of images captured by the camera device within the multiple time segments according to the capture data; The shooting number vector unit is used to sort the number of images shot by the camera device in the multiple time segments in chronological order from front to back, and generate a shooting number vector corresponding to the camera device.
8. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the device clustering method according to any one of claims 1 to 6 is implemented.
9. One or more readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the device clustering method according to any one of claims 1 to 6.
