Abstract

This paper studies the basketball goal recognition method based on image processing and improved algorithm to improve the accuracy of automatic recognition of basketball goal. The 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. Through 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. The 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.

1. Introduction

National Basketball Association (NBA) competition and China Basketball Association (CBA) competition are the most popular sport competitions in the current ball games. Through 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. Through 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. This 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]. These 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.

The 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.

The 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.

2. Basketball Goal Recognition Based on Image Processing and Improved Algorithm

2.1. Acquisition of Basketball Goal Image

The main components of image acquisition system are image spectrometer, optical fiber halogen lamp, electronic control mobile platform, infrared camera, computer, and lens. The 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]. The 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]. The 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. The 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. Through 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. The equation is as follows:

2.2. Preprocessing of Basketball Goal Image

At , 30 evenly distributed particles in the neighborhood around the target basketball goal image are randomly selected.

Let and be the collection result and particle set at time , and and be the weight and cumulative probability of each particle, , …, . The number of particles is , and the template of basketball goal image at time t is , .

The 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 , :(1)Form a random number with uniform distribution, .(2)Calculate the minimum J of and obtain .

Step 2. Calculate the particle set at time t.
The motion model of Gaussian noise variance selected by adaptive particle filter algorithm without occlusion is as follows:In equation (10), denotes the large direction, is the binary Gaussian random noise, and 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 are 5 and 20. The particle state after Brownian motion is obtained as follows:where is further iterated by the mean shift algorithm to obtain the optimized particle .

Step 3. Calculate the normalized weight according to the matching degree of each particle histogram and template :In equation (12),where is an important parameter. When the value of 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 [1214]. Ncr × Ncb and 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 of particles

Step 5. Calculate the weighted average state .

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.

The 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 is formed into orthonormal basis , then 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. Then 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 fs, so in the k-th decomposition, the frequency band range of the approaching signal is (0, ), and the frequency band range of the detail signal is (, ). The second power of the coefficients is the same as the total energy of the waveform in the same time domain [15, 16]. The equation of basketball goal signal extraction based on energy feature is as follows:

The number of frame difference is N.

2.4. Basketball Goal Image Recognition
2.4.1. Convolutional Neural Network

The single neuron model of convolutional neural network is shown in Figure 1.

The input signal xi of convolutional neural network neurons comes from the output of feedforward n neurons. After multiplying the input signal xi by the weight , 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. The input of each layer is the output of the previous layer, and the output is the input of the latter layer [18].

2.4.2. 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. The 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. The 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. The receptive field of square convolution kernel is selected as regular region.

The definition of any point in the output feature map of convolution operation is given as follows:where the elements in the receptive field area are expressed as , the feature map of basketball goal image is expressed as x, and the convolution operation is expressed as .

The offset is added into the deformation convolution operation, and the number of elements in the receptive field is described as . 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.

The convolution kernel with the size of sliding window is selected at the center pixel position of each sliding window to collect the depth feature . The candidate detection frame is described by , the x-axis coordinate of the upper left corner of the candidate detection frame is described by , the y-axis coordinate of the upper left corner of the candidate detection frame is described by , the width of the candidate detection frame is described by , and the height of the candidate detection frame is described by .

If the candidate detection frame is a positive sample, the overlap ratio of truth value frame and candidate rectangle frame is higher than 0.3, which is described by ; if the candidate detection frame is a negative sample, the overlap ratio of truth value frame and candidate rectangle frame is lower than 0.3, which is described by . The equation of overlapping ratio is as follows:

The intersection area of different rectangles is described by , and the union area of different rectangles is described by .

is used to describe the training sample set, and the candidate target regions are predicted by sliding windows of different sizes. The loss function formula of regression and classification is obtained aswhere the cross entropy loss function of model parameters is described by ; the cross entropy loss function of measuring classification loss is described by ; the probability of various targets is expressed by , and the balance parameter is expressed by ; the detection box of background not participating in regression operation is described by , and the detection box of completing regression operation is described by ; the -type loss function is described by , that is,where

The overall loss function equation of candidate target area prediction subnetwork is obtained as follows:where is described as a weighted parameter.

The 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.

Through the pooling layer of convolution neural network, the candidate target regions are pooled to obtain the depth features of the same dimension. The 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]. The 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 , and the size of the rectangular region is transformed into by pooling operation. The conversion formula is as follows:where the number of pixels in each subregion is described as and the upper left corner coordinate is described as . By adding the offset to equation (20), it is concluded thatwhere , .

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 intowhere the weighted parameter of the target area discrimination subnetwork is expressed as , the training set of the subnetwork of target area discrimination is expressed as , and the depth feature of the target area is expressed as .

The 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. The 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:, where x and y are represented as the real basketball goals’ score and y means the predicted score and difficult of our proposal. Pi means the probability of them when they are similar. The bigger the 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. The 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. The prediction result of target recognition authenticity is shown in Table 1.

3. 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. The 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. The matrix can be defined as follows:

Convolution neural network is trained by using the training sample set, and then convolution neural network is tested by using the test sample set. The 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. The 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. The 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. The 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. The average accuracy of the proposed method is 98.4%, and the other two methods are 94.7% and 88.9%, respectively. The average recognition time of the proposed method is significantly lower than that of the other two methods. The 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.

The accuracy of the three methods for basketball goal recognition is compared when adding different additive noise. The 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. The 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. The 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. The 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]. The 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.

The 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.

The 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.

4. Conclusions

This 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)The 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

The datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.

Conflicts of Interest

The author declares that there are no conflicts of interest.