Magnus-Forces Analysis of Pitched-Baseball Trajectories Using YOLOv3-Tiny Deep Learning Algorithm

: This study analyzed the characteristics of pitched baseballs from TV broadcast videos to understand the effects of the Magnus force on a pitched-baseball trajectory using aerodynamic theory. Furthermore, an automatic measurement and analysis system for pitched-baseball trajectories, ball speeds, and spin rates was established, capturing the trajectory of the baseball thrown by the pitcher before the catcher catches it and analyzing its related dynamic parameters. The system consists of two parts: (1) capturing and detecting the pitched baseball in all frames of the video using the YOLOv3-tiny deep learning algorithm and automatically recording the coordinates of each detected baseball position; (2) automatically calculating the average speed and spin rate of the pitched baseball using aerodynamic theory. As the baseball thrown by the pitcher is fast, and live-action TV videos like sports and concerts are typically at least 24 fps or more, this study used YOLOv3-tiny algorithm to speed up the calculation. Finally, the system automatically presented pitching data on the screen, and the pitching information in the baseball game was easily obtained and recorded for further discussion. The system was tested using 30 videos of pitched baseballs and could effectively capture the baseball trajectories, throw points, catch points, and vertical displacements. Compared with the values from the TV broadcast, the average errors on the calculated ball speed and spin rate were 1.88% and 7.51%, respectively. Using the ratio of the spin rate and ball speed as a parameter to analyze the pitching state of the pitcher’s four-seam fastball in the Nippon Professional Baseball and Major League Baseball matches, it was observed that when this ratio increased, the Magnus displacement of the ball increased, thereby decreasing its late break. Therefore, the developed system provides scientiﬁc pitching data to improve the performance of baseball pitchers.


