In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use OpenCV and Tensorflow to track the trajectory of volleyball. I hope you will get something after reading this article. Let's discuss it together.
Volleyball is a complex sport with many different aspects. So I started with a very small but very important part-the ball.
Tracking the ball is a very famous task. Google provides a lot of links, but many of them are just a simple demonstration. Obviously, identifying and tracking a large colored ball in front of the camera cannot be compared with the real game ball detection, because the real world ball is small, moving fast, and integrated into the background.
Finally, we want to get the following results:
Before we begin, let's take a look at some details of the video dataset:
The camera is stationary, located at the back of the field
The players are not so skilled, and we are free to see the ball (professionals hit the ball so hard that it is almost impossible to see the ball without TV playback)
The color of the ball: blue and yellow, with little contrast to the floor. This makes all color-based methods meaningless.
Solution
By far the most obvious method-- using color-- doesn't work. I'm using a ball that's moving.
Let's find the moving object and recognize it as a ball. It sounds simple.
OpenCV contains tools for detecting moving objects with background removal:
Mask = backSub.apply (frame) mask = cv.dilate (mask, None) mask = cv.GaussianBlur (mask, (15,15), 0) ret,mask = cv.threshold (mask,0,255,cv.THRESH_BINARY | cv.THRESH_OTSU)
Put a picture like this
Convert to:
In this case, the ball is on top and can be easily detected by the human brain and eyes. How did we decide? Some rules can be inferred from the diagram:
The ball is round in shape
This is the highest spot in the picture.
The second rule doesn't work very well. For example, in this picture, the highest spot is the referee's shoulder.
But the highest-blob method provides further initial data.
We can collect these spots and train classifiers to distinguish balls.
This dataset is as follows:
In terms of artificial intelligence-this is a binary color image, very similar to the Cats-vs-Dogs challenge.
Cats-vs-Dogs: https://www.kaggle.com/c/dogs-vs-cats
There are many ways to implement it, but the most popular one is to use VGG neural network.
VGG neural network: https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
One problem-the picture of the ball is too small to use multiple convolution layers. So I had to simplify VGG to a very simple architecture:
Model = Sequential ([Convolution2D (32, (3)), activation='relu', input_shape=input_shape), MaxPooling2D (), Convolution2D (64, (3), activation='relu'), MaxPooling2D (), Flatten (), Dense (64, activation='relu'), Dropout (0. 1), Dense (2, activation='softmax')]) model.compile (loss= "categorical_crossentropy" Optimizer=SGD (lr=0.01), metrics= ["accuracy"])
The model is simple and the results are general: about 20% of false positives and 30% of false negatives.
It's better than nothing, of course, it's not enough.
The model applied to the game produces a lot of "match-fixing":
There are actually two kinds of match-fixing:
They appear at random positions in random time.
This model always makes mistakes and treats everything else as a ball.
Locus
Next, there is an idea that the ball does not move randomly, but follows a parabola or linear trajectory.
Verifying the motion of water droplets on this geometry will cut off random and consistent errors.
Here is an example of recording the trajectory of a play:
The directed path is blue, the static path is green, and the random path is gray.
Only blue tracks are useful. They consist of at least three points and have one direction. Direction is important because the next point can be predicted in case it is lost in the actual flow and no new path is detected.
This logic is applied to the fragment to produce a fairly realistic trace:
After reading this article, I believe you have a certain understanding of "how to use OpenCV and Tensorflow to track the trajectory of volleyball". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.