Research on Basketball Goal Recognition Based on Image Processing and Improved Algorithm

'is paper studies the basketball goal recognition method based on image processing and improved algorithm to improve the accuracy of automatic recognition of basketball goal. 'e infrared spectrum image acquisition system is used to collect the basketball goal image. After the image is denoised by using the adaptive filtering algorithm, the wavelet analysis method is used to extract the features of basketball goal signal, which are input into the optimized deformable convolution neural network.'rough the weighted sum of the values of each sampling point and the corresponding position authority of the block convolution core, the results are output as convolution operation. Combined with the depth feature of the same dimension, the full connection feature of the candidate target area is obtained to realize the basketball goal recognition. 'e experimental results show the following: the method can effectively identify basketball goals and the recognition error rate is low; the average accuracy of the automatic recognition results of basketball goals is as high as 98.4%; under the influence of different degrees of noise, the method is less affected by noise and has strong anti-interference ability.


Introduction
National Basketball Association (NBA) competition and China Basketball Association (CBA) competition are the most popular sport competitions in the current ball games.
rough the understanding of NBA and CBA, it is found that they use the method of combining artificial and intelligent devices to achieve timing and scoring. NBA's backboard is equipped with a camera. Every time a player is under the basket or making a layup, it will automatically take a picture. When the basketball falls from the basket and touches the net, the net has a dynamic response device, the rostrum receives the goal information, and the referee signals the rostrum at the same time to update the score and the timer. In January 22, 2014, in CBA, in a Beijing team vs. Foshan team game, there was a 24-second timer "stop," once the game is interrupted, and finally it manually reads the watch. In such a professional competition, the appearance of such a scene is also worth thinking about [1]. NBA and CBA competitions are dominated by manpower, supplemented by equipment. At present, many places still use some artificial methods to score for basketball examinations, which will lead to an unfair phenomenon. At present, the commonly used shooting scoring methods are as follows: using artificial way to achieve basketball scoring, which is gradually replaced by some intelligent devices. Now many basketball games use infrared detection method to judge basketball goals [2]. Although the two intelligent detection methods of infrared detection and microswitch can effectively solve some problems existing in traditional artificial detection, they also have some shortcomings, such as easy to damage and high maintenance cost. So it is urgent to find a better device to replace the previous methods [3].
With the rapid development of image processing technology, moving object detection technology in videos has been widely used. Especially in recent years, the application in sports, in which the video image processing technology, includes three parts of image acquisition, processing, and image secondary display [4,5]. Similarly, with the rapid development of the times, more and more video processing applications are proposed. As a very important branch of vision technology [6], moving object detection technology has a strong scientific research value. rough research, it is found that the topological structure of the data communication network is an important factor for its security against attacks. In such networks, by changing the topology, the security robustness against intentional attack that aims at bringing down network nodes may vary. is bringing down is a kind of destruction and interruption threat that attacks on the availability of the network (i.e., attack on network resources and links). A large number of researchers at home and abroad have done a lot of research on it and achieved good research results. For example, Yuntao Cui proposed to extract the features of the target by using the Markov field after locating the target area; Eun Ryun et al. used the color components in the image to locate and recognize the target; Xue et al. proposed the key technology of moving target detection and recognition based on image sequence; Zhang et al. proposed the adaptive target recognition algorithm of image based on depth feature learning [7,8]. ese methods solve the problems of traditional image recognition algorithm, such as cumbersome process and difficult feature extraction, but in the actual application process, the comprehensive performance of basketball goal recognition is not high, which cannot avoid the problems of easy damage, high replacement rate, high installation and production cost, and misjudgment in the traditional fixed-point shooting device. e main contributions of this paper are as follows: this paper mainly studies the basketball goal recognition method based on image processing and improved algorithm, through the combination of image processing technology and improved convolution neural network to better solve some of the above problems. e rest of this paper is organized as follows: Section 2 discusses basketball goal recognition based on image processing and improved algorithm and Section 3 shows simulation results analysis and discussion, and Section 4 concludes the paper with summary and future research directions.