Introduction
Watching sports has always been an important form of entertainment for people.Rather than attending the games physically, many people choose to watch the games at home.Consider Major League Baseball (MLB) as an example.The broadcast rights of Fox Sports have reached USD 5.1 billion in 10 years, indicating that sporting events are of considerable commercial interest in the United States of America.Almost all professional teams invest significant funds to enhance their team's combat effectiveness and attract many outstanding players.Since 2015, MLB has used the Statcast system, which utilizes two cameras and a Doppler radar, to record players' performance data, making baseball data more scientific and enabling the players to view the training results through these data [1][2][3].For pitchers, in addition to the ball speed, the spin rate has been identified as an important parameter.According to the literature [1], the Statcast system uses Trackman radar technology to track and analyze the speed and spin rate of the pitched ball using optical sensing.However, these devices are expensive and require a fixed installation, which makes them difficult to deploy at an arbitrary time and place.In addition, it is very difficult to train baseball pitchers using a scientific method because of the relatively imperfect equipment and grounds for grassroots baseball.Therefore, this study proposes an economical use of aerodynamic theory to analyze pitched-baseball characteristics from high-quality (1080 p or 4 k resolution image) TV broadcast videos.This technology can analyze the trajectories, throw points, catch points, vertical displacements, ball speeds, and spin rates of pitched baseballs.According to fluid mechanics [4], in addition to gravity, the Magnus effect generated by the interaction between the baseball and air (fluid) when the baseball is traveling in the air must be considered.Taking the high-spin-rate four-seam fastball as an example, the Magnus force increases and its direction resists gravity [4], and the ball appears to move upwards to the batter.According to the literature [5,6], an increase in the spin rate of the four-seam fastball increases the rate of swing, reduces the rate of being hit, and increases the proportion of fly balls.Changes in ball characteristics affect the magnitude and direction of the Magnus force, such as the differences in the ball speed, spin rate, and rotation axis, which changes the trajectory of its flight.This phenomenon is called a late break [6].According to the boundary-layer concept proposed by Ludwig Prandtl [7], the drag effect is caused by fluid viscosity and the object only exists in a very thin layer on the surface of the object called the boundary layer.The fluid outside the boundary layer is regarded as an ideal fluid, and its viscosity can be ignored.In this situation, the problem of a flying baseball can be theoretically dealt with in two parts.The first part is the area outside the boundary layer above the baseball surface.The air in this area can be regarded as an ideal fluid, which can be analyzed using Euler's equation [4].The second part is the area within the boundary layer that is affected by the fluid viscosity and drag effect caused by the surface contact between the fluid and the object.However, when a baseball is flying, its flying speed causes turbulence in the separated area behind the baseball.The Navier-Stokes equation is insufficient to address the problem of the inner boundary layer because of the existence of fluid viscosity [4].Therefore, this study utilized the dimensional analysis method to quantify the inner boundary layer of the flying baseball and obtained the mathematical form of the baseball flight aerodynamics.
Object tracking has been used for the analysis of sporting events for many years, and it can be divided into multi-angle tracking and single-angle tracking, based on the number of angles.Multi-angle tracking uses images from multiple angles to reconstruct threedimensional spatial information to track a baseball.A well-known commercial baseball data analysis software, K Zone [8], which has been used in baseball games, uses three-angle images to track the baseball's location, and it is expensive to build.The literature used TV broadcasting to analyze baseball trajectories from a single perspective [9].It used a positive frame difference image and morphological operations to filter the background and then used size, shape, compactness, and Kalman filters to filter noise to detect and record baseball flight trajectories.In addition, the literature used a high-speed camera to capture real-time images of the seams on the surface of the baseball and calculated the speed of the baseball through the relative displacement between the seam positions of each image [10].When performing morphological processing or applying filters, many parameters need to be adjusted individually for different videos.The afterimages produced by broadcasting cameras distort the shape of the baseball, making it difficult to recognize a baseball using shape recognition for circular object detection, such as the Hough transformation [11].Moreover, when using colors to identify baseballs, each scene has a different light and shadow background, and the color of the baseball on the screen may no longer be pure white, making it necessary to adjust the color mask parameters for different videos.Using deep learning to adjust the chroma, saturation, size, and exposure of each image during training can easily solve the problem of using shape, size, and color to detect the baseball.Furthermore, an optimized deep learning model (increasing the number of training samples) is more accurate for baseball detection.This saves a great amount of adjustment time and cost compared to image recognition optimization.
In recent years, a significant amount of research has been conducted on the development of deep learning algorithms [12][13][14][15][16][17][18][19][20][21][22][23][24][25][26].The You Only Look Once (YOLO) machine learning object-recognition algorithm developed by Joseph Redmon and Ali Farhadi vividly describes the characteristics of the multiple-object-tracking algorithm from input to output using only a single-stage neural network to train and target the image [17,18].It overcomes the shortcoming of traditional object detection, that is, individual objects must be trained and detected separately, and simultaneously increases the computing performance considerably.Moreover, many recent studies have adopted YOLOv3 [17,19,20,23,26], which has the advantages of the previous generation algorithms, an updated multi-scale detection function with a more powerful feature extraction network, and improved accuracy and performance.YOLOv4 [24][25][26] utilizes spatial pyramid pooling and a path aggregation network to improve the performance of YOLOv3.However, because the baseball thrown by the pitcher is fast and live-action TV videos like sports and concerts are typically at least 24 fps or more [27], this study used YOLOv3-tiny algorithm to speed up the calculation [18].While its accuracy is not as high as that of YOLOv3 and YOLOv4, it exhibits high performance and its computing speed is close to the real-time speed of the ball in live-action TV videos [19,23,26].This algorithm is used along with the aerodynamic theory to recognize baseballs and analyze the characteristics of throw points, catch points, and vertical displacements of pitched baseballs from the TV broadcast videos.Eventually, using the ratio of the spin rate and ball speed as a parameter to analyze the pitching state of the pitcher's four-seam fastball in the Nippon Professional Baseball (NPB) and MLB matches for the late break of the pitched baseball due to the Magnus effect.It also provides baseball broadcast units with pitching information of the pitchers to enhance fans' satisfaction while watching the games.In recent years, a significant amount of research has been conducted on the development of deep learning algorithms [12][13][14][15][16][17][18][19][20][21][22][23][24][25][26].The You Only Look Once (YOLO) machine learning object-recognition algorithm developed by Joseph Redmon and Ali Farhadi vividly describes the characteristics of the multiple-object-tracking algorithm from input to output using only a single-stage neural network to train and target the image [17,18].It overcomes the shortcoming of traditional object detection, that is, individual objects must be trained and detected separately, and simultaneously increases the computing performance considerably.Moreover, many recent studies have adopted YOLOv3 [17,19,20,23,26], which has the advantages of the previous generation algorithms, an updated multi-scale detection function with a more powerful feature extraction network, and improved accuracy and performance.YOLOv4 [24][25][26] utilizes spatial pyramid pooling and a path aggregation network to improve the performance of YOLOv3.However, because the baseball thrown by the pitcher is fast and live-action TV videos like sports and concerts are typically at least 24 fps or more [27], this study used YOLOv3-tiny algorithm to speed up the calculation [18].While its accuracy is not as high as that of YOLOv3 and YOLOv4, it exhibits high performance and its computing speed is close to the realtime speed of the ball in live-action TV videos [19,23,26].This algorithm is used along with the aerodynamic theory to recognize baseballs and analyze the characteristics of throw points, catch points, and vertical displacements of pitched baseballs from the TV broadcast videos.Eventually, using the ratio of the spin rate and ball speed as a parameter to analyze the pitching state of the pitcher's four-seam fastball in the Nippon Professional Baseball (NPB) and MLB matches for the late break of the pitched baseball due to the Magnus effect.It also provides baseball broadcast units with pitching information of the pitchers to enhance fans' satisfaction while watching the games.

