Camera Intelligent Layout Method for Building Digital Twin Construction

The layout of surveillance cameras is optimized through the MAPPO algorithm, which solves the coverage and layout problems in the building interior, achieves more efficient monitoring coverage, and supports the intelligent layout of building digital twins.

CN118965638BActive Publication Date: 2025-07-22BEIJING UNIV OF CIVIL ENG & ARCHITECTURE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410934420.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2025-07-22
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

The layout of surveillance cameras in the building interior faces the problem of NP-hard combination optimization, making it difficult to maximize coverage under a limited budget and adapt to complex scenarios and changing environments.

Method used

The MAPPO algorithm is used to optimize the layout of the surveillance camera. By obtaining obstacle areas and surveillance areas, a camera model is built, and the state space, action space and reward functions of the agent are designed in the Actor and Critic networks, and the final layout plan is iteratively updated.

Benefits of technology

It significantly improves the coverage of surveillance cameras, optimizes the layout of the cameras, and provides more efficient machine vision support for the construction of building digital twins.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118965638B_ABST
    Figure CN118965638B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of building digital twin technology, and particularly to an intelligent camera layout method for building digital twin construction, including: obtaining the scene to be laid out; preprocessing the scene to be laid out to obtain the obstacle area and the monitorable area; obtaining a preliminary layout plan for the camera through the obstacle area and the monitorable area, optimizing the preliminary layout plan based on the MAPPO algorithm to obtain the final layout plan; and completing the camera layout in the scene to be laid out based on the final layout plan. The present invention analyzes and adjusts the specific position and angle of the camera based on the MAPPO algorithm, optimizes the layout of the surveillance cameras, and significantly improves the coverage rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of building digital twins, and particularly to an intelligent camera layout method for building digital twin construction. Background Art

[0002] Digital Twin (DT) construction integrates new-generation information technology and digital construction technology, meeting the need for interactive integration between digital models and physical construction, and is an important driving force for promoting the intelligentization of the construction industry. DT integrates other emerging technologies such as machine learning, artificial intelligence (AI), and data analysis to help make more informed decisions in the operation and maintenance of buildings and other facilities. Previous research in the construction field has established the ability of DT to enhance the management of buildings and other building environment facilities. Building Digital Twin (BDT) has become a key technology for improving building operation efficiency and management quality.

[0003] Surveillance cameras are an essential part of realizing building intelligentization. They not only provide necessary visual data for security monitoring but also lay the foundation for constructing digital twins of building interiors, promoting the transformation from BIM to BDT. Nevertheless, the effective layout of surveillance cameras faces multiple challenges, including maximizing coverage under a limited budget, meeting the monitoring requirements of complex scenarios, and adapting to changing environmental conditions. The problem of surveillance camera layout is essentially an NP-hard combinatorial optimization problem, involving numerous constraints and requirements such as the diversity of monitoring tasks, the physical and technical limitations of cameras, and the structural characteristics of specific scene areas. These factors make it extremely difficult to use traditional simple enumeration or search techniques to determine the optimal layout plan of cameras. How to place surveillance cameras in appropriate positions to obtain the largest monitoring coverage area under the most economical conditions is a challenging problem. Summary of the Invention

[0004] The purpose of the present invention is to provide an intelligent camera layout method for building digital twin construction, which optimizes the layout of surveillance cameras in building interiors through the MAPPO algorithm.

[0005] To achieve the above purpose, the present invention provides the following solutions:

[0006] An intelligent camera layout method for building digital twin construction, including:

[0007] Obtain the scene to be laid out;

[0008] Preprocess the scene to be laid out to obtain the obstacle area and the monitorable area;

[0009] Obtain a preliminary camera layout plan based on the obstacle area and the monitorable area, and optimize the preliminary layout plan based on the MAPPO algorithm to obtain the final layout plan;

[0010] Complete the camera layout in the scene to be laid out based on the final layout plan.

[0011] Optionally, the preprocessing of the scene to be laid out includes:

[0012] Preset the grid scale and threshold, divide the scene to be laid out using the grid to obtain a grid map;

[0013] Mark and encode the grids where obstacles are located in the grid map to obtain the obstacle area and the monitorable area.

[0014] Optionally, the calculation method of the obstacle area is:

[0015]

[0016] where Occ i,j is the occupancy rate of the obstacle in each grid (i,j) of the grid map, S B (i,j) is the occupancy situation of the obstacle in each grid, S i,j is the size of each grid, Th is the preset proportion of the obstacle in each grid, 0 indicates considering the grid as a non-obstacle area, and 1 indicates considering the grid as an obstacle area.

[0017] Optionally, obtaining a preliminary camera layout plan based on the obstacle area and the monitorable area includes:

[0018] Construct a camera model;