Basketball Goal Recognition Based on Image
Processing and Improved Algorithm 2.1. Acquisition of Basketball Goal Image. e main components of image acquisition system are image spectrometer, optical fiber halogen lamp, electronic control mobile platform, infrared camera, computer, and lens. e imaging principle of the system is that when the optical fiber halogen lamp irradiates and collects the basketball goal image, the basketball goal image collected in the instantaneous field of view is first imaged in the slit of the image spectrometer, and finally imaged in the charge coupled device (CCD) after passing through the grating and prism splitter assembly [9]. e spatial dimension is one dimension of CCD photosensitive plane parallel to the slit, and the spectral dimension is one dimension of CCD photosensitive plane perpendicular to the slit. In each row of photosensitive elements of spatial dimension, a spectral image of basketball goal is acquired, which means that each frame image in CCD corresponds to the multispectral image of basketball goal [10]. e spectral range of the system is 1000-1800 nm, the image resolution is 320 × 256 pixels, the frame rate is 100 Hz, the dynamic range is 68 dB, the exposure time is 1 μs-400 s, and the power is less than 5 W. e resolution of the image spectrometer is 5 nm, the slit width is 30 μm, the pixel size is 7.6 mm × 14.2 mm, the numerical aperture is F/2.0, and the light flux is more than 50% in the range of 1000-1800 nm.
Before collecting the basketball goal image, the exposure time of the infrared camera should be determined to ensure the clarity of the basketball goal image; the speed of the electronic control mobile platform should be determined to ensure that the size and spatial resolution of the basketball goal image are not distorted.
rough several experiments, it is proved that when the exposure time is 3 ms and the electronic control mobile platform is 0.59 mm/s, the basketball goal image is the clearest. Because the light source intensity is not evenly distributed in each wavelength, there is dark current noise in the infrared camera, resulting in a large noise in the collected basketball goal image in the wavelength with less light source intensity distribution, so it is necessary to calibrate the collected basketball goal image in black and white [11]. In the case of the system consistent with the acquisition of basketball goals, the standard white correction plate is scanned to obtain the all-white calibrated basketball goal image O, and the camera shutter is closed to implement image acquisition to obtain the all-black calibrated basketball goal image B. Finally, the absolute basketball goal image I is converted into the relative basketball goal image S. e equation is as follows: (1)

Preprocessing of Basketball Goal Image.
At t � 0, 30 evenly distributed particles in the 50 * 50 neighborhood around the target basketball goal image are randomly selected. Let S t− 1 (E) and S t− 1 (i) be the collection result and particle set at time (t − 1), and π t− 1 (i) and c t− 1 (i) be the weight and cumulative probability of each particle, i � 1, . . ., n t− 1 . e number of particles is n t− 1 , and the template of basketball goal image at time t is q t u j , j � 1, 2. e adaptive particle filter algorithm is used to process basketball goal image, and the steps are as follows: Step 1. resample according to the weight of each particle to get S t− 1 ′ (i), i � 1, . . . , n t− 1 : (1) Form a random number with uniform distribution, r ∈ [0, 1]. (2) Calculate the minimum J of c t− 1 (j) ≥ r and obtain S t− 1 ′ (i) � S t− 1 (j).
Step 2. Calculate the particle set S t (i) at time t. e motion model of Gaussian noise variance σ 2 selected by adaptive particle filter algorithm without occlusion is as follows: (2) In equation (10), k � [(i − n t− 1 )/n t− 1 ] denotes the large direction, w t− 1 (i) is the binary Gaussian random noise, and w t− 1 (i) ∼ N(0, σ 2 ) is the range of Brownian motion of the particle.
Under occlusion, there is only Gaussian noise in the motion model, and the fixed values of σ and n t are 5 and 20. e particle state after Brownian motion is obtained as follows: where ‵ S t (i) is further iterated by the mean shift algorithm to obtain the optimized particle S t (i).
Step 3. Calculate the normalized weight π t (i) according to the matching degree of each particle histogram p u j (S i (i)) and template q t u j : In equation (12), where σ 0 is an important parameter. When the value of σ 0 is selected, the weight difference of each particle should be kept in an appropriate range, and the effectiveness and diversity of particles during resampling should be ensured [12][13][14]. N cr × N cb and N v are the two-dimensional histogram and one-dimensional histogram in the target space of basketball goal image, respectively, and ρ is the histogram matching degree.
Step 4. Calculate the cumulative probability c t (i) of particles Step 5. Calculate the weighted average state S t (E).
2.3. Feature Extraction of Basketball Goal Image. After preprocessing the basketball goal image, wavelet analysis is used to extract the image features of basketball goal. Suppose that the equation of binary discrete wavelet function is as follows: where the number of frames between frames is t, the number of decomposition layers is k, and the number of image frames is y. e discrete wavelet transform equation of corresponding function f(t) is as follows: where the mean value of differential cumulative image is P, the difference between frames is d, and the energy level of time-domain waveform is K.
If the discrete wavelet function ψ y,k (t) is formed into orthonormal basis L 2 (K), then f(t) ∈ L 2 (K) can be linearly combined with orthonormal basis, and the equation is as follows: In the case of orthogonal basis, the discrete wavelet is replaced by the mapping which ensures the invariance of norm, and there is no information redundancy. en the equation is as follows: After replacing the discrete wavelet, the original signal is decomposed into each frequency band. Let the sampling frequency of the signal be f s , so in the k-th decomposition, the frequency band range of the approaching signal is (0, f s /2 k+1 ), and the frequency band range of the detail signal is (f s /2 k+1 , f s /2 k ). e second power of the coefficients is the same as the total energy of the waveform in the same time domain [15,16]. e equation of basketball goal signal extraction based on energy feature is as follows: e number of frame difference is N.  Figure 1. e input signal x i of convolutional neural network neurons comes from the output of feedforward n neurons. After multiplying the input signal x i by the weight w i , the total input value is obtained by adding it to the offset b. Compared with the total input received by the neuron and the set threshold θ, the "activation function" is used to realize the activation processing, and the neuron output is obtained [17]. A simple 4-layer convolutional neural network model is shown in Figure 2.
Convolutional neural network is constructed by connecting a large number of neurons of the same form according to a certain organizational hierarchy. Each column is called the layer of neural network, which is mainly divided into input layer, hidden layer, and output layer. e input of each layer is the output of the previous layer, and the output is the input of the latter layer [18].