Dynamic Analysis of a Pitched-Baseball Trajectory Using Aerodynamic Theory
A baseball in flight is mainly affected by the gravitational force  ⃗ , force of air resistance  ⃗ , and Magnus force  ⃗ , as shown in Figure 1.To simplify the calculation, this study has ignored the influence of the wind direction on the baseball.The boundary-layer theory proposed by Ludwig Prandtl describes the interaction between a flying baseball and air [6].When air flows across the surface of the baseball, friction occurs.As air is a viscous fluid, the velocity gradually decreases to zero as it approaches the surface of the baseball, and the area in which this happens is called the The boundary-layer theory proposed by Ludwig Prandtl describes the interaction between a flying baseball and air [6].When air flows across the surface of the baseball, friction occurs.As air is a viscous fluid, the velocity gradually decreases to zero as it approaches the surface of the baseball, and the area in which this happens is called the boundary layer.Due to the viscous force within the boundary layer, Bernoulli's principle is not applicable.The flow outside the boundary layer is closer to the inviscid flow and can be regarded as an ideal fluid to which the Bernoulli's principle can be applied.As shown in Figure 2, the green area is the boundary layer, and the line segment is the fluid streamline.According to Bernoulli's principle, the fluid velocity from A to B (or A to D) increases outside the boundary layer, and the fluid velocity from B to C (or D to C) decreases.It can be seen that points A and C are high-pressure points, and points B and D are low-pressure points.When the pressure difference is sufficiently large, the boundary layer flows back and creates a separation point, and boundary-layer separation occurs from B to C (or D to C).As shown in Figure 2, the fluid instability after the separation point (points B and D) is called turbulent flow.Compared to the entire flow field, the turbulent flow is a low-pressure area.The pressure difference between the turbulent flow area and the rest of the flow field is the main cause of the air resistance.The air resistance is in the opposite direction of the baseball flight, and through dimensional analysis [4] the baseball air resistance formula is obtained as where C D is the drag coefficient, ρ is the air density, A is the cross-sectional area of the baseball, and v is the ball speed.The value of the drag coefficient C D is 0.3 from a wind tunnel experiment [28].
where  is the drag coefficient,  is the air density,  is the cross-sectional area of the baseball, and  is the ball speed.The value of the drag coefficient  is 0.3 from a wind tunnel experiment [28].According to fluid mechanics [4], it can be assumed that the flying baseball is a rotating cylinder placed in a fluid field.As the real fluid is viscous, the fluid in contact with the rotating cylinder exhibits the same rotational speed as that of the cylinder, as shown in Figure 3.In Figure 3, according to Bernoulli's principle, the flow velocity increases, and the pressure decreases above the ball and vice versa below the ball, assuming that the baseball is rotating clockwise.This pressure difference causes the ball to shift upwards, and this phenomenon is the Magnus force effect.For a flying baseball, a Magnus force effect is generated when the sphere rotates.Although the complicated interaction between the seams of the baseball and the boundary layer causes the Magnus force to change over time, it can be averaged according to the Magnus force formula as follows [29]: where  is the Magnus coefficient,  is the angular velocity,  = is the spin parameter, and  is the radius of the baseball.According to fluid mechanics [4], it can be assumed that the flying baseball is a rotating cylinder placed in a fluid field.As the real fluid is viscous, the fluid in contact with the rotating cylinder exhibits the same rotational speed as that of the cylinder, as shown in Figure 3.In Figure 3, according to Bernoulli's principle, the flow velocity increases, and the pressure decreases above the ball and vice versa below the ball, assuming that the baseball is rotating clockwise.This pressure difference causes the ball to shift upwards, and this phenomenon is the Magnus force effect.For a flying baseball, a Magnus force effect is generated when the sphere rotates.Although the complicated interaction between the seams of the baseball and the boundary layer causes the Magnus force to change over time, it can be averaged according to the Magnus force formula as follows [29]: where C M is the Magnus coefficient, ω is the angular velocity, S = Rω v is the spin parameter, and R is the radius of the baseball.The pitching image angle provided by the broadcasting unit camera makes the analyses of the horizontal displacement of the baseball flight and the baseball rotation axis very different.Therefore, this study assumed that the rotation axis of the baseball is horizontal and has only analyzed the types of baseballs that have been subjected to vertical displacement, including four-seam fastballs, forkballs, and change-up balls, and then analyzed the flying force of the baseballs in a two-dimensional plane.The viewing angle and position of the pitching image based on the broadcast unit were fixed.This study assumed that the x-axis is in the rightmost connection direction, and the y-axis is in the vertical direction in the image of the pitcher board and the home plate (Figure 4).In addition, we defined the rightmost point of the pitcher board as the origin of the image coordinate system, as shown in Figure 4. Therefore, the baseball force is: where  is the weight of the ball,  is the acceleration due to gravity, and  = tan is the pitch angle.The coordinates of the baseball at the throw point of the pitcher are ( ,  ). ,  and  ,  are the flight distances and heights of the ball at  and  , respectively.The pitching image angle provided by the broadcasting unit camera makes the analyses of the horizontal displacement of the baseball flight and the baseball rotation axis very different.Therefore, this study assumed that the rotation axis of the baseball is horizontal and has only analyzed the types of baseballs that have been subjected to vertical displacement, including four-seam fastballs, forkballs, and change-up balls, and then analyzed the flying force of the baseballs in a two-dimensional plane.The viewing angle and position of the pitching image based on the broadcast unit were fixed.This study assumed that the x-axis is in the rightmost connection direction, and the y-axis is in the vertical direction in the image of the pitcher board and the home plate (Figure 4).In addition, we defined the rightmost point of the pitcher board as the origin of the image coordinate system, as shown in Figure 4. Therefore, the baseball force is: where m is the weight of the ball, g is the acceleration due to gravity, and θ = tan −1 y 2 −y 1 x 2 −x 1 is the pitch angle.The coordinates of the baseball at the throw point of the pitcher are (x 1 , y 1 ).x 1 , y 1 and x 2 , y 2 are the flight distances and heights of the ball at t 1 and t 2 , respectively.The pitching image angle provided by the broadcasting unit camera makes the analyses of the horizontal displacement of the baseball flight and the baseball rotation axis very different.Therefore, this study assumed that the rotation axis of the baseball is horizontal and has only analyzed the types of baseballs that have been subjected to vertical displacement, including four-seam fastballs, forkballs, and change-up balls, and then analyzed the flying force of the baseballs in a two-dimensional plane.The viewing angle and position of the pitching image based on the broadcast unit were fixed.This study assumed that the x-axis is in the rightmost connection direction, and the y-axis is in the vertical direction in the image of the pitcher board and the home plate (Figure 4).In addition, we defined the rightmost point of the pitcher board as the origin of the image coordinate system, as shown in Figure 4. Therefore, the baseball force is: where  is the weight of the ball,  is the acceleration due to gravity, and  = tan is the pitch angle.The coordinates of the baseball at the throw point of the pitcher are ( ,  ). ,  and  ,  are the flight distances and heights of the ball at  and  , respectively.As this study only considers the Magnus force effect in the y-direction, Equation ( 5) can be rewritten as where When the time is t, the average acceleration, velocity, and displacement in the y-direction caused by air resistance and gravity are as follows: In addition, the average acceleration, velocity, and displacement in the y-direction caused by the Magnus force are as follows: Finally, this study used deep learning algorithms to recognize the baseball and calculated the y-axis displacement ∆y (late break) between the pitcher's throw and the catcher's catch from the broadcast unit image as follows: As y Dg can be obtained from Equation ( 9), y M y can be obtained using Equation (13).Finally, from Equations ( 2), (3), and (10) to (12), the angular velocity ω of the flying baseball can be obtained as follows: The average ball speed v A of the baseball flight between time t i (when thrown by the pitcher) and t e (when received by the catcher) can be obtained as follows: where x i is the x-axis coordinate of the pitcher throw, x e is the x-axis coordinate of the catcher receive, and this study assumed that x e − x i is the distance from the pitcher board to the home plate (18.44 m).