[0019] Based on the camera model, conduct a preliminary camera layout in the monitorable area to obtain the preliminary layout plan, where the preliminary layout plan includes the camera layout position, angle, and quantity.

[0020] Optionally, the camera model is:

[0021]

[0022] where Z C is the coordinate value of each boundary point of the camera's visible range on the Z-axis in the camera coordinate system. The coordinate values of each boundary point of the camera's visible range are (x1,y1), (x2,y2), (x3,y3), (x4,y4) respectively; A is the internal parameter matrix of the camera; M is the external parameter matrix of the camera, which is jointly defined by the matrices R and T, R is the rotation matrix of the camera, and T is the translation matrix of the camera; u and v are the length and width of the internal image sensor of the camera respectively.

[0023] Optionally, optimize the preliminary layout plan based on the MAPPO algorithm to obtain the final layout plan, including:

[0024] Regarding the camera as an agent, design the state space, action space, and reward function of the agent;

[0025] In the Actor network, define the policy network and policy network objective function of the agent;

[0026] In the Critic network, define the value network and value network objective function of the agent;

[0027] Under the constraints of the policy network, value network, state space, and action space, with the reward function, policy network objective function, and value network objective function as the optimization objectives, iteratively update the state and actions of the agent to obtain the final layout plan.

[0028] Optionally, the state space is:

[0029] S = [s1, s2, s3, …, s i

[0030] where S is the state space and s i is the state of agent i;

[0031] The action space includes: moving, rotating, and quantity adjustment;

[0032] The reward function is:

[0033] R = ∑(R NewCov + R ove + R bli + R All_cov ) + R edge + R num

[0034] where R is the reward function, R NewCov is the new coverage reward, R All_cov is the all-coverage completion reward, R ove is the field of view overlap reward, R bli is the blind spot reward, R edge is the grid map area boundary reward, R num is the camera quantity increase reward.

[0035] Optionally, the policy network is The policy network objective function is:

[0036]

[0037] ​Among them, a is the action taken by the agent in state s, θ is the parameter of the policy network, is the expectation, is the advantage function, indicating that the action a is taken t in state s t and the expected return gain relative to the average, clip(r t (θ), 1 - ε, 1 + ε) is the policy update amplitude, and ε is a constant; is the policy ratio, and θ old is the parameter of the previous policy network.

[0038] Optionally, the value network is The objective function of the value network is:

[0039]

[0040] Among them, V t target is the target value function.

[0041] The beneficial effects of the present invention are:

[0042] Based on the MAPPO algorithm, the present invention analyzes and adjusts the specific position and angle of the camera, optimizes the layout of the monitoring cameras, significantly improves the coverage rate, and provides a new idea for the intelligent arrangement of cameras in the research of constructing BDT through machine vision. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0044] Figure 1 is the flowchart of the intelligent camera arrangement method for building digital twin construction according to the embodiment of the present invention;

[0045] Figure 2 is the installation method diagram of common cameras according to the embodiment of the present invention;

[0046] Figure 3 is the coverage of the field of view of the monitoring camera in the grid map according to the embodiment of the present invention;

[0047] Figure 4 is the situation of obstacles in the field of view of the camera in the grid map according to the embodiment of the present invention;

[0048] Figure 5This is the situation where the monitoring coverage areas of two cameras overlap in the grid map of the embodiment of the present invention;

[0049] Figure 6 This is the second - floor plan of Building D of a certain college in the embodiment of the present invention;

[0050] Figure 7 This is the position, orientation, and coverage of the original monitoring cameras on the second floor of Building D of a certain college in the embodiment of the present invention;

[0051] Figure 8 This is the error change trend during the training process of the monitoring camera layout network using the MAPPO algorithm in the embodiment of the present invention;

[0052] Figure 9 This is the change trend of the average return reward per episode during the training process of the monitoring camera layout network using the MAPPO algorithm in the embodiment of the present invention;

[0053] Figure 10 This is the coverage of the optimized cameras in the grid map in the embodiment of the present invention. Detailed implementation manners

[0054] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0055] To make the above - mentioned objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0056] This embodiment provides a camera intelligent layout method for building digital twin construction, including:

[0057] Obtain the scene to be laid out;

[0058] Pre - process the scene to be laid out to obtain the obstacle area and the monitorable area;

[0059] Obtain a preliminary layout plan for the cameras through the obstacle area and the monitorable area, and optimize the preliminary layout plan based on the MAPPO algorithm to obtain the final layout plan;

[0060] Complete the camera layout in the scene to be laid out based on the final layout plan.

[0061] Furthermore, the pre - processing of the scene to be laid out includes:

[0062] Preset the grille scale and threshold, use the grille to divide the to-be-arranged scene, and obtain the grille map;

[0063] Mark and encode the grilles where obstacles are located in the grille map to obtain the obstacle area and the monitorable area.