Basketball Goal Recognition Based on Improved
Convolution Neural Network. In order to realize the accurate recognition of basketball goals, convolution neural network is optimized, and the recognition of basketball goals is realized through the regular block convolution operation. e training part of optimized convolutional neural network mainly includes prediction subnetwork and identification subnetwork of target region, which share convolutional neural network structure [19].
Based on the characteristics of the basketball goal image obtained above, the characteristic image of the basketball goal image is obtained. e weighted sum of the values of each sampling point and the corresponding position authority of the block convolution kernel is performed, and the results are output as convolution operation. e receptive field of square convolution kernel is selected as regular region.
e definition of any point q 0 in the output feature map y of convolution operation is given as follows: where the elements in the receptive field area are expressed as q n , the feature map of basketball goal image is expressed as x, and the convolution operation is expressed as w. e offset Vq n |n � 1, 2, . . . , N is added into the deformation convolution operation, and the number of elements in the receptive field is described as N. Formula (13) is transformed into the following: By using the convolution kernel convolution operation of the offset variable, the basketball goal image feature map is input and the offset feature map is output, and the total number of feature values of the offset value of the deformation convolution operation is obtained, which can be reflected in each position in the map, and the final feature map is obtained by the offset value. e convolution kernel with the size of sliding window is selected at the center pixel position of each sliding window to collect the depth feature X i . e candidate detection frame is described by , the x-axis coordinate of the upper left corner of the candidate detection frame is described by d x i , the y-axis coordinate of the upper left corner of the candidate detection frame is described by d y i , the width of the candidate detection frame is described by d w i , and the height of the candidate detection frame is described by d h i . If the candidate detection frame is a positive sample, the overlap ratio of truth value frame D * i and candidate rectangle frame is higher than 0.3, which is described by Y i ≥ 1; if the candidate detection frame is a negative sample, the overlap ratio of truth value frame D * i and candidate rectangle frame is lower than 0.3, which is described by Y i � 0. e equation of overlapping ratio is as follows: e intersection area of different rectangles is described by area(D i ∩ D * i ), and the union area of different rectangles is described by area(D i ∪ D * i ).

Neuronal axon
Synaptic Dendritic e pool body Output the axon e activation function . .