Recognition of a Pitched-Baseball Trajectory by Deep Learning Algorithm
To analyze the results of the ball speed and spin rate of the baseball through aerodynamic theory, this study used the YOLOv3 deep learning algorithm to recognize the baseball and its flight trajectory.YOLOv3, the third generation of YOLO, has the advantages of the previous generations' algorithms and has an updated multi-scale detection function and a more powerful feature extraction network.Therefore, it can detect objects of different scales simultaneously, thereby improving the accuracy and performance.The YOLOv3 algorithm is divided into the following two major parts [17]: (1) feature extraction and (2) multi-scale detection.The architecture of YOLOv3 is illustrated in Figure 5.The feature extractor of YOLOv3 is Darknet-53, which was modified from Darknet-19 used by YOLOv2 [30].Using the concepts of residual network, ResNet, and residual learning, it avoids the gradient diminishing problem by increasing the number of network layers for more complex feature extraction.In the multi-scale detection portion, YOLOv3 uses feature pyramid networks (FPNs) upgraded from the original single-layer 13 × 13 feature prediction network to a three-layer 13 × 13, 26 × 26, and 52 × 52 feature prediction network.The single layer of five bounding boxes is changed to three layers of three bounding boxes each, which is equivalent to a total of nine bounding boxes.The FPN architecture merges the better target at the lower level with the better semantic features at the higher level and makes independent predictions at different feature levels, showing an obvious improvement in small object detection.YOLOv4 [24][25][26] utilizes a spatial pyramid pooling and path aggregation network to improve the performance of YOLOv3.
However, because the baseball thrown by the pitcher is fast and live-action TV videos like sports and concerts are typically at least 24 fps or more [27], this study used YOLOv3tiny algorithm to speed up the calculation [18].To speed up the calculation, this study further used YOLOv3-tiny to recognize the baseball and its flight trajectory.YOLOv3-tiny is a simplified version of YOLOv3, as shown in Figure 6.The backbone network of Darknet-53 is simplified to a network similar to that of Darknet-19, and the 52 × 52 small object prediction branch and its feature layer have been omitted, leaving only two independent prediction branches.Although the accuracy is not as high as that of YOLOv3 and YOLOv4, the calculation becomes extremely fast [19,23,26].The efficiency and accuracy of the calculation were sufficient for the identification and tracking of the baseballs used in this study.In the next section, this study has compared the performance of models trained by YOLOv3 and YOLOv4 with that of a model trained by YOLOv3-tiny algorithm.In the multi-scale detection portion, YOLOv3 uses feature pyramid networks (FPNs) upgraded from the original single-layer 13 × 13 feature prediction network to a three-layer 13 × 13, 26 × 26, and 52 × 52 feature prediction network.The single layer of five bounding boxes is changed to three layers of three bounding boxes each, which is equivalent to a total of nine bounding boxes.The FPN architecture merges the better target at the lower level with the better semantic features at the higher level and makes independent predictions at different feature levels, showing an obvious improvement in small object detection.YOLOv4 [24][25][26] utilizes a spatial pyramid pooling and path aggregation network to improve the performance of YOLOv3.
However, because the baseball thrown by the pitcher is fast and live-action TV videos like sports and concerts are typically at least 24 fps or more [27], this study used YOLOv3tiny algorithm to speed up the calculation [18].To speed up the calculation, this study further used YOLOv3-tiny to recognize the baseball and its flight trajectory.YOLOv3tiny is a simplified version of YOLOv3, as shown in Figure 6.The backbone network of Darknet-53 is simplified to a network similar to that of Darknet-19, and the 52 × 52 small object prediction branch and its feature layer have been omitted, leaving only two independent prediction branches.Although the accuracy is not as high as that of YOLOv3 and YOLOv4, the calculation becomes extremely fast [19,23,26].The efficiency and accuracy of the calculation were sufficient for the identification and tracking of the baseballs used in this study.In the next section, this study has compared the performance of models trained by YOLOv3 and YOLOv4 with that of a model trained by YOLOv3-tiny algorithm.

