Camera rotation angle analysis method, device, equipment and storage medium
By generating and matching field sideline feature vectors, the camera rotation angle is automatically obtained, which solves the error and non-scalability problems caused by relying on professionals in the existing technology, and improves the accuracy and scalability of event guidance.
Patent Information
- Application Number
- CN202210515853.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The estimation of camera rotation angle in existing sports event guides relies on professionals, which has high errors and non-scalability, affecting the quality of the guide.
By acquiring the site image to be detected, the site sideline map is generated, the site sideline feature vector is extracted, and matched with the feature database, and the camera parameter matrix is decoded to obtain the camera rotation angle to achieve automated tracking.
Real-time, fully automatic acquisition of camera rotation angle without professional experience is achieved, improving the accuracy and scalability of event broadcasting.
Smart Images

Figure CN114979470B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a camera rotation angle analysis method, device, equipment and storage medium. Background Art
[0002] With the development of modern competitive sports, people are paying more and more attention to sports events, and a large number of sports events are broadcast live to the audience. Sports events usually have multiple video acquisition lenses deployed around the stadium, and the director will produce the multi-channel real-time video signals on the spot, and edit and broadcast the corresponding videos according to the director's rules.
[0003] At present, the director of a sports event usually needs professionals to estimate the rotation angle of the camera based on their own experience to achieve real-time tracking of the target in the event. However, this manual estimation method has high requirements for professionals and often leads to large errors. This error will further mislead the judgment of the automatic director system, thus affecting the quality of the sports director. In addition, this camera rotation tracking method that relies on professionals is not scalable. Summary of the invention
[0004] The main purpose of the present invention is to provide a camera rotation angle analysis method, device, equipment and storage medium, aiming to solve the problem of how to estimate the camera lens rotation angle.
[0005] To achieve the above object, the present invention provides a camera rotation angle analysis method, the camera rotation angle analysis method comprising the following steps:
[0006] Acquire an image of the site to be inspected;
[0007] Based on the image of the site to be detected, generating a site boundary map;
[0008] Obtaining a site edge feature vector corresponding to the site edge map;
[0009] Perform feature matching on the site boundary feature vector and the image feature vector in the feature database, and obtain the camera parameter matrix corresponding to the image feature vector;
[0010] The camera parameter matrix obtained by the matching is decoded to obtain the corresponding camera rotation angle.
[0011] Preferably, the step of establishing the feature database includes:
[0012] Obtain a dataset of field sideline images synthesized by the camera at different rotation angles;
[0013] Generate and store camera parameter matrix parameters corresponding to the sideline field image;
[0014] Based on the synthesized field edge image data set, correspondingly generating the image feature vector;
[0015] A corresponding relationship between the image feature vector and the camera parameter matrix is established to obtain a feature database.
[0016] Preferably, the step of generating a site boundary map based on the site image to be detected includes:
[0017] Inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map;
[0018] After the initial site mask map and the initial site edge map are spliced, they are input into an edge enhancement network to obtain an enhanced site edge map.
[0019] Preferably, the training steps of the mask generator and the field edge generator include:
[0020] Input the training data image frame and random noise into the initial mask generator to obtain a generated venue mask map;
[0021] Obtaining a real site mask map corresponding to the training data image frame, and inputting the real site mask map, the generated site mask map and the training data image frame into a first target loss function, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a mask generator;
[0022] Input the training data image frame and random noise into the initial field edge generator to obtain a generated field edge map;
[0023] The real field edge line map corresponding to the training data image frame is obtained, and the real field edge line map is input into a first target loss function together with the generated field edge line map and the training data image frame. The first target loss function is iteratively calculated until the first target loss function converges, and a field edge generator is trained.
[0024] Preferably, the training step of the edge enhancement network includes:
[0025] splicing the generated site edge map and the generated site mask map, inputting the generated edge map into an initial edge enhancement generator, and outputting an edge enhancement map;
[0026] The edge enhancement map, the generated site edge map and the generated site mask map are input into the enhancement loss function, the enhancement loss function is iteratively calculated until the enhancement loss function converges, and the edge enhancement network is trained.
[0027] Preferably, the step of obtaining the site boundary feature vector corresponding to the site boundary map comprises:
[0028] Inputting the site boundary line map into an image feature extraction network to extract an initial feature vector;
[0029] The initial feature vector is input into an image feature conversion network to generate a site edge feature vector.
[0030] Preferably, the steps of extracting image features and training the image feature conversion network include:
[0031] Acquire a pair of site sideline images and input them into a feature extractor to generate a first feature vector and a second feature vector, wherein the pair of site sideline images includes a first image and a second image;
[0032] Inputting the first eigenvector and the second eigenvector into a feature converter to obtain a first spatial conversion vector and a second spatial conversion vector after spatial conversion;
[0033] The edge image pair, the annotation of the edge image pair, the first space transformation vector and the second space transformation vector are input into a second objective loss function, and the second objective loss function is iteratively trained until the second objective loss function meets the convergence condition, so as to obtain the image feature extraction network and the image feature conversion network.
[0034] Preferably, the step of performing feature matching on the site boundary feature vector and the image feature vector in the feature database and obtaining the camera parameter matrix corresponding to the image feature vector comprises:
[0035] The site boundary feature vector is matched with the image feature vector in the feature database through a local sensitive hashing algorithm to obtain a corresponding camera parameter matrix.
[0036] In addition, to achieve the above object, the present invention also provides a camera rotation angle analysis device, the device comprising:
[0037] An acquisition module, used to acquire an image of a site to be detected;
[0038] An image generation module, used for generating a site boundary map based on the site image to be detected;
[0039] A feature extraction module, used for obtaining a site edge feature vector corresponding to the site edge map;
[0040] A matching module, used for performing feature matching between the site edge feature vector and the image feature vector in the feature database, and obtaining a camera parameter matrix corresponding to the image feature vector;
[0041] The decoding module is used to decode the camera parameter matrix obtained by the matching to obtain the corresponding camera rotation angle.
[0042] Preferably, the acquisition module is also used for:
[0043] Obtain a dataset of field sideline images synthesized by the camera at different rotation angles;
[0044] Generate and store a camera parameter matrix corresponding to the sideline field image;
[0045] Based on the synthesized field edge image data set, correspondingly generating the image feature vector;
[0046] A corresponding relationship between the image feature vector and the camera parameter matrix is established to obtain a feature database.
[0047] Preferably, the image generation module is further used for:
[0048] Inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map;
[0049] After the initial site mask map and the initial site edge map are spliced, they are input into an edge enhancement network to obtain an enhanced site edge map.
[0050] Preferably, the camera rotation angle analysis device further comprises:
[0051] A model training module is used to input the training data image frame and random noise into the initial mask generator to obtain a generated site mask map;
[0052] Obtaining a real site mask map corresponding to the training data image frame, and inputting the real site mask map, the generated site mask map and the training data image frame into a first target loss function, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a mask generator;
[0053] Input the training data image frame and random noise into the initial field edge generator to obtain a generated field edge map;
[0054] The real field edge line map corresponding to the training data image frame is obtained, and the real field edge line map is input into a first target loss function together with the generated field edge line map and the training data image frame. The first target loss function is iteratively calculated until the first target loss function converges, and a field edge generator is trained.
[0055] Preferably, the model training module is also used for:
[0056] splicing the generated site edge map and the generated site mask map, inputting the generated edge map into an initial edge enhancement generator, and outputting an edge enhancement map;
[0057] The edge enhancement map, the generated site edge map and the generated site mask map are input into the enhancement loss function, the enhancement loss function is iteratively calculated until the enhancement loss function converges, and the edge enhancement network is trained.
[0058] Preferably, the feature extraction module is also used for:
[0059] Inputting the site boundary line map into an image feature extraction network to extract an initial feature vector;
[0060] The initial feature vector is input into an image feature conversion network to generate a site edge feature vector.
[0061] Preferably, the model training module is also used for:
[0062] Acquire a pair of site sideline images and input them into a feature extractor to generate a first feature vector and a second feature vector, wherein the pair of site sideline images includes a first image and a second image;
[0063] Inputting the first eigenvector and the second eigenvector into a feature converter to obtain a first spatial conversion vector and a second spatial conversion vector after spatial conversion;
[0064] The edge image pair, the annotation of the edge image pair, the first space transformation vector and the second space transformation vector are input into a second objective loss function, and the second objective loss function is iteratively trained until the second objective loss function meets the convergence condition, so as to obtain the image feature extraction network and the image feature conversion network.
[0065] Preferably, the matching module is also used for:
[0066] The site boundary feature vector is matched with the image feature vector in the feature database through a local sensitive hashing algorithm to obtain a corresponding camera parameter matrix.
[0067] In addition, to achieve the above-mentioned purpose, the present invention also provides a camera rotation angle analysis device, which includes: a memory, a processor, and a camera rotation angle analysis program stored on the memory and executable on the processor, and the camera rotation angle analysis program is configured to implement the steps of the camera rotation angle analysis method as described above.
[0068] In addition, to achieve the above-mentioned purpose, the present invention also provides a storage medium, on which a camera rotation angle analysis program is stored, and when the camera rotation angle analysis program is executed by a processor, the steps of the camera rotation angle analysis method as described above are implemented.
[0069] The camera rotation angle analysis method proposed in the present invention obtains an image of a site to be detected, generates a site boundary map based on the image of the site to be detected, extracts a site boundary feature vector corresponding to the site boundary map, and then performs feature matching on the site boundary feature vector in a feature database to obtain a corresponding camera parameter matrix, and obtains the camera rotation angle by decoding. In this embodiment, the site boundary vector is used as a keyword of a database index to organize a camera parameter matrix library, establishes an association relationship between the site boundary feature vector and the camera parameter matrix and stores it as a feature database, and by extracting the site boundary vector in the site image, the camera rotation angle can be obtained in real time fully automatically without relying on the experience of professionals. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 It is a structural schematic diagram of a camera rotation angle analysis device in a hardware operating environment involved in an embodiment of the present invention;
[0071] Figure 2 It is a schematic diagram of the flow chart of the first embodiment of the camera rotation angle analysis method of the present invention;
[0072] Figure 3 A technical solution flow chart of automatically tracking the rotation angle of a camera according to an embodiment of a camera rotation angle analysis method of the present invention;
[0073] Figure 4 This is a detailed flow chart of step S20 in an embodiment of the camera rotation angle analysis method of the present invention;
[0074] Figure 5 A network structure diagram of the site boundary generated by the camera rotation angle analysis method according to an embodiment of the present invention;
[0075] Figure 6 This is a detailed flow chart of step S30 in an embodiment of a camera rotation angle analysis method of the present invention;
[0076] Figure 7 A network structure diagram of the site edge line image feature extraction and feature conversion in the first embodiment of the camera rotation angle analysis method of the present invention;
[0077] Figure 8 It is a schematic diagram of functional modules of an embodiment of a camera rotation angle analysis device of the present invention.
[0078] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0079] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0080] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the structure of a camera rotation angle analysis device in a hardware operating environment according to an embodiment of the present invention.
[0081] like Figure 1 As shown, the camera rotation angle analysis device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0082] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the camera rotation angle analysis device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0083] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and a camera rotation angle analysis program.
[0084] exist Figure 1In the camera rotation angle analysis device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the camera rotation angle analysis device of the present invention can be set in the camera rotation angle analysis device, and the camera rotation angle analysis device calls the camera rotation angle analysis program stored in the memory 1005 through the processor 1001, and executes the camera rotation angle analysis method provided by the embodiment of the present invention.
[0085] The embodiment of the present invention provides a camera rotation angle analysis method, referring to Figure 2 , Figure 2 FIG. 4 is a flow chart of a first embodiment of a camera rotation angle analysis method according to the present invention.
[0086] In this embodiment, the camera rotation angle analysis method includes:
[0087] Step S10, obtaining an image of the site to be detected;
[0088] Step S20, generating a site boundary map based on the site image to be detected;
[0089] Step S30, obtaining a site boundary feature vector corresponding to the site boundary map;
[0090] Step S40, performing feature matching on the site boundary feature vector and the image feature vector in the feature database, and obtaining a camera parameter matrix corresponding to the image feature vector;
[0091] Step S50: decoding the camera parameter matrix obtained by the matching to obtain the corresponding camera rotation angle.
[0092] The camera rotation angle analysis method of this embodiment is used in the event director system. In order to solve the problem that the existing camera rotation angle tracking mainly relies on the professional skills of professionals, and thus the quality of the director image also relies heavily on the professional skills of the operator, making it difficult to achieve large-scale intelligent director, it is necessary to develop automatic camera rotation tracking technology. This solution mainly focuses on the problem of how to determine the camera rotation angle in the development of automatic camera rotation angle tracking technology, and proposes a solution for determining the current camera rotation angle based on the venue image.
[0093] The following is a detailed description of each step:
[0094] Step S10, obtaining an image of the site to be detected;
[0095] In one embodiment, an image whose rotation angle of the camera needs to be detected is obtained. Specifically, the image of the venue to be detected can be obtained by extracting frames from the video captured by the camera. It can be understood that this solution is to obtain information related to the rotation angle of the camera by analyzing the venue image, so it is necessary to first obtain the image of the venue to be detected. Since this solution is mainly used in the event director system, frame images are usually extracted from the video captured in real time by the camera for real-time judgment.
[0096] Step S20, generating a site boundary map based on the site image to be detected;
[0097] In one embodiment, a field sideline map is generated based on the field image to be detected. It is understandable that in order to determine the mapping relationship between the field image and the camera rotation angle, it is necessary to find an invariant identification feature from the field image, and this identification feature is the identification of the field sideline. Usually, the field sidelines of various events have fixed standards, so the field sidelines can play a positioning role in the video. Specifically, the field sideline image generated from the field image can be trained through machine learning to generate a field sideline network. By learning the sideline features, the network can effectively segment the current image obtained by the camera into the court and the background, and further convert the foreground court into a field sideline map at the current angle.
[0098] Step S30, obtaining a site boundary feature vector corresponding to the site boundary map;
[0099] In one embodiment, according to the generated field sideline map, the corresponding sideline feature vector is obtained. It is understandable that a large database corresponding to the image to the camera posture (angle) needs to be established. However, the images are all high-dimensional data, which will bring problems of speed and accuracy. This problem is how to accurately map the high-dimensional field sideline map to a specific space, in which the feature vector of the field sideline has strong distinguishability. If the sideline image is to be directly matched with the rotation angle of the camera lens, it is relatively slow and difficult. Therefore, the sideline image is converted from a high-dimensional image into a more distinguishable low-dimensional feature vector, that is, the sideline feature extraction vector corresponding to the field sideline map is extracted. To extract the field sideline feature vector, a feature extractor pre-trained on ImageNet can be used to directly convert the field sideline image into a feature vector.
[0100] Step S40, performing feature matching on the site boundary feature vector and the image feature vector in the feature database, and obtaining a camera parameter matrix corresponding to the image feature vector;
[0101] In one embodiment, after obtaining the low-dimensional features of the site boundary, that is, after obtaining the site boundary feature vector, it is matched with the feature data in the feature database, and the corresponding feature vector is matched, thereby obtaining the camera parameter matrix corresponding to the feature vector. It can be understood that in the training stage, images taken at different camera rotation angles are collected, and then the boundary image generation and feature extraction are performed, and then the extracted image feature vector and the parameters at the time of shooting are associated and saved together, so that when it is detected that the site boundary feature vector of the site image to be detected is similar or identical to the existing image feature vector, it can be considered that the shooting parameters of this picture are the same as the shooting parameters of the picture in the training data at that time, and thus the associated and saved camera parameter matrix is obtained. It should be noted that the camera parameter matrix usually combines the internal and external parameters used by the camera when imaging, and includes parameters that can represent the camera rotation angle, so the camera rotation angle can be analyzed and obtained from the camera parameter matrix.
[0102] Step S50: decoding the camera parameter matrix obtained by the matching to obtain the corresponding camera rotation angle.
[0103] In one embodiment, the camera parameter matrix obtained by matching is decoded. The decoding process is to use the Rodriguez rotation formula to re-obtain the left and right rotation angles and the up and down rotation angles of the camera from the camera parameter matrix. After the angle results are obtained, services are provided for other downstream tasks in the director system. Among them, the Rodriguez rotation formula is a calculation formula for calculating a new vector obtained by rotating a vector around a rotation axis by a given angle in three-dimensional space, which is more suitable for the application scenario of camera lens rotation in this embodiment.
[0104] Furthermore, in one embodiment, the step of establishing the feature database includes:
[0105] Step S11, obtaining a field sideline image dataset synthesized by the camera at different rotation angles;
[0106] Step S12, generating and storing camera parameter matrix parameters corresponding to the sideline field image;
[0107] Step S13, generating the image feature vector accordingly based on the synthesized field edge image dataset;
[0108] Step S14, establishing a corresponding relationship between the image feature vector and the camera parameter matrix to obtain a feature database.
[0109] In one embodiment, the system needs to determine the current camera pose based on the input image, that is, the rotation angle of the camera relative to the zero-home state. To this end, we need to establish an accurate mapping relationship between the image and the camera rotation angle, specifically:
[0110] We first need to establish a mapping database of the field sideline image (feature vector) and the camera pose (Pose). This process uses a synthetic field sideline image dataset that is controlled by controlling the camera rotation angle. In other words, each synthetic field sideline image obtained offline in the dataset also corresponds to a camera parameter matrix (the camera parameter matrix is used to generate this synthetic sideline image). Assuming it is used for football game directing, because the camera itself is fixed at the No. 1 position on the center line of the field, the left and right rotation angles can obtain the current left and right half-court information, that is, whether the football is currently in the left half or the right half. Therefore, the data of the entire field can be obtained by rotating the camera. After that, the acquired image data is input into the field sideline generation network to obtain a synthetic field sideline image, and then the feature vector extraction network is used to obtain the field sideline image dataset, that is, the feature dataset. The feature vector of the field sideline is used as the keyword of the database index to organize the camera parameter matrix library. This new mechanism of one-to-one correspondence between the sideline feature vector and the camera parameter matrix is the basis for the automatic estimation of the camera rotation angle.
[0111] Reference Figure 3 , Figure 3 This is a technical solution flowchart of automatically tracking the rotation angle of a camera in an embodiment of the camera rotation angle analysis method of the present invention. The technical solution flowchart provides steps for obtaining the rotation direction of the camera lens of a sports venue in real time, thereby helping the intelligent director to determine the venue position that the camera lens is focusing on. Specifically, the flowchart shows two working routes:
[0112] (1) Edge image feature database generation route, steps 1→3→4→5. This is the step of establishing an edge map retrieval library. The system uses the synthesized field edge map to train the edge map feature extraction network and feature conversion network, thereby establishing effective indexes for a large number of edge maps in the database to facilitate the retrieval of edge maps. Each edge map in the database is accompanied by a corresponding camera parameter matrix.
[0113] (2) Camera rotation angle generation route, step 2→3→4→6→7→result. This is the step of automatically calculating the camera rotation angle in real time through the current frame of the camera. First, the system automatically generates a field edge map for the input scene, and then converts the map into a feature vector. The feature vector and the feature vector of the field edge in the database are in the same feature space, so that the best matching field edge can be found in the library through feature matching and the camera rotation angle can be estimated based on this.
[0114] This embodiment obtains an image of the site to be detected, generates a site boundary map based on the site image to be detected, generates a corresponding site boundary feature vector for the site boundary map, and then performs feature matching between the site boundary feature vector and the image feature vector in the feature database to obtain a camera parameter matrix corresponding to the image feature vector, and obtains the camera rotation angle corresponding to the site image to be detected by decoding the camera parameters. In this embodiment, a one-to-one association between the site boundary feature vector and the camera parameter matrix is established, so that the system can automatically obtain the corresponding camera rotation angle by matching the site boundary image features, and the entire estimation process is real-time and fully automatic without manual intervention.
[0115] Furthermore, based on the first embodiment of the camera rotation angle analysis method of the present invention, a second embodiment of the camera rotation angle analysis method of the present invention is proposed.
[0116] Reference Figure 4 , Figure 4 This is a detailed flow chart of step S20 in the first embodiment of the camera rotation angle analysis method of the present invention. In the second embodiment, the step of generating a field edge map based on the field image to be detected includes:
[0117] Step S21, inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map;
[0118] Step S22, after splicing the initial venue mask map and the initial venue edge map, input the spliced map into an edge enhancement network to obtain an enhanced venue edge map.
[0119] After obtaining the image of the site to be detected, this embodiment generates a corresponding initial site mask map and an initial site edge map by inputting the image of the site to be detected into a mask generator and a site edge generator, and obtains an enhanced site edge map by an edge enhancement network.
[0120] The following is a detailed description of each step:
[0121] Step S21, inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map;
[0122] In one embodiment, the field image to be detected is used to generate a field edge map through two stages. The first stage is to generate a field mask map and an initial field edge map. This stage is mainly composed of two isomorphic generation networks, namely a mask generator and a field edge generator. The inputs of the two generators are the current image frame, and the outputs are the field mask and the field edge map, respectively. The network architecture is a series of basic units BU "convolution layer -> batch normalization layer -> non-linear activation function", and all convolution layers use 3x3 filter kernels with stride 2. The encoding subnetwork structure of the generation network we designed is as follows: BU / N64-BU / N128-BU / N256-BU / N512-BU / N512-BU / N512, where BU / Nk means that the basic unit BU has k feature filter kernels. The decoding subnetwork structure after encoding is as follows: BU / N512-BU / N1024-BU / N1024-BU / N512-BU / N256-BU / N128. In order to allow the decoder to obtain more original information, each layer of the encoder is copied to the corresponding layer of the decoder, which realizes the information association between the encoder and the decoder.
[0123] Step S22, after splicing the initial venue mask map and the initial venue edge map, input the spliced map into an edge enhancement network to obtain an enhanced venue edge map.
[0124] In one embodiment, the initial bottom edge line map generated by the mask generator and the sideline generator is further enhanced. Generally speaking, the picture of the competition venue often involves complex background content of the venue, including audience seats and billboards. At the same time, the athletes and referees on the field will also block the sidelines of the field, thereby affecting the detection quality of the sidelines. In response to these unique problems, we designed a second-stage enhanced generation network. The input of this stage is the concatenation of the venue mask map generated in the first stage and the initial sideline map of the venue. The purpose of inputting the venue mask together is to enable the network to automatically learn the foreground of the venue and the background of the audience seats. The addition of venue mask information can reduce the interference of the venue background. For example Figure 5 (right) as shown, Figure 5 This is a network structure diagram of the site edge generation in the first embodiment of the camera rotation angle analysis method of the present invention. The edge enhancement network first passes through three layers of 3x3 convolution layers (i.e. Figure 5 The feature map is then passed through two residual dense sub-networks (i.e., Figure 5These residual dense sub-networks increase the depth and complexity of the network, thereby improving the capacity of the network, and can better refine the edge information, thereby generating a more accurate field edge map. After the dense sub-network, it is the decoding part, which mainly designs feature convolution (K3x3 C128Conv) and upsampling (Upsampling Block) to generate the final field edge map. Assume that the mask and edge map generated in the first stage are I mask and The second stage edge enhancement generation calculation can be expressed as the following formula:
[0125]
[0126] where f θ That is, the edge enhancement generation network, θ is the network weight that needs to be learned. Similarly, in order to improve the performance of the generator, we deliberately added L1 loss, that is,
[0127] Furthermore, in one embodiment, the training steps of the mask generator and the field edge generator include:
[0128] Step S23, inputting the training data image frame and random noise into an initial mask generator to obtain a generated venue mask map;
[0129] Step S24, obtaining a real site mask map corresponding to the training data image frame, and inputting the real site mask map, the generated site mask map and the training data image frame into a first target loss function, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a mask generator;
[0130] Step S25, inputting the training data image frame and random noise into an initial field edge generator to obtain a generated field edge line map;
[0131] Step S26, obtaining a real field edge line map corresponding to the training data image frame, and inputting it into a first target loss function together with the generated field edge line map and the training data image frame, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a field edge generator.
[0132] In one embodiment, the field edge generator and the mask generator are isomorphic, that is, the training method is the same, and the training data image frame and random noise are used as input, the real field mask map is used as auxiliary data, and the first objective loss function is used for training. When the first objective function meets the requirements, the field edge generator and the mask generator are obtained.
[0133] Specifically, if we assume that the input image (training data image frame) is x, and the generated field mask or field boundary map is y, then our generator can be expressed as G(x,z), where z is random noise, and the output of the generator is the generated image, that is, given the input image x as a condition and random noise z, G can generate an image that is as similar as possible to the real field mask or map y; at the same time, the discriminator can be expressed as D(x,y) and D(x,G(x,z)) to distinguish whether the image is real or generated. Given all the training data x and y, the first objective loss function of network training can be expressed as:
[0134]
[0135] In order to make the generated venue mask / mapG(x,z) more similar to the real y, we specially added L1 distance Loss to the objective function of the generator, which is different from the general generation network. The last item in .
[0136] The training data image frame and random noise are input into the initial mask generator / initial edge generator respectively, and the first objective function is calculated respectively. When the first objective function After reaching convergence, the training ends and the edge generator and mask generator are obtained respectively.
[0137] This embodiment generates an initial field mask map and an initial field sideline map in the first stage by inputting the field image to be detected into a mask generator and a field sideline generator; in the second stage, the initial field mask map and the initial field sideline map are spliced and input into a sideline enhancement network, and the noise outside the field is eliminated by integrating the field mask information. At the same time, a sideline enhancement network is designed to generate a clearer and more complete field sideline map. Through the two-stage field sideline generation algorithm, not only the field sideline detection is effectively realized, but also the side map generated by the audience seats outside the field, billboards and players on the field is successfully eliminated, which is impossible for traditional edge detection methods.
[0138] Furthermore, based on the previous embodiments of the camera rotation angle analysis method of the present invention, a third embodiment of the camera rotation angle analysis method of the present invention is proposed.
[0139] Reference Figure 6 , Figure 6 Detailed flow chart of step S30 in an embodiment of the camera rotation angle analysis method of the present invention. In this embodiment, the step of obtaining the site boundary feature vector corresponding to the site boundary map includes:
[0140] Step S31, inputting the site boundary line map into an image feature extraction network to extract an initial feature vector;
[0141] Step S32, inputting the initial feature vector into an image feature conversion network to generate a venue edge feature vector.
[0142] In this embodiment, the field edge map is subjected to feature extraction and feature conversion to obtain a field edge feature vector for feature database retrieval. Specifically, the image feature extraction network can be obtained by training a public classical feature extraction network, and the feature conversion is to make similar field edge maps closer in space, otherwise farther. Specifically, there are some commonly used methods for feature conversion, such as Standardization, Min-Max Scaling / Normalization, etc.
[0143] Furthermore, in one embodiment, the steps of extracting image features and training the image feature conversion network include:
[0144] Step S33, obtaining a pair of site edge images and inputting them into a feature extractor to generate a first feature vector and a second feature vector, wherein the pair of site edge images includes a first image and a second image;
[0145] Step S34, inputting the first feature vector and the second feature vector into a feature converter to obtain a first spatial conversion vector and a second spatial conversion vector after spatial conversion;
[0146] Step S35, input the edge image pair, the annotation of the edge image pair, the first space transformation vector and the second space transformation vector into a second objective loss function, iteratively train the second objective loss function until the second objective loss function meets the convergence condition, and obtain the image feature extraction network and the image feature conversion network.
[0147] The image feature extraction and image feature conversion network proposed in this embodiment can generate more discriminative feature vectors compared with the commonly used feature extraction method based on ImageNet pre-training, which is conducive to the accurate matching of the field sidelines.
[0148] Reference Figure 7 , Figure 7 This is a network structure diagram of the site edge image feature extraction and feature conversion in the first embodiment of the camera rotation angle analysis method of the present invention, which is specifically described as follows:
[0149] Field sideline image feature generator. It is an impossible task to directly search and match the generated field sideline images (ultra-high dimensional data). We need to extract effective and concise features from the images for efficient storage and retrieval. The commonly used method is to use the feature extractor pre-trained on ImageNet to directly convert the field sideline image into a feature vector. However, the features extracted in this way cannot represent the sideline image well, and thus cannot effectively measure the distance between different image features, so it is not suitable for image retrieval. For this reason, we specially designed a field sideline image feature extraction and conversion network. Figure 7 As shown, the input of the network training is a pair of edge images, namely the first image and the second image (x 1, x2), feature encoder f θ (Extractor) respectively extracts features from the image (f θ (x1),f θ (x2)), which is the first eigenvector and the second eigenvector. Our design is universal, and the feature encoder can be any network structure such as AlexNet and deep residual network. Our application uses an 18-layer residual network.
[0150] The feature converter of the field edge image consists of three fully connected layers (i.e. Figure 7 FC in (DxD (D = 1024), each convolution is followed by a batch normalization operation (i.e. Figure 7 BatchNorm) and nonlinear activation (i.e. Figure 7 The input of the network training is the output of the feature encoding, that is, the first eigenvector and the second eigenvector (f θ (x1),f θ The converter performs spatial transformation on the feature vectors of the field edge lines x1 and x2 to obtain the first spatial transformation vector and the second spatial transformation vector, i.e., f π (f θ (x1)) and f π (f θ (x2)), the goal of this transformation is to make similar field edge maps closer in space, otherwise farther. Therefore, the process of feature generation and transformation network training is to optimize the following second objective loss function:
[0151] y*D(x1,x2)+(1-y)*{max(0,mD(x1,x2))}
[0152] where D(x1,x2)=sqrt((f π (f θ (x1))-f π (f θ(x2))) 2 ) are two site boundary graphs in the new feature space The Euclidean distance inside, y = 1 / 0 is the edge image pair (x 1, x2), y = 1 means the two sidelines are similar. m is a threshold to ensure that the distance between dissimilar sidelines is not less than the threshold.
[0153] Although the network structure of the feature converter looks somewhat similar to a general multi-layer perceptron, the batch normalization operation in it makes it achieve a completely different effect. In essence, such normalization makes the features between feature vectors comparable. In short, the feature converter, on the one hand, increases the learning capacity / ability of the network by adding a fully connected layer so that the system can transform features in multiple nonlinear spaces, and on the other hand, projects the image into a more highly condensed space (or a semantically higher-level space). This design has two major advantages: first, the Euclidean distance in the feature space can accurately represent the similarity of the field edge lines, that is, the feature vector has a higher degree of solvability; second, the relatively low-dimensional feature vector can effectively improve the retrieval efficiency of the image library.
[0154] In this embodiment, the field edge line image is input into the image feature extraction network to extract the initial feature vector, and the initial feature vector is input into the image feature conversion network to generate the field edge line feature vector. Based on the self-supervised learning mechanism and network proposed in this embodiment, the feature extraction network and feature conversion network of the field edge line image can be trained accurately. The training of the process of projecting the edge line image into a low-dimensional feature space with higher distinguishability does not require data identification and is a self-supervised learning process. Thus, the field edge line feature vector with higher distinguishability can be obtained, and the relatively low-dimensional feature vector can also effectively improve the retrieval efficiency of the image library.
[0155] Furthermore, based on the previous embodiments of the camera rotation angle analysis method of the present invention, a fourth embodiment of the camera rotation angle analysis method of the present invention is proposed.
[0156] In this embodiment, the step of performing feature matching on the site boundary feature vector and the image feature vector in the feature database and obtaining the camera parameter matrix corresponding to the image feature vector includes:
[0157] Step S41, matching the site boundary feature vector with the image feature vector in the feature database by using a local sensitive hashing algorithm to obtain a corresponding camera parameter matrix.
[0158] In one embodiment, the site boundary feature vector is matched. The general retrieval method is to use the nearest neighbor traversal method to find the matching site boundary feature vector from the database. However, the nearest neighbor algorithm generally has low matching accuracy and is time-consuming, and it is difficult to meet real-time requirements. To this end, this patent proposes two innovations to overcome this problem. First, the site boundary image is feature transformed to make the feature vector more compact and easier to achieve high-performance fast matching. Secondly, when matching the image feature vector with the database, we use a faster and more accurate local sensitive hashing algorithm. Locality Sensitive Hashing (LSH) algorithm, LSH can achieve further dimensionality reduction + local search for matching pairs. Here, the steps of LSH are exemplified: First, Min Hashing is performed to compress high-dimensional sparse data, thereby improving computational efficiency. Through Min Hashing, a large matrix can be compressed into a small matrix through hash mapping, while maintaining the similarity between columns, thereby reducing complexity. Based on the signature vector obtained by Min Hashing, each vector is divided into several segments, called bands (that is, each band contains multiple rows). The signature vector of each user is hashed and bucketed in each band to calculate the similarity. Users who are divided into the same bucket in any band are candidate similar users to each other. In this way, we only need to calculate the similarity of all candidate users to find the similar user group of each user.
[0159] In this embodiment, the site edge feature vector is matched and retrieved in the feature database through hashing to obtain the corresponding camera parameter matrix, which is faster and more accurate, can improve the speed of obtaining the camera rotation angle, and can better play the function of image feature conversion.
[0160] The present invention also provides a camera rotation angle analysis device. Figure 8 As shown, Figure 8 It is a schematic diagram of functional modules of an embodiment of a camera rotation angle analysis device of the present invention.
[0161] The camera rotation angle analysis device of the present invention comprises:
[0162] An acquisition module 10 is used to acquire an image of a site to be detected;
[0163] An image generation module 20, configured to generate a site boundary map based on the site image to be detected;
[0164] A feature extraction module 30 is used to obtain a site edge feature vector corresponding to the site edge map;
[0165] A matching module 40 is used to perform feature matching between the site boundary feature vector and the image feature vector in the feature database, and obtain a camera parameter matrix corresponding to the image feature vector;
[0166] The decoding module 50 is used to decode the camera parameter matrix obtained by the matching to obtain the corresponding camera rotation angle.
[0167] Preferably, the acquisition module is also used for:
[0168] Obtain a dataset of field sideline images synthesized by the camera at different rotation angles;
[0169] Generate and store camera parameter matrix parameters corresponding to the sideline field image;
[0170] Based on the synthesized field edge image data set, correspondingly generating the image feature vector;
[0171] A corresponding relationship between the image feature vector and the camera parameter matrix is established to obtain a feature database.
[0172] Preferably, the image generation module is further used for:
[0173] Inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map;
[0174] After the initial site mask map and the initial site edge map are spliced, they are input into an edge enhancement network to obtain an enhanced site edge map.
[0175] Preferably, the camera rotation angle analysis device further comprises:
[0176] A model training module is used to input the training data image frame and random noise into the initial mask generator to obtain a generated site mask map;
[0177] Obtaining a real site mask map corresponding to the training data image frame, and inputting the real site mask map, the generated site mask map and the training data image frame into a first target loss function, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a mask generator;
[0178] Input the training data image frame and random noise into the initial field edge generator to obtain a generated field edge map;
[0179] The real field edge line map corresponding to the training data image frame is obtained, and the real field edge line map is input into a first target loss function together with the generated field edge line map and the training data image frame. The first target loss function is iteratively calculated until the first target loss function converges, and a field edge generator is trained.
[0180] Preferably, the model training module is also used for:
[0181] splicing the generated site edge map and the generated site mask map, inputting the generated edge map into an initial edge enhancement generator, and outputting an edge enhancement map;
[0182] The edge enhancement map, the generated site edge map and the generated site mask map are input into the enhancement loss function, the enhancement loss function is iteratively calculated until the enhancement loss function converges, and the edge enhancement network is trained.
[0183] Preferably, the feature extraction module is also used for:
[0184] Inputting the site boundary line map into an image feature extraction network to extract an initial feature vector;
[0185] The initial feature vector is input into an image feature conversion network to generate a site edge feature vector.
[0186] Preferably, the model training module is also used for:
[0187] Acquire a pair of site sideline images and input them into a feature extractor to generate a first feature vector and a second feature vector, wherein the pair of site sideline images includes a first image and a second image;
[0188] Inputting the first eigenvector and the second eigenvector into a feature converter to obtain a first spatial conversion vector and a second spatial conversion vector after spatial conversion;
[0189] The edge image pair, the annotation of the edge image pair, the first space transformation vector and the second space transformation vector are input into a second objective loss function, and the second objective loss function is iteratively trained until the second objective loss function meets the convergence condition, so as to obtain the image feature extraction network and the image feature conversion network.
[0190] Preferably, the matching module is also used for:
[0191] The site boundary feature vector is matched with the image feature vector in the feature database through a local sensitive hashing algorithm to obtain a corresponding camera parameter matrix.
[0192] The invention also provides a storage medium.
[0193] The storage medium of the present invention stores a camera rotation angle analysis program, and when the camera rotation angle analysis program is executed by a processor, the steps of the camera rotation angle analysis method described above are implemented.
[0194] Among them, the method implemented when the camera rotation angle analysis program running on the processor is executed can refer to the various embodiments of the camera rotation angle analysis method of the present invention, and will not be repeated here.
[0195] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprising a Raman spectroscopy data processing" does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0196] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0197] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0198] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A camera rotation angle analysis method, characterized in that: The camera rotation angle analysis method comprises the following steps: Acquire an image of the site to be inspected; Based on the image of the site to be detected, generating a site boundary map; Acquire a field edge feature vector corresponding to the field edge map, wherein the field edge feature vector is a feature vector obtained by mapping the field edge map in a high-dimensional space to a low-dimensional space; Performing feature matching on the field edge feature vector and the image feature vector in a feature database, and obtaining a camera parameter matrix corresponding to the image feature vector that matches the field edge feature vector, wherein the feature database is obtained by collecting field images shot at different camera rotation angles, performing edge image generation and feature extraction on the field images, and associating and saving the extracted image feature vector with the camera parameter matrix during shooting; The camera parameter matrix obtained by the matching is decoded to obtain the corresponding camera rotation angle.
2. The camera rotation angle analysis method according to claim 1, characterized in that: The steps of establishing the feature database include: Obtain a dataset of field sideline images synthesized by the camera at different rotation angles; Generate and store a camera parameter matrix corresponding to the field edge image; Based on the synthesized field edge image data set, correspondingly generating the image feature vector; A corresponding relationship between the image feature vector and the camera parameter matrix is established to obtain a feature database.
3. The camera rotation angle analysis method according to claim 1, characterized in that: The step of generating a site boundary map based on the site image to be detected comprises: Inputting the to-be-detected site image into a mask generator and a site edge generator to generate a corresponding initial site mask map and an initial site edge map; After the initial site mask map and the initial site edge map are spliced, they are input into an edge enhancement network to obtain an enhanced site edge map.
4. The camera rotation angle analysis method according to claim 3, characterized in that: The training steps of the mask generator and the edge generator include: Input the training data image frame and random noise into the initial mask generator to obtain a generated venue mask map; Obtaining a real site mask map corresponding to the training data image frame, and inputting the real site mask map, the generated site mask map and the training data image frame into a first target loss function, iteratively calculating the first target loss function until the first target loss function converges, and training to obtain a mask generator; Input the training data image frame and random noise into the initial field edge generator to obtain a generated field edge map; The real field edge line map corresponding to the training data image frame is obtained, and the real field edge line map is input into a first target loss function together with the generated field edge line map and the training data image frame. The first target loss function is iteratively calculated until the first target loss function converges, and a field edge generator is trained.
5. The camera rotation angle analysis method according to claim 4, characterized in that: The training steps of the edge enhancement network include: splicing the generated site edge map and the generated site mask map, inputting the generated edge map into an initial edge enhancement generator, and outputting an edge enhancement map; The edge enhancement map, the generated site edge map and the generated site mask map are input into the enhancement loss function, the enhancement loss function is iteratively calculated until the enhancement loss function converges, and the edge enhancement network is trained.
6. The camera rotation angle analysis method according to claim 1, characterized in that: The step of obtaining the site boundary feature vector corresponding to the site boundary map comprises: Inputting the site boundary line map into an image feature extraction network to extract an initial feature vector; The initial feature vector is input into an image feature conversion network to generate a site edge feature vector.
7. The camera rotation angle analysis method according to claim 6, characterized in that: The steps of extracting the image features and training the image feature conversion network include: Acquire a pair of site sideline images and input them into a feature extractor to generate a first feature vector and a second feature vector, wherein the pair of site sideline images includes a first image and a second image; Inputting the first eigenvector and the second eigenvector into a feature converter to obtain a first spatial conversion vector and a second spatial conversion vector after spatial conversion; The edge image pair, the annotation of the edge image pair, the first space transformation vector and the second space transformation vector are input into a second objective loss function, and the second objective loss function is iteratively trained until the second objective loss function meets the convergence condition, so as to obtain the image feature extraction network and the image feature conversion network.
8. The camera rotation angle analysis method according to claim 1, characterized in that: The step of performing feature matching on the site boundary feature vector and the image feature vector in the feature database and obtaining the camera parameter matrix corresponding to the image feature vector comprises: The site boundary feature vector is matched with the image feature vector in the feature database through a local sensitive hashing algorithm to obtain a corresponding camera parameter matrix.
9. A camera rotation angle analysis device, characterized in that: The device comprises: An acquisition module, used to acquire an image of a site to be detected; An image generation module, used for generating a site boundary map based on the site image to be detected; A feature extraction module, used to obtain a field edge feature vector corresponding to the field edge map, wherein the field edge feature vector is a feature vector obtained by mapping the field edge map in a high-dimensional space to a low-dimensional space; A matching module, used for performing feature matching between the field edge feature vector and the image feature vector in a feature database, and obtaining a camera parameter matrix corresponding to the image feature vector that matches the field edge feature vector, wherein the feature database is obtained by collecting field images taken at different camera rotation angles, performing edge image generation and feature extraction on the field images, and associating and saving the extracted image feature vector with the camera parameter matrix during shooting; The decoding module is used to decode the camera parameter matrix obtained by the matching to obtain the corresponding camera rotation angle.
10. A camera rotation angle analysis device, characterized in that: The device comprises: a memory, a processor, and a camera rotation angle analysis program stored in the memory and executable on the processor, wherein the camera rotation angle analysis program is configured to implement the steps of the camera rotation angle analysis method according to any one of claims 1 to 8.
11. A storage medium, characterized in that: The storage medium stores a camera rotation angle analysis program, which, when executed by a processor, implements the steps of the camera rotation angle analysis method according to any one of claims 1 to 8.