Security and Communication Networks
is used to describe the training sample set, and the candidate target regions are predicted by sliding windows of different sizes. e loss function formula of regression and classification is obtained as where the cross entropy loss function of model parameters is described by W; the cross entropy loss function of measuring classification loss is described by L e (q(X), Y); the probability of various targets is expressed by q(X), and the balance parameter is expressed by λ; the detection box of background not participating in regression operation is described by [Y ≥ 1], and the detection box of completing regression operation is described by D; the L b -type loss function is described by L b , that is, where e overall loss function equation of candidate target area prediction subnetwork is obtained as follows: where μ m is described as a weighted parameter. e gradient descent method is used to solve the prediction subnetwork of candidate target region, and the prediction result is realized by the subnetwork of target region identification of convolution neural network.
rough the pooling layer of convolution neural network, the candidate target regions are pooled to obtain the depth features of the same dimension. e depth features are input to the full connection layer to obtain the full connection features of the candidate target regions and realize the final position regression and classification of the candidate target regions [20]. e multi-directional rotation of the basketball goal image will cause the pooling operation in the candidate target region to be mixed with the background region, so it is necessary to introduce the offset variable into the region pooling operation through the deformation convolution method.
Let the volume of the rectangular region be w × h, and the size of the rectangular region is transformed into k × k by pooling operation. e conversion formula is as follows: where the number of pixels in each subregion is described as n ij and the upper left corner coordinate is described as q 0 . By adding the offset Vq ij to equation (20), it is concluded that where 0 ≤ i, j < k. According to the above analysis, the depth features of each candidate target region are extracted in the residual block group by using the subnetwork of target region identification of deformation pooling operation, and the loss function can be transformed into where the weighted parameter of the target area discrimination subnetwork is expressed as μ 10 , the training set of the subnetwork of target area discrimination is expressed as S 10 , and the depth feature of the target area is expressed as W d . e process of basketball goal recognition based on the improved convolution neural network is as follows: the subnetwork of target region prediction is used to initialize the subnetwork of target region identification and the added full connection layer; the subnetwork is trained jointly and the learning rate is set; after the training, the basketball goal image to be recognized is input; and the target with the highest confidence result is taken as the target detection result. e detection frame with high overlap ratio can get the result of basketball goal through nonmaximum suppression.
In the last three years, many methods are proposed to handle the problem of basketball goal automation prediction; here we introduced three outstanding methods such as GNB [21], RNB [22], and CNB [23], which can be used to solve the related works taking different kinds of network structures. GNB is a graph-based network that builds connections between different risk nodes. And RNB uses a specific loss structure to keep the similarity of real and predicted goals differences. CNB is the basic model that needs more computation consuming more space to obtain the desiring performances. However, these methods have their disadvantages, respectively. GNB is too slow, RNB is so complicated, and CNB also needs more spaces.
In this paper, we utilize the entropy loss function to build the model for our research problems. It can be defined as follows:loss(x, y) � n i�1 − p i log(1 − p i ), where x and y are represented as the real basketball goals' score and y means the predicted score and difficult of our proposal. P i means the probability of them when they are similar. e bigger the Security and Communication Networks value of the loss, the worse our proposal performed. And our proposal is used to train a model that fits the real and predicted basketball goals, so that the machine can assist the actions predicted. And compared with the three methods, our proposal can deal with the problems easily, and we also need a smaller computation space to build our model. However, our model may obtain a relatively lower accuracy than others sometime which may lead the prediction to be unstable. e other methods are recently proposed methods, and they have their own advantages introduced as before and, however, also have their disadvantages, respectively. Here, our proposal can integrate their advantages well and avoid their shortcomings at the same time, so we compared each other. e prediction result of target recognition authenticity is shown in Table 1.