Experiments
To use the deep-learning algorithm to recognize the baseball and its flight trajectory, this study used 485 screenshots of the baseball TV broadcast.Among them, 80% of the screenshots (388 sheets) were randomly selected as training data sets, and the remaining 20% (97 sheets) were used for verification.In addition, this study sets the hyperparameters to a learning rate of 0.001, a mini-batch size of 64, a momentum of 0.9, and weight decay of 0.0005.First, the size of the input image was adjusted.As the resolution increases, the detection of small objects improves, but the computational load increases, and the computational speed decreases during training.Therefore, this study used a 416 × 416-pixel (referred to as the tiny-416 model) and a 608 × 608-pixel (referred to as the tiny-6081 model) resolution to analyze the baseball recognition capability by YOLOv3-tiny.Moreover, the intersection over union (IoU) and mean average precision (mAP) were used to compare and analyze the accuracy [20,24,25,31,32].IoU is the intersection of the combined points of the predicted and actual frames.In this study, the object was considered to be successfully recognized when the IoU was greater than 0.5.Additionally, the calculations of mAP, Precision, Recall, and F1-score based on the IoU of 0.5 is as follows: where  is the target type.AP is where N is the number of pictures.Precision, recall, and F1-score are expressed as

Experiments
To use the deep-learning algorithm to recognize the baseball and its flight trajectory, this study used 485 screenshots of the baseball TV broadcast.Among them, 80% of the screenshots (388 sheets) were randomly selected as training data sets, and the remaining 20% (97 sheets) were used for verification.In addition, this study sets the hyperparameters to a learning rate of 0.001, a mini-batch size of 64, a momentum of 0.9, and weight decay of 0.0005.First, the size of the input image was adjusted.As the resolution increases, the detection of small objects improves, but the computational load increases, and the computational speed decreases during training.Therefore, this study used a 416 × 416-pixel (referred to as the tiny-416 model) and a 608 × 608-pixel (referred to as the tiny-6081 model) resolution to analyze the baseball recognition capability by YOLOv3-tiny.Moreover, the intersection over union (IoU) and mean average precision (mAP) were used to compare and analyze the accuracy [20,24,25,31,32].IoU is the intersection of the combined points of the predicted and actual frames.In this study, the object was considered to be successfully recognized when the IoU was greater than 0.5.Additionally, the calculations of mAP, Precision, Recall, and F1-score based on the IoU of 0.5 is as follows: where N C is the target type.AP is where N is the number of pictures.Precision, recall, and F1-score are expressed as where TP is a positive sample that is correctly classified, FP is a positive sample that is misclassified, and FN is a negative sample that is misclassified.  1 show that the IoU, precision, recall, F1-score, and mPA of the v3-416, v3-608, and v4-608 models are better than those of the tiny-6082 model.Moreover, the performance of the v4-608 model by YOLOv4 is the best of all models in Table 1.However, the execution speed of the tiny-6082 model is approximately 2.5 times that of the v3-416, v3-608, and v4-608 models.Additionally, the execution speeds of the v3-416, v3-608, and v4-608 models perform below 20 fps.Live-action TV videos like sports and concerts are typically at least 24 fps or more [27].Therefore, this study utilized the tiny-6082 model with an image resolution of 608 × 608 pixels and 12,000 epochs of training set to complete the recognition of the baseball and its flight trajectory.Python software was used to analyze 30 testing videos of a pitched baseball using the YOLOv3-tiny deep learning algorithm for flight trajectory, ball speed, and spin rate, as shown in Figure 7. First, after importing the video, the program defined the coordinate system of the video.Second, baseballs were recognized using the YOLOv3-tiny algorithm.After the pitcher throws the ball, the coordinate of the first recognized baseball object was recorded and presented as a point on the video screen.Third, the baseball was recognized at subsequent points in its trajectory in sequence.The coordinate of each recognized baseball position was marked, and all the points were connected with a line to complete the presentation of the ball flight trajectory.Fourth, according to the coordinates of the baseball positions recorded in each frame, the program started to find the point where the baseball was captured (captured point) when the number of recorded points was greater than five.When the coordinates of the baseball were observed to be the same for five consecutive frames, the program determined it as the captured point.Finally, the ball speed and spin rate were calculated using the aerodynamic theory and physical parameters (Table 2) of the pitched baseball, and they were presented on the screen to complete the calculation and recording of the pitched-baseball flight trajectory, vertical displacement, ball speed, and spin rate.