[0064] Specifically, the calculation method of the obstacle area is as follows:

[0065]

[0066] Among them, Occ i,j is the occupancy rate of the obstacle in each grille (i,j) of the grille map, S B (i,j) is the occupancy situation of the obstacle in each grille, S i,j is the size of each grid, Th is the preset proportion of the obstacle in each grid, 0 indicates that the grid is considered as a non-obstacle area, and 1 indicates that the grid is considered as an obstacle area.

[0067] Furthermore, obtaining the preliminary camera arrangement plan through the obstacle area and the monitorable area includes:

[0068] Construct a camera model;

[0069] Based on the camera model, conduct a preliminary camera arrangement in the monitorable area to obtain the preliminary arrangement plan, where the preliminary arrangement plan includes the camera arrangement position, angle, and quantity.

[0070] Specifically, the camera model is:

[0071]

[0072] Among them, Z C is the coordinate value of each boundary point of the camera's visible range on the Z-axis in the camera coordinate system. The coordinate values of each boundary point of the camera's visible range are (x1,y1), (x2,y2), (x3,y3), and (x4,y4) respectively; A is the internal parameter matrix of the camera; M is the external parameter matrix of the camera, which is jointly defined by the matrix R and T. R is the rotation matrix of the camera, and T is the translation matrix of the camera; u and v are the length and width of the internal image sensor of the camera respectively.

[0073] Furthermore, optimizing the preliminary arrangement plan based on the MAPPO algorithm to obtain the final arrangement plan includes:

[0074] Regarding the camera as an intelligent agent, design the state space, action space, and reward function of the intelligent agent;

[0075] In the Actor network, define the policy network and the policy network objective function of the intelligent agent;

[0076] In the Critic network, define the value network and the value network objective function of the agent;

[0077] Under the constraints of the policy network, value network, state space, and action space, taking the reward function, policy network objective function, and value network objective function as optimization objectives, iteratively update the state and action of the agent to obtain the final layout plan.

[0078] Specifically, the state space is:

[0079] S = [s1, s2, s3, …, s i

[0080] where S is the state space and s i is the state of agent i;

[0081] The action space includes: moving, rotating, and quantity adjustment;

[0082] The reward function is:

[0083] R = ∑(R NewCov + R ove + R bli + R All_cov ) + R edge + R num

[0084] where R is the reward function, R NewCov is the new coverage reward, R All_cov is the all-coverage completion reward, R ove is the field of view overlap reward, R bli is the blind spot reward, R edge is the grid map area boundary reward, R num is the camera quantity increase reward.

[0085] The policy network is The policy network objective function is:

[0086]

[0087] where a is the action taken by the agent in state s, θ is the parameter of the policy network, is the expectation, is the advantage function, indicating the expected return gain of taking action a t in state s t relative to the average, clip(r t (θ), 1 - ε, 1 + ε) is the policy update amplitude, and ε is a constant; is the policy ratio, θ​old are the parameters of the previous time of the policy network.

[0088] The value network is The objective function of the value network is:

[0089]

[0090] where V t target is the target value function.

[0091] Next, in combination with Figures 1 - 5 the camera intelligent layout method provided in this embodiment for building digital twins of buildings will be described in detail, which specifically includes the following steps:

[0092] Step 1, construct a monitoring model;

[0093] First, model the monitoring camera. For common cameras, their installation methods are as Figure 2 shown. Among them, the length and width of the internal image sensor of the camera are u and v respectively, and the focal length of the camera is f. The external parameters of the camera are represented by R and T, which define the real position of the camera. R is the rotation matrix of the camera, which is determined by the rotation angles of the camera in the real world, and are respectively the yaw angle, pitch angle, and roll angle of the camera corresponding to the θ and ψ angles in the figure. θ, ψ angles corresponding to the yaw, pitch, and roll angles of the camera.

[0094]

[0095]

[0096]

[0097] The camera rotation matrix is R = R z (φ)·R y (θ)·R x (ψ).

[0098] In this embodiment, digital twins are only constructed for objects located on the ground, so the visible range of the monitoring camera must be on the ground, that is, for any monitoring camera, its pitch angle θ is 90 degrees. For an object Q(X w , Y w , Z w ) existing in the physical world, the conversion relationship between its position coordinates and the coordinates on the pixel plane of the monitoring camera is as follows:

[0099]

[0100] The plane P is the imaging plane of the camera, and the plane ABCD is the projection of the imaging plane of the surveillance camera on the real-world ground. This area is also the visual field or visible range of the surveillance camera. That is to say, when the object Q can be captured by the surveillance camera, its position satisfies Q ∈ ABCD. The coordinates of the boundary points of the visible range of the camera in the figure are A(x1, y1), B(x2, y2), C(x3, y3), and D(x4, y4) respectively, satisfying the following formula:

[0101]

[0102] That is:

[0103]

[0104] Among them, Z C are the coordinate values of each boundary point on the Z-axis in the camera coordinate system respectively. The matrix A is the internal parameter matrix of the surveillance camera, which is determined by the camera's own parameters. M is the external parameter matrix of the camera, which is jointly defined by the matrices R and T. The R matrix is a 3×3 matrix, and the T matrix is a 3×1 matrix. They represent the rotation and translation matrices of the camera respectively, which are the configurations of the surveillance camera and determine the position of the camera in the physical world.

[0105] Step 2: Preprocessing of the area to be arranged;

[0106] Before constructing the digital twin indoor area, preprocessing is required to establish the area model of the surveillance camera to be arranged. To improve the calculation efficiency, rasterization processing is used to simplify the complex indoor environment, and the area is divided into independent grids of fixed size. The coverage requirements of the surveillance camera are determined by analyzing the obstacle situation of each grid.

[0107] The grid is used to divide the indoor scene space of the building, and the grids are divided into two situations: free area and obstacle area with contrasting colors. At the same time, the divided grids are encoded to construct a grid map model to preprocess the area where the surveillance camera is to be arranged. The obstacle area is the part of the obstacles stacked in the indoor scene shown in the grid map after dilation or erosion processing. The black grid indicates that there are obstacles in this area, and the white grid indicates that this area is not occupied by objects.

[0108] In the rasterization of indoor scenes, it is crucial to select appropriate raster scales and obstacle occupancy thresholds. If the raster scale is too small, although the scene fitting degree is high, it will result in an excessive number of rasters, thus consuming a large amount of computing resources. On the contrary, if the raster scale is too large, the fitting result will be too rough. By setting a suitable obstacle occupancy threshold, the obstacle area and non-obstacle area can be accurately distinguished, and different threshold settings will also affect the final display of the raster map. Therefore, when constructing a building digital twin and preprocessing the monitoring camera area, reasonably setting the raster scale and obstacle threshold is the key, which will directly affect the practicality and efficiency of the raster map.

[0109] Assume that the area range is L×H, and the scale of the raster is set to S. Then the number of rasters obtained after processing is NumX×NumY, that is:

[0110]

[0111] The occupancy rate of the obstacle B in each raster (i,j) of the regional raster map is Occ i,j , S B (i,j) is the occupancy situation of the obstacle in each raster, S i,j is the size of each raster:

[0112]

[0113] Assume that the proportion of the obstacle in the raster is Th, and each raster is encoded to represent the raster situation. 0 means considering the raster as a non-obstacle area, and 1 means considering the raster as an area with an obstacle.

[0114] The raster scale and obstacle threshold are determined by the results after rasterization under different scale and threshold settings. First, the influence of the scale size on the raster map is carried out. For the convenience of statistics, the threshold Th is temporarily set to a large value, Th = 0.1. Table 1 shows the total number of rasters (Count_Grid), the number of black rasters (Dark_Grid), the number of white rasters (Pale_Grid), and the proportion (Ratio) of the number of black rasters in the total number of rasters under different scale S conditions. Table 2 shows the number of each grid, the total number of grids, and the proportion under different threshold Th conditions.

[0115] Table 1

[0116]

[0117]

[0118] Table 2

[0119]

[0120] According to the data analysis in Table 1, as the scale S increases, the proportion of black grids begins to rise. When this proportion stabilizes, the grid map can better reflect the real scene. Considering both computational efficiency and cost, a relatively large scale S = 60 when the proportion of black grids stabilizes is selected as the most appropriate grid scale.

[0121] Similarly, by comparing different thresholds Th at the same scale S = 60 in Table 2, it is found that when the threshold Th is relatively small, the number of black grids increases and the proportion increases. When the threshold is greater than 0.55, this proportion changes little. Therefore, in this embodiment, Th = 0.55 is selected as the optimal threshold for constructing the grid map to reflect the obstacles in the real scene.

[0122] Step 3: Representation method for the coverage area of the monitoring camera;

[0123] The calculation of the camera's field of view coverage is crucial for the analysis results. For a point in the scene to be captured by the camera, the point must be imaged within the camera's field of view and there must be no obstacle occlusion on the path.

[0124] After rasterizing the indoor scene using the preprocessing model, a grid map is obtained, and the coverage area of the camera is quantitatively represented by the area of independent grids. Figure 3 Shows the coverage of the monitoring camera's field of view in the grid map, where K(X K , Y K ) is the projection position of the monitoring camera Cam on the ground, Dir_1 and Dir_2 are the two intersection points of the main shooting direction and the field of view of the monitoring camera, θ is the camera's viewing angle, and i is a point on the ground.

[0125] The distance between point i and Cam or any point within the area is represented by D. Then, the following relationship exists for the angle between point i and the projection point K of the camera and the point Dir on the main direction:

[0126]

[0127] If point i is within the coverage area of the camera's field of view, this relationship is represented in binary form by the following formula. 1 indicates that the area is within the coverage area of the camera's field of view, and 0 indicates that it is not.

[0128]

[0129] In this embodiment, the relationship between the obstacle boundary and the camera's field of view and their angles are analyzed for quantitative representation. Figure 4 Shows the situation of obstacles within the camera's field of view in the grid map, where e and f are the obstacle boundary points at the edge of the field of view, and i is a ground point that may be behind the obstacle. The angle between point i and the projection point K of the camera and the point Dir on the main direction is Ang i,K,Dir, the included angles between points e, f and point K and point i are Ang e,K,i and Ang f,K,i . Therefore, if there is an obstacle between point i in the area and the camera, the grid where point i is located satisfies the following relationship. 1 indicates that the area represented by this part of the grid is blocked by an obstacle in the real world, and 0 indicates that it is not blocked.

[0130]

[0131] When arranging cameras, there may also be a situation where the monitoring coverage areas of two cameras overlap, as Figure 5 shown. Point i is located in the overlapping space of the coverage areas of two cameras. In the figure, K_1(X K1 , Y K1 ), K_2(X K2 , Y K2 ) are the projection positions of monitoring cameras Cam_1 and Cam_2 on the ground. Dir is any point in the main shooting direction of each monitoring camera, and θ is the viewing angle of the camera.

[0132] For this situation, the following method is used for representation:

[0133]

[0134] Step 4, Optimization of camera arrangement based on the MAPPO algorithm;

[0135] When deploying many monitoring cameras with multiple degrees of freedom in an indoor scene, it is more appropriate to use a high-dimensional multi-agent optimization algorithm. Compared with a single-agent optimization algorithm, a multi-agent system not only needs to cope with environmental changes but also consider the influence of the behaviors of other agents. Agents making decisions based on limited environmental information will change the environmental state, which may make the old decisions invalid and cause non-steady-state problems in training.

[0136] In a multi-agent task, each agent makes decisions based on its local environmental information. This mode is defined as a decentralized partially observable Markov decision process (DEC-POMDP). Under the framework, the DEC-POMDP model is defined as (S, A, O, R, P, n, γ). Among them, S represents the environmental state, that is, the state space of the global environment. A represents the joint action space of all agents, and the actions of each agent are included in it, that is, A = (a 1 , a 2 , a 3 , …, a n ). O represents the joint observation value of the agents. O n is the local observation of agent n in the global state s, that is, O = (o 1 , o 2 , o 3,…,o n )。R(s, A) is the reward function shared by all agents. P(s′|s, A) describes the probability that the state space of the global environment transfers from S to S′ after the agents execute the joint action A. n represents the number of agents in the environment. γ is the discount factor of the reward. The joint policy of the agents is represented as Π = (π 1 , π 2 , π 3 , …, π n ), and each agent usually adopts the same policy π θ (a i |o i ).

[0137] Step 4.1. Design of the state space, action space, and reward function;

[0138] In this embodiment, based on the actual installation requirements of the monitoring network, all monitoring cameras adopt the same specifications and are adjusted to the optimal pitch angle to ensure the consistency of the pitch angle. In addition, considering the indoor construction and cost requirements, all cameras are installed at the same horizontal height. In this way, the field of view area of each camera remains consistent without occlusion, and the position and orientation (yaw angle) of each camera are mainly considered during the optimization process.

[0139] State space S: In reinforcement learning, the design of the state space is crucial, and it jointly affects the performance of the algorithm with the reward function. In multi-agent optimization, the decision-making of each agent is affected by the joint actions of all agents. Therefore, the state space S should not only include the state of each agent but also the global environment information, so that the agent can make decisions on moving or adjusting the orientation and promote the collaborative optimization among agents. As shown in the following formula:

[0140] S = [s1, s2, s3, …, s i

[0141] For each agent (monitoring camera) i, its state s i at time t can be expressed as shown in the following formula:

[0142]

[0143] Among them, represents the position coordinates of the monitoring camera i on the regional grid map, represents the rotational yaw angle of the monitoring camera i, that is, the orientation of the camera, which determines the direction of the camera's field of view. represents the grid area that the field of view of the monitoring camera i can cover at the rotational angle . ​Describes the situation where the monitoring areas of surveillance cameras overlap with each other. It can be obtained by calculating the intersection of the coverage vector of camera i with the coverage areas of other cameras. represents the occluded areas within the field of view of surveillance camera i.

[0144] Action space A: Each surveillance camera can perform actions such as moving, rotating, and adjusting the quantity. Moving includes staying in place (wait) or moving to an adjacent grid, and moving to an adjacent grid includes up, down, left, and right. The rotation action allows the camera to adjust the yaw angle clockwise (CW) or counterclockwise (CCW). The quantity action involves increasing or decreasing the number of surveillance cameras to meet the optimization requirements.

[0145] Reward function R: For each surveillance camera agent, there will be its own reward, and this reward value depends on the current state, the currently executed action, and the state at the next moment (s, a, s') of each agent. In the scenario of this embodiment, the rewards for the agent include: new coverage reward R NewCov , complete all coverage reward R All_cov , field of view overlap reward (penalty) R ove , blind spot reward (penalty) R bli , map area boundary reward (penalty) R edge , surveillance camera quantity increase reward (penalty) R num . Specifically, the reward for the first covered grid is +2, the penalty for field of view overlap caused by adding a new camera is -1, the penalty for the appearance of a blind spot is -1, the penalty for the camera crossing the boundary is -200, and when the key grid is covered by at least two cameras, the reward value increases by 80. These settings constitute the total reward function R:

[0146] R = ∑(R NewCov + R ove + R bli + R All_cov ) + R edge + R num

[0147] Step 4.2, Layout optimization based on the MAPPO algorithm;

[0148] MAPPO is a multi-agent version based on the PPO algorithm, which enhances training stability by restricting the magnitude of each step of policy update. It keeps the ratio of the new and old policies within the preferred range to avoid large jumps in the policy space. In the Actor network, for each agent i, its policy is defined as where θ represents the parameters of the policy network, and a is the action taken by the agent in state s. In the Critic network, the joint observation (o1 , o 2 , o 3 , …, o n ), and joint actions (a 1 , a 2 , a 3 , …, a n ) as inputs, estimate the evaluation of value realization for the actions, and feedback it to the Actor network to affect the selection of the next action. MAPPO aims to optimize the following objective function:

[0149]

[0150] where θ is the parameter of the policy network, is the expectation, is the advantage function, representing the expected return gain of taking action a t in state s t relative to the average. clip(r t (θ), 1 - ε, 1 + ε) limits the policy update amplitude to prevent the update step from being too large, where ε is a small constant. is the policy ratio, that is, the probability ratio of the current policy to the old policy, and θ old is the parameter of the policy network in the previous time.

[0151] The Critic network estimates the value function of the given state where φ i represents the parameter of the value network. The goal of the value network is to minimize the error of the value function estimation. The objective function of the Critic network can be calculated by the mean square error (MSE), that is:

[0152]

[0153] where, V t target is the target value function, usually approximated by the discounted sum of rewards. The MAPPO algorithm performs the following steps in each iteration: (1) For each agent i, use its policy network to sample actions, execute the actions, and collect experience data (s i , a i , r i , s i '); (2) Calculate the advantage function and the target value function V t target ; (3) Update the parameters of the policy network and the value network, maximizing J(θ) and minimizing L VF (φ i ) respectively. The pseudocode for camera layout optimization based on the MAPPO algorithm is shown in Table 3.

[0154] Table 3

[0155]

[0156]

[0157] Experimental verification was carried out on the method of this embodiment:

[0158] The method for arranging surveillance cameras in this embodiment was verified on a Windows 10 computer equipped with an Intel(R) Core(TM) i5-6300HQ CPU, 16GB of memory, and an NVIDIA GeForce GTX965M graphics card. Through optimization based on the MAPPO algorithm, the camera network coverage of the indoor digital twin area was optimized. The experiment involved mathematical modeling, optimizing the layout plan, and verified the effectiveness of the method by comparing the coverage effects before and after optimization.

[0159] (1) Experimental setup:

[0160] An indoor digital twin model of Building D of a certain university was constructed, especially the second floor as the experimental area. By comparing the arrangement of surveillance cameras before and after the experiment, the effect of the optimization algorithm was verified. The floor plan and spatial dimensions are shown in Figure 6 .

[0161] Cameras of the same model were used, and their internal parameters were calibrated by the Zhang Zhengyou calibration method of a single-eye checkerboard. The parameters are shown in Table 4. Due to actual installation limitations, all cameras were arranged at the same horizontal height, and the roll angle was not considered.

[0162] Table 4

[0163]

[0164] The original arrangement of indoor surveillance cameras on this floor was modeled to obtain the external parameter information of the cameras, and their position coordinates and orientation angles were recorded. The rotation angle φ of the surveillance camera ∈ [0, 2π). The external parameter data is recorded in Table 5.

[0165] Table 5

[0166]

[0167] In the process of training and optimizing using the MAPPO algorithm in this experiment, the task itself is continuous, and conditions need to be set to abort the experimental training process. The initial positions of each surveillance camera agent in the experiment were set as shown in Table 5 respectively, and the specific parameters in the training process of this algorithm are shown in Table 6.

[0168] Table 6

[0169]

[0170] For the obstacle part within the scene area, in this experiment, the composition ratio of the corresponding grids of this part in the grid map is used for description, that is, the composition ratio of obstacle grids, as shown in the following formula:

[0171]

[0172] Among them, S Obs is the obstacle coverage area, S All is the total area, Num Dark_grid is the number of black grids in the grid map, that is, the grids covered by obstacles. Num Count_grid is the total number of grids in the grid map.

[0173] For the monitorable part within the scene area, in this experiment, the number of grids of this part is used to quantify the coverage of the surveillance cameras, and the coverage rate is:

[0174]

[0175] That is:

[0176]

[0177] Among them, S Cov is the monitoring coverage area, S is the monitorable area, S Cam_i is the respective monitoring coverage area of the i-th surveillance camera in the scene, S Ove is the overlapping area of all the fields of view of the surveillance cameras, S Bli is the area of all fields of view blocked by obstacles, Num Pale_grid is the number of gray grids in the grid map.

[0178] There are N surveillance cameras arranged in the scene, and there are a total of K key areas. For each key area, there is C k,Cam_i , indicating the coverage status of the i-th camera for the k-th key area. If C k,Cam_i = 1, it means that this area is covered by this camera; if it is 0, it means it is not covered. The degree of attention for each key area:

[0179]

[0180] Therefore, the average degree of attention for all key areas in the entire scene is:

[0181]

[0182] (2) Experimental results:

[0183] Grid operations are carried out using different grid scales and the proportion threshold of obstacles in the grid. By analyzing the composition ratio of obstacle grids in different situations, the grid parameters most suitable for the experimental area are obtained. It can be seen from the data in Table 7 that when the grid scale reaches 60, the composition ratio of obstacle grids increases significantly. Therefore, a grid scale of 50 is more appropriate for gridifying the area in this experiment.

[0184] Table 7

[0185]

[0186] It can be seen from the data in Table 8 that when the threshold is greater than 0.4, the relative change in the composition ratio is relatively small. Therefore, in the subsequent optimization process of this experiment, grid parameters with a grid scale of 50 and a proportion threshold of 0.4 are used to generate the grid map of the monitoring camera layout area.

[0187] Table 8

[0188]

[0189] According to the optimal grid parameters obtained after the above discussion, a grid map is generated. And the original monitoring camera information and the positions of the entrances and exits in the scene are put in. Figure 7 The positions and orientations of the original monitoring cameras and their coverage are shown. There are 7896 grids in the grid map, and there are 15 positions of all the entrances and exits in the scene, that is, the key areas. The original monitoring layout plan arranges 20 cameras. Through statistical analysis of the coverage, the monitoring areas of the monitoring cameras cover 4099 grids, and the coverage rate is 70.32%. The average attention degree to all key areas is 2.14%. In the original layout plan, the coverage rate of the cameras is average, and some areas cannot be effectively covered. At the same time, the attention degree to the key areas is relatively low. At this time, there are a large number of blind areas in the monitoring system, which cannot meet the requirements of constructing a digital twin of the building interior using the indoor monitoring system.

[0190] Based on the parameter values set in Table 6, the layout of the monitoring cameras is trained and optimized. When training, the maximum number of training rounds is set to 4000, and the maximum number of steps per round is 1000 to explore the optimal layout. Figure 8It is the error change trend during the training process of the monitoring camera layout network using the MAPPO algorithm. As can be seen from Image 8, the error of the monitoring cameras in the scene decreases relatively rapidly in the first 1200 episodes. This may be because at the beginning of the training process, the monitoring cameras have little understanding of the scene environment information and move too randomly in the scene, so there may be too many ineffective movements. In the later rounds of training, the monitoring cameras in the scene can utilize the strategies learned in the previous rounds and basically move in a relatively successful movement manner. At this time, the policy error in the network changes little and shows a relatively stable oscillation trend, which proves the rationality of the policy setting of this method.

[0191] The reinforcement learning return reward value is an important indicator for evaluating the training strategy. Figure 9 It is the change trend of the average return reward per episode during the training process of the monitoring camera layout network using the MAPPO algorithm. As can be seen from the image, the cumulative average return reward of the monitoring cameras tends to converge when it reaches around 1650, and at this time, actions are executed according to the maximized reward. At the same time, in the first 1200 rounds, the slope of the average return reward of the monitoring cameras is large and the change is obvious, which is consistent with the error change trend. In the early stage, the agent is unknown about the environment, so the return reward value is low but increases rapidly.

[0192] Use the trained network parameters for testing to obtain an optimized monitoring camera layout plan. The coverage of the cameras in the grid map is as Figure 10 shown. Table 9 shows the various index situations of the monitoring camera layout plan before and after optimization. After analyzing the data in the table, it can be seen that the number of grid cells in the optimized monitoring coverage area is 4719, the coverage rate is 81.03%, and the average attention degree to all key areas is 10.0%. Compared with before optimization, the coverage rate has increased by 10.71%, and the attention degree to key areas has increased by 7.86%. It can be seen that while this method improves the coverage rate, the attention degree to key areas has also been improved to a certain extent, which can prove the effectiveness of the MAPPO algorithm proposed in this embodiment for optimizing the layout of indoor monitoring cameras.

[0193] Table 9

[0194]

[0195] The embodiments described above are only descriptions of the preferred embodiments of the present invention and do not limit the scope of the present invention. Without departing from the design spirit of the present invention, various deformations and improvements made by those of ordinary skill in the art to the technical solutions of the present invention shall fall within the protection scope determined by the claims of the present invention.

Claims

1. A camera intelligent layout method for building digital twin construction, characterized in that Including: Obtain the scene to be arranged; Preprocess the scene to be arranged to obtain the obstacle area and the monitorable area; Obtain a preliminary camera arrangement plan based on the obstacle area and the monitorable area, and optimize the preliminary arrangement plan based on the MAPPO algorithm to obtain the final arrangement plan; Complete the camera arrangement in the scene to be arranged based on the final arrangement plan; Among them, optimizing the preliminary arrangement plan based on the MAPPO algorithm to obtain the final arrangement plan includes: Regarding the camera as an agent, design the state space, action space, and reward function of the agent; In the Actor network, define the policy network and the policy network objective function of the agent; In the Critic network, define the value network and the value network objective function of the agent; Under the constraints of the policy network, value network, state space, and action space, taking the reward function, policy network objective function, and value network objective function as the optimization objectives, iteratively update the state and actions of the agent to obtain the final arrangement plan; The state space is: S = [s1, s2, s3, …, s i ​ Among them, S is the state space, and s i is the state of the i-th agent; The action space includes: moving, rotating, and quantity adjustment; The reward function is: R = ∑(R NewCov + R ove + R bli + R All_cov ) + R edge + R num Among them, R is the reward function, and R NewCov is the newly added coverage reward, R All_cov is the reward for completing all coverage, R ove is the field of view overlap reward, R bli is the blind area reward, R edge is the grid map area boundary reward, R num is the reward for increasing the number of cameras; The policy network is The objective function of the policy network is: where a is the action taken by the agent in state s, θ are the parameters of the policy network, is the expectation, is the advantage function, representing the expected return gain of taking action a t in state s t relative to the average, clip(r t (θ), 1 - ε, 1 + ε) is the policy update magnitude, and ε is a constant; is the policy ratio, θ old are the previous parameters of the policy network; The value network is The objective function of the value network is as follows: Among them, φ i is a parameter of the value network, and V t target is the target value function.

2. The camera intelligent layout method for building digital twin construction according to claim 1, wherein Preprocessing the scene to be arranged includes: Preset the grid scale and threshold, divide the scene to be arranged using the grid to obtain the grid map; Mark and encode the grids where the obstacles are located in the grid map to obtain the obstacle area and the monitorable area.

3. The camera intelligent layout method for building digital twin construction according to claim 2, characterized in that The calculation method of the obstacle area is: Among them, Occ i,j is the occupancy rate of the obstacle in each grid (i, j) of the grid map, and S B (i, j) is the occupancy situation of the obstacle in each grid, and S i,j is the size of each grid, Th is the preset proportion of the obstacle in each grid. 0 means considering the grid as an obstacle-free area, and 1 means considering the grid as an obstacle area.

4. The intelligent camera layout method for building digital twin construction according to claim 1, wherein Obtaining a preliminary camera arrangement plan based on the obstacle area and the monitorable area includes: Construct a camera model; Based on the camera model, conduct a preliminary camera arrangement in the monitorable area to obtain the preliminary arrangement plan, where the preliminary arrangement plan includes the camera arrangement position, angle, and quantity.

5. The camera intelligent layout method for building digital twin construction according to claim 4, characterized in that The camera model is: Among them, Z C is the coordinate value of each boundary point of the camera's visible range on the Z-axis in the camera coordinate system. The coordinates of each boundary point of the camera's visible range are (x1, y1), (x2, y2), (x3, y3), and (x4, y4) respectively; A is the internal parameter matrix of the camera; M is the external parameter matrix of the camera, which is jointly defined by the matrices R and T. R is the rotation matrix of the camera, and T is the translation matrix of the camera; u and v are the length and width of the internal image sensor of the camera respectively.

Citation Information

Patent Citations

  • Camera layout optimization method for large-scale scene monitoring

    CN104469322A

  • Multi-agent reinforcement learning-based multi-machine air combat decision-making method

    CN113791634A