Experimental Analysis
Taking the basketball goals of a basketball game in a gymnasium as an example, the number of basketball goals of the game is 30 by manual counting. e method is used to collect and identify the basketball goals of the game and test the feasibility and accuracy of the automatic recognition of basketball goals. We use the confusion matrix, accuracy, precision, and F1-score to evaluate the model performance.
e matrix can be defined as follows: precise � TP TP + FP , Convolution neural network is trained by using the training sample set, and then convolution neural network is tested by using the test sample set. e convolution neural network is optimized by regular block convolution to obtain the best structural parameters of adaptive convolution neural network. Table 2 shows the structural parameters of adaptive convolution neural network with different number of input nodes.
It can be seen from Table 2 that the number of input nodes does not affect the network training accuracy, and the maximum number of training steps is the least when the number of input nodes is 5. Based on this, in the follow-up experiment process, the adaptive convolution neural network selects 5 input nodes, and the output result is the final experimental data, which saves the time of automatic recognition of basketball goals.
A basketball goal is randomly selected, and the proposed method is used to collect the infrared spectrum image of basketball goal and preprocess the collected image. e results are shown in Figure 3.
According to Figure 3, the proposed method can effectively collect the basketball goal image; after the completion of denoising, enhancement, and other preprocessing, it can obtain a clearer basketball goal image, which can provide strong data support for the later basketball goal recognition.
Taking the manual counting result as the actual basketball goal value, the basketball goal value identified by the proposed method is compared with the actual basketball goal value. e comparison results are shown in Table 3.
According to Table 3, the difference between the automatic recognition results of basketball goals by using the proposed method and the actual basketball goals is small, and the maximum error rate is 4%, which shows that the proposed method can effectively identify the number of basketball goals and has high accuracy.
In order to evaluate the recognition performance of the proposed method intuitively, the method in reference [7] (moving target detection and recognition method based on image sequence) and the method in reference [8] (image adaptive target recognition method based on deep feature learning) are selected as comparison methods. e basketball goal recognition results of the three methods are shown in Table 4.
According to Table 4, with the increasing number of basketball goals, the recognition accuracy of the three methods has declined, and the decline of this method is significantly lower than that of the other two methods. e average accuracy of the proposed method is 98.4%, and the other two methods are 94.7% and 88.9%, respectively. e average recognition time of the proposed method is significantly lower than that of the other two methods. e reason is that this method obtains the optimal result with the least steps through the adaptive convolution neural network with good generalization ability, which saves the time of automatic recognition of basketball goals. It is proved that the recognition accuracy of the proposed method is significantly higher than that of the comparison method, and the automatic recognition time of basketball goals is the shortest. e accuracy of the three methods for basketball goal recognition is compared when adding different additive noise. e results are shown in Table 5.
According to Table 5, with the increasing of additive noise, the basketball goal recognition rate of the three methods has decreased. e method in this paper is least affected by noise because wavelet transform and analysis are used to denoise and enhance the collected basketball goal image. e results show that under the influence of different noises, the proposed method is least affected by noise and has the highest accuracy of basketball goal recognition.
In order to accurately measure the recognition accuracy of different methods for basketball goals, the average accuracy of each method is used to measure the basketball goal recognition results. e results are shown in Table 6. It can be seen from Table 6 that the average accuracy of the proposed method is significantly higher than that of the methods in reference [7] and reference [8].
e average accuracy of the proposed method to identify basketball goals has been kept above 99%, which shows that this algorithm has high performance of basketball goal recognition, and the basketball goal recognition effect is good. e basketball goal recognition errors of the three methods under different color backgrounds are tested, and the test results are shown in Table 7.
Analysis of Table 7 shows that when the background color is monochrome, the proposed method can accurately identify all basketball goals, and the recognition rate is 100%. Under the complex background color, the highest basketball goal recognition error of the proposed method is 0.32, which is far lower than the methods in reference [7] and reference [8]. It shows that this method has high recognition rate of basketball goal in different background environments, and the recognition error is low.   e results are be shown in Figure 4. As shown in Figure 4, the values of the yellow bar represent the results of our proposal, and the others are denoted in notations in Figure 4. And on all datasets, we can see that our proposal is better than others except D4 (which represents the goal is 25), which all methods obtain the same results. It indicates that our proposal can perform well than the other three methods.

Conclusions
is paper studies the basketball goal recognition method based on image processing and improved algorithm and realizes the basketball goal recognition based on convolution neural network, but there are still some problems to be solved. Although our method has achieved good prediction accuracy at present compared with other popular methods, it is still unable to achieve considerable accuracy in the face of complex basketball games environment, and the training time of the model is long, which cannot meet the purpose of real-time predict. In the future, we will further optimize the model to improve the training speed while ensuring the accuracy. Furthermore, the research work will continue from the following aspects: (1) e performance of basketball goal recognition should be improved based on image processing and improved algorithm, the design of deep convolution network with higher information recognition accuracy under limited sample data should be optimized, and the real-time performance of the algorithm should be improved. (2) Considering the application of many technologies in the real-time collection task of basketball goals, we can continuously perceive the movement state of basketball.
Data Availability e datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.

Conflicts of Interest
e author declares that there are no conflicts of interest.  Security and Communication Networks 9