Results and Discussion
To obtain a comparative standard value for the measurement data of the pitcher's ball speed and spin rate, this study used 30 home-game videos of the Fukuoka Softbank HAWKS baseball team, including real-time displays of the ball speed and spin rate by the Fox Networks Group.The testing videos of the pitched baseballs included four-seam fastballs, forkballs, and change-up balls.This automatic measurement and analysis system of pitched-baseball trajectories showed the pitch angle, speed, spin rate, vertical movement, and other information of the flying baseball in real time.Moreover, this study made a numerical comparison of the measurement results with the ball speed and spin rate provided by the broadcasting unit, and the related automatic measurement results are shown in Figures 8-10 and Table 3.In Figures 8-10 10, because the ball was flying between a red billboard and green grass when the ball in the video was recognized.According to the measurement results in Table 3, this algorithm accurately recorded the trajectory of the ball.The average error of the measured ball speed was 1.88% with a standard deviation of 1.16, and the average error of the measured spin rate was 7.51% with a standard deviation of 4.33.According to Equation ( 15), the ball speed estimation method in this study is related to the of frames per second (fps) of the video.The test video in this study was at 30 fps, and the single-frame interval was 0.0334 s.Errors between the measured ball speed and the actual ball speed are due to the minimum measurement resolution of the time parameter in the denominator of Equation (15).In addition, the spin rate estimation using Equation ( 14) and the pitch angle have a significant correlation.The detection of the ball at the moment of the pitcher's throw can easily cause a sensing error, which causes an error in the calculation of the pitch angle, ultimately leading to an error between the measured spin rate and the actual spin rate.In addition, as seen from the measured results in Table 3, the ball speeds of the four-seam fastballs are in the range of 145-154 km/h, and the spin rates are the highest among the three pitch types, ranging from 2082 to 2477 rpm.Moreover, the Magnus displacements are between 0.64 and 0.72 m in the upward direction.The ball speeds of the forkballs are between 134 and 144 km/h, the spin rates are between 976 and 1515 rpm, and the Magnus displacements are between 0.45 and 0.58 m in the upward direction, which were the smallest among the three pitch types.Due to the downward displacement caused by air resistance and gravity, a small Magnus displacement results in a large downward displacement of the forkball.Finally, for the change-up ball, the ball speeds are between 133 and 138 km/h (slowest among the three pitch types), the spin rates are between 1539 and 2009 rpm, and the Magnus displacements are between 0.59 and 0.69 m in the upward direction.From Table 3 and Equation ( 13) it is clear that the smaller the Magnus displacement of the ball, the larger the longitudinal displacement when the ball reaches home base.This also means that there is a larger late break.According to Equations ( 10)-( 12), the Magnus displacement is related not only to the physical parameters of the baseball, but also, more importantly, to the pitch angle, ball speed, and spin rate.Therefore, according to the Magnus displacements, ball speeds, spin rates listed in Table 3, and a least-square fitting algorithm from IEEE Standards [33], the curve-fitting equation between the Magnus displacement and ball speed was obtained with a coefficient of determination (R2) of 0.30.Furthermore, the curve-fitting equation between the Magnus displacement and spin rate was also obtained with an R2 of 0.71, showing a positive correlation between the Magnus displacement and spin rate.As the pitching skill of every pitcher is different, the spin rate of the ball may be different for different pitchers even for the same pitch types and ball speed.Therefore, in this study, the spin rate was divided by the ball speed, and the curve fitting of this ratio was done with the Magnus displacement.The curve-fitting equation [33] between the Magnus displacement and the ratio of the spin rate to the ball speed was obtained with an R2 of 0.78.Compared to the spin rate alone, the ratio of the spin rate to the ball speed was found to be more positively correlated with the Magnus displacement.For this reason, this ratio was a more effective parameter for analyzing the late break of the pitcher.This study analyzed the Nippon Professional Baseball (NPB) match between the Tohoku Rakuten Golden Eagles and the Fukuoka Softbank HAWKS baseball team on 6 October 2019.Furthermore, this technology was used to analyze the pitching state of the four-seam fastball of the starting pitcher (Manabu Mima), as shown in Table 4. Manabu Mima pitched a total of four innings in this game using 62 balls.The speeds of his four-seam fastballs were between 137 and 147 km/h, and the spin rates were between 2219 and 2495 rpm.The parameter of the spin rate to ball speed ratio was between 15.10 and 18.21.According to the results of the previous discussion, the smaller this parameter, the larger the late break phenomenon.Therefore, according to the results in Table 4, this parameter for Manabu Mima increases in the fourseam fastballs from the 27th to 48th ball, which also means that the late break of this pitcher decreases.According to the actual game situation of the 27th to 48th ball (in the third inning), Manabu Mima lost three points in this inning.Additionally, this study analyzed the MLB matches on 14 and 18 April 2022, respectively, as shown in Tables 5 and 6.Shohei Ohtani (the starting pitcher of the Los Angeles Angels baseball team) pitched a total of 3.2 innings in this game using 70 balls in the match on 14 April 2022.The speeds of his four-seam fastballs were between 154 and 158 km/h, and the spin rates were between 2157 and 2395 rpm.The parameter of the spin rate to ball speed ratio was between 13.93 and 15.59.According to the results Table 5, this parameter for Shohei Ohtani increases in the four-seam fastballs from the 10th to the 36th ball and after the 62nd ball, which also means that the late break of this pitcher decreases.According to the actual game situations of the 10th to 36th ball (in the second inning) and the 62th to 70th ball (in the fourth inning), Shohei Ohtani lost four and two points in the second and fourth innings, respectively.In the match on 18 April 2022, Clayton Kershaw (the starting pitcher of the Los Angeles Dodgers baseball team) pitched a total of 5 innings in this game using 87 balls.The speeds of his four-seam fastballs were between 143 and 146 km/h, and the spin rates were between 2310 and 2467 rpm.The parameter of the spin rate to ball speed ratio was between 16.01 and 17.23.According to the results in Table 6, this parameter for Clayton Kershaw increases in the four-seam fastballs from the 59th to 81se ball, which also means that the late break of this pitcher decreases.According to the actual game situation of the 59th to 81st ball (from the fifth to sixth innings), Clayton Kershaw lost one and three points in the fifth and sixth innings, respectively.Therefore, it was verified through the parameter of the spin rate to ball speed ratio that the late break of the pitcher became smaller, thereby reducing the power of pitching.

