Predict penalty kick in soccer by python. 1- Collecting the data.

Ahmed Abdallah
3 min readNov 30, 2019

As someone who is playing football, I always want to improve my abilities in penalty kicks. If I could predict the perfect acceleration, speed, and angle, which I should train myself on to improve myself in penalty kicks.

Football background

Let’s do some definitions for the people who don’t follow football(soccer). A penalty kick is awarded if a player commits a direct free kick offense inside their penalty area or off the field.

It highly depends on the skill of the player and how lucky he is. As easy as it seems, it is a difficult moment for both the player and the team, especially if it champion or world cup.

Physics background

I only need your high school physics to illustrate the idea of the data collected. We will gonna collect the acceleration, velocity, and angle of the ball.

Let’s review some fundamental understanding of some kinematics.

Displacement is the change in the position of the object. That is, displacement is how far the object is from its starting point. Our object is the ball. Our starting point is the spot of the penalty kick. All we need to know the magnitude and the direction of the distance to know the velocity.

Velocity is the displacement traveled along its path divided by the time it takes to travel this displacement.

Acceleration is defined as the change in velocity divided by the time taken to make this change. An object whose velocity is changing is said to be accelerating. For instance, a car whose velocity increases in magnitude from zero to 80 km/h is accelerating.

Collecting the data.

As there are not any datasets available, we have to collect the data by ourselves. Our source of data will gonna by youtube. I am going to download the videos of the WorldCup penalty shootout of different years. You don’t have to stick with one video, more penalty shootout you will collect more accurate your results will be.

Examples of videos I am going to use:

After finding the videos and download them. We have to collect the data. As it is hard to find the displacement, velocity, acceleration, and angle by human eye we will be going to use a software called tracker.

Tracker is a free video analysis and modeling tool(I use it for my physics IAs :O)).

Software: https://physlets.org/tracker/

The software is available for any operating system if you are Linux, windows, mac user.

A Useful tutorial:

https://www.youtube.com/watch?v=n4Eqy60yYUY

The dataset that I collected is available on GitHub: https://github.com/ahmed100553/Predicting-Scoring-Penalities-Kicks/blob/master/Scoring.csv

Thank You. See you in the next part

GitHub: https://github.com/ahmed100553

--

--

Ahmed Abdallah

A undergraduate student and a research assistant at a university of Oklahoma. Interested in ML, I spend my free time reading philosophy and economics.