Conclusions
In this study, pitched-baseball characteristics were analyzed to observe the effects of Magnus force on a pitched-baseball trajectory from TV broadcast videos using the aerodynamic theory.Moreover, an automatic measurement and analysis system was established by YOLOv3-tiny for the pitched-baseball trajectories, speeds, and spin rates.Finally, a system was used to automatically present pitching data, such as the throw point, catch point, pitch angle, ball speed, spin rate, vertical displacement, and ball trajectory on the screen.According to the results of 30 testing videos of pitched baseballs, this system fully grasped the baseball trajectories, throw points, catch points, and vertical displacements.The average errors of the measured ball speeds and spin rates were 1.88% and 7.51%, respectively, compared to the values of the ball speeds and spin rates provided by the TV broadcast.In addition, this study used the ratio of the spin rate to the ball speed as a parameter to analyze the pitching state of the pitcher's four-seam fastballs.It can be seen from the results of the NPB and MLB matches that when this parameter increased, the Magnus displacement of the ball also increased, thereby decreasing its late break.As a result, the spin rate to ball speed ratio verified that the late break of the pitcher became smaller, and thus the power of pitching reduced.Using system, pitching information in the baseball game was easily obtained and recorded for further discussion.The system developed in this study provides scientific pitching data to improve the performance of baseball pitchers.

A
baseball in flight is mainly affected by the gravitational force → F g , force of air resistance → F D , and Magnus force → F M , as shown in Figure 1.To simplify the calculation, this study has ignored the influence of the wind direction on the baseball.

Figure 1 .
Figure 1.Force analysis during baseball flight.

Figure 1 .
Figure 1.Force analysis during baseball flight.
boundary layer.Due to the viscous force within the boundary layer, Bernoulli's principle is not applicable.The flow outside the boundary layer is closer to the inviscid flow and can be regarded as an ideal fluid to which the Bernoulli's principle can be applied.As shown in Figure2, the green area is the boundary layer, and the line segment is the fluid streamline.According to Bernoulli's principle, the fluid velocity from A to B (or A to D) increases outside the boundary layer, and the fluid velocity from B to C (or D to C) decreases.It can be seen that points A and C are high-pressure points, and points B and D are low-pressure points.When the pressure difference is sufficiently large, the boundary layer flows back and creates a separation point, and boundary-layer separation occurs from B to C (or D to C).As shown in Figure2, the fluid instability after the separation point (points B and D) is called turbulent flow.Compared to the entire flow field, the turbulent flow is a low-pressure area.The pressure difference between the turbulent flow area and the rest of the flow field is the main cause of the air resistance.The air resistance is in the opposite direction of the baseball flight, and through dimensional analysis[4] the baseball air resistance formula is obtained as

Figure 2 .
Figure 2. Analysis of Ludwig Prandtl's boundary-layer theory during baseball flight.

Figure 2 .
Figure 2. Analysis of Ludwig Prandtl's boundary-layer theory during baseball flight.

Figure 4 .
Figure 4. Schematic of the baseball flight at (a)  and (b)  .

Figure 3 .
Figure 3. Magnus force effect during baseball flight.

Figure 3 .
Figure 3. Magnus force effect during baseball flight.

Figure 4 .
Figure 4. Schematic of the baseball flight at (a)  and (b)  .

Figure 4 .
Figure 4. Schematic of the baseball flight at (a) t 1 and (b) t 2 .
, the measurement results of this study are shown in the upper left corner, and the measurement results of the broadcast unit are shown in the lower right corner.The trajectories and the coordinates of the throw point and catch point of the pitched baseball are represented for four-seam fastball, forkball, and change-up ball in Figures 8-10, respectively.The three bounding boxes with classification confidences and coordinates of the ball by YOLOv3-tiny in the trajectory of pitched baseball are depicted in Figures 8-10, respectively.Most values of classification confidence in this study are close to 100%.However, the worst classification confidence of 69.1% is presented in Figure

Figure 8 .
Figure 8. Automatic measurement result for a four-seam fastball.Figure 8. Automatic measurement result for a four-seam fastball.

Figure 8 .
Figure 8. Automatic measurement result for a four-seam fastball.Figure 8. Automatic measurement result for a four-seam fastball.

Figure 8 .Figure 9 .
Figure 8. Automatic measurement result for a four-seam

Figure 9 .
Figure 9. Automatic measurement result for a forkball.Figure 9. Automatic measurement result for a forkball.

Figure 10 .
Figure 10.Automatic measurement result for a change-up ball.

Figure 10 .
Figure 10.Automatic measurement result for a change-up ball.
Regarding the tiny-416 and tiny-6081 models, based on the results of 6000 epochs of training experiments, it is clear that the IoU, precision, recall, F1-score, and mAP of the tiny-6081 model are better than those of the tiny-416 model, as shown in Table1.This verifies that the larger the resolution of the picture, the better the recognition of the small objects.In addition, the number of training epochs is positively correlated with accuracy, but numerous monotonic samples may lead to overfitting, making it difficult to identify images that are not in the training set.Therefore, this study adjusted the number of training epochs from 6000 (tiny-6081 model) to 12,000 (tiny-6082 model) in the initial training by YOLOv3-tiny.Table1shows that the IoU, precision, recall, F1-score, and mPA of the tiny-6082 model are better than those of the tiny-6081 model.In addition to using YOLOv3-tiny, this study trained a model using YOLOv3 as well for comparison purposes.In the comparative experiment, the input image was trained with 12,000 epochs at the 416 × 416 (v3-416 model) and 608 × 608 (v3-608 model) resolutions by YOLOv3, and the 608 × 608 (v4-608 model) resolution by YOLOv4.The training results in Table

Table 1 .
Results of the network test comparison.

Table 1 .
Results of the network test comparison.

Table 2 .
Physical parameters of a pitched baseball.

Table 3 .
Measurement results of the pitched-baseball trajectories.

Table 3 .
Measurement results of the pitched-baseball trajectories.

Table 4 .
Pitching state analysis of four-seam fastballs by Manabu Mima.

Table 5 .
Pitching state analysis of four-seam fastballs by Shohei Ohtani.

Table 6 .
Pitching state analysis of four-seam fastballs by Clayton Kershaw.