REGISTER NOW & GET MORE THAN 40% OFF! First, we wanted to share with you this great deal that we have released. We’ve set one of
Data driven video analysis (DDVA) allows you to do coding and telestrating of a game programmatically. You can detect relevant moments of the game, create an event each time one of them happens and even telestrate/annotate them, everything by just running a script/analysis over the data of your game.
While DDVA does not replace traditional video analysis, it is a great way for data analysis departments to transfer their findings from a table to the video. You can thus meet the coaches and video analysis staff right where they usually do their work!
Play by Metrica Sports is the only platform that allows you to do this.
DDVA with Play
Traditionally in video analysis you would “code” a game. You define Codes, each one of which represents a certain tactical concept or action that is of relevance, and then you watch the game and every time one of those Codes happen in the game, you create an event.
In Play by Metrica Sports, a Pattern is similar to a Code in the sense that it represents a certain tactical concept or action that could happen during the game that a video analyst or coach is interested in. However, there are two main differences with a traditional Code:
- They are programmatically defined via a programming language (no manual coding)
- They can include programmatically created annotations.
- They can include programmatically created 2D (auxiliary field) visualizations.
For example, suppose one of the things a coach/analyst wants to look after each game is passes into the box made by their own team. With regular coding this would take a considerable amount of time after each game. Using Patterns, you can create a script that runs through the data after each game and finds all passes into the box and created an event for each one of them. Not only that, you can also programmatically (from the same script) add, at the moment of the pass, a pause and an arrow annotation indicating the pass start and finish, so that the content is easier to digest / more didactic. Finally, you can also add a 2D visualization on the auxiliary field to quickly sort through the passes of interest.
Or suppose that a coach wants to look at all the moments their team is too stretched (more than 35m) while defending. It’s impossible to correctly do this based on the naked eye. However, using a Pattern (we can call this the Team Stretched patterns) not only can you programmatically detect all the moments in a game that happens, but you can also add a team length visualizations to be able to see the actual length of the team.
The cool thing about doing DDVA with Play, is that you can define this patterns and what annotations/visualizations should go on each event simply from a json file (the “patterns file”) with a specific formatting. For example to define an event of the Team Stretched pattern, you would specify the following in the patterns file:
We’ll look into the details of this file and the formatting below, but for now you can see that there are some value (start_time, end_time) that relate to the moment in the game in which this event takes place, and there is also a section where the visualizations are defined.
That’s the power of Play for DDVA. You can access all the visualizations available in Play and create telestrated events just by defining them in a file that you later import into the platform.
How can you do this?
The process of creating your own Patterns and seeing them in Play as shown above consists of three steps:
- Detecting the relevant events
- Creating the Patterns File
- Getting that file into Play
Detecting the events
This step is about detecting the moments of the game in which a certain occurrence of a Pattern (an Event) takes place. This is composed of two elements:
- Defining the patterns
- Writing the code
Defining the patterns
The same way you define what a Code is on standard video analysis, you need to first define what are the tactical concepts or actions that will define a pattern. We have seen two so far:
- A pass into the box
- The team stretched more than 35 meters while defending.
These are just 2 very simple examples, but the options are limitless. In the above examples we do not have labels/subcategories, but there is support in Play for that as well. As long as the data you have available has the information you need, then you can define a pattern around it. We’ll see some pattern examples later on.
You can run analysis that identify events of patterns you are interested in based on any data you have available (this means identifying the start and end time of the events, as well as their coordinates if applicable). You can also add non-player based visualizations based on any data (for example an arrow, a pause, a highlighted area in the field, etc.)
However, if you also want to programmatically add player based visualization (spotlight, future trail, etc.), or player and teams tags, you need to use tracking data that comes from the Video Project in Cloud. This tracking data could come from 3 sources:
- It could come as part of the Elite data we provide (tracking data provided by us)
- It could come from integrating 3rd party data into the Video Project (Tracab, Stats, etc.)
- It could be the Automated Tracking Data that’s processed for every video uploaded.
This is the case because in order to for example put a spotlight on a player, you need to indicate the player ID and that needs to come from the data available in the Video Project (see section below on Players and Teams IDs).
You can combine this tracking data with any event data you want, like our Elite events, or Statsbomb, etc. to be able to process more complex patterns.
Writing the code
Once you have defined what constitutes a pattern, the next step is to code the scripts or analysis suit to identify them in the data, and to later on create the Patterns File (see below). We will later suggest some libraries you can use, but it’s important to note here that there are really no requisites on the coding language you need to use to do this.
The only thing that matters is that the output of the process (the Patterns File) complies with the format requirements, but since the file itself is a json file, you can get there using any language you want (python, R, Matlab, etc.).
To be able to define Patterns with their corresponding Events with Annotations, you need to import into the Video Project a patterns file. This file is a
.json file with a specific formatting.
All the details about the formatting of the Patterns file can be found here. There you can find how to define new Pattern in the file, how to define tags and tags groups, the different type of visualizations you can use and the parameters they have, etc.
Here is an example patterns file that defines one pattern and 3 events that belong to it, each one with a different visualization.
To try uploading this exact file to Play you need to:
- Get the Sample Game 3 into your database (see below)
- Change where it says ORGPREFIX for the prefix of your organization. You can find that prefix on the setting section in cloud. Check out the demo video at 4m 30s for more details.
Team and player codes
While the codes for the patterns, tags and tags groups can be anything you want (meaning defined by the user) the player and team codes need to be the same from the data files of the Video Project. Once you have a game processed in Cloud (be it an Elite game with data we provided, a game that has data from a 3rd party synced, or Automated Tracking Data) you need to download the data in EPTS format from cloud, and check out the team and player IDs in that file (or you can also generate a database or use them from a database as long as they are the same ones that in the dat files)
- Certain number of players in the box where you can highlight players with a ring or spotlight.
- Full backs on the attacking 3rd where you can show their future trajectory once they cross the threshold.
- Cutback crosses, where you can highlight the receiver (or intended receiver) and an arrow indicating the pass.
- Compute best passing options and highlight the best three options with color in the rings indicating their standing.
- Identify deep runs taken or non taken where you pause the video and highlight there that was or could have been taken advantage of.
Getting that file into Play
Once you have created a patterns file, you can import it to Play via Metrica Cloud. To do so you need to select the Video Project you want to upload a file and upload it under the more options section (three dots all the way to the left of the Video Project). You’ll get a notification informing you if the upload was or wasn’t successful.
Once the file is uploaded, you can go to Play and download the Video Project from the DB Manager. If you already did that, you can:
- Select the Video Project in the Video manager, and then on Pattern Events more options select Retry download.
- Close and open the application again and will get a notification informing you there is a new file, and you can click directly there to download it.
If you had uploaded a file already and want to upload a new one, go to Cloud, delete the previously uploaded file and do any of the two steps described above.
Sample Game 3
We have a sample dataset for a game available so that you can try this out yourself with a test game!
In order to access it you need to do two things:
- Follow the instructions in this tutorial, use the key SAMPLEGAME3 to add the Video Project to your database.
- Go here to download the tracking and event data of that game.
Metrica Sports API
There is also a Metrica Sports API available which allows you to create Video Projects, upload videos, run player and field detection, synchronize third party data, download the data and upload patterns file all via the API without any need for interaction with Cloud’s UI. This is really powerful once a suite of patterns or analysis has been established. It allows you to create fully automated workflows! The API is an Elite feature. If you are interested in using it let us know!
While there is no requirement at all on the coding language that you can use to create the patterns file, if you code in python there are two open source libraries that we can suggest you check out.
Kloppy is a Python package providing (de)serializers for soccer tracking- and event data, standardized data models, filters, and transformers designed to make working with different tracking- and event data like a breeze. It aims to be the fundamental building blocks for loading, filtering and transforming tracking- and event data.
Each vendor of soccer data uses its own unique format to describe the course of a game. Hence, software written to analyze this data has to be tailored to a specific vendor and cannot be used without modifications to analyze data from other vendors. Kloppy is a Python package that addresses the challenges posed by the variety of data formats and aims to be the fundamental building block for processing soccer tracking and event data. It provides (de)serializers, standardized data models, filters, and transformers which make working with tracking and event data from different vendors a breeze.
With kloppy you can load into a standard format any data downloaded from a Video Project, as well as load from any other provider. This can save days of work in developing your own parsers for files of different companies. We highly recommend using it.
You can find kloppy’s documentation here.
Codeball is an open source library developed by us to facilitate doing data driven video analysis with Play. It has three main modules:
- Patterns: A patterns’ module, that has different patterns that can be run on the data, like team compactness, quality of passes, build up, defensive shifts, spaces created, show passes between main nodes in the pass network, expected goal of each shot, etc. All patterns inspired by what we know of clubs and the community.
- Tactical methods: functions to use in the creation of patterns for example count players in an area identified tactical lines, distance between players, compute team length, etc., etc
- Visualization methods: to make it super easy to add visualizations to the events so that they can be uploaded and visualized in play.
The idea is that this library can help you write your own pattern while taking advantage of tactical analysis methods (e.g. easy ways to get all completed passes into the box, the stretched moments of a team, or just get the field players of a team) and easily add annotations to the events so that they can be exported in a patterns file format compatible with Play.
Unlike Klopy though, 1Codeball is still more a work in progress rather than a mature library. While we are planning on expanding on patterns and tactical methods, at the moment there are just 3 patterns and a handful of tactical methods. The auxiliary methods for the visualizations are complete thought.
That disclaimer aside, if you find it interesting or useful, we do encourage you to try it out! If you do, please do let us know your experience, what other things you’d like to see, etc. Also, it’s an open source project, so you can also ask about contributing to it :).
You can check Codeball’s documentation here.
You can also see here a tutorial video on how to use Sample Game 3 with Codeball to test everything out yourself.
- Data Driven Video Analysis consist of programmatically creating telestrated events base on tactical concepts or actions that are relevant for the team. It is like “coding” the game with a coding software (Angles, Sportscode, etc.) and then telestrating the events all in one, and all from a set of scripts or analysis suit.
- DDVA does not replace traditional video analysis but rather complements it. It’s the perfect way for data analysis departments to convey their message to the coach and coaching staff. Meet them right where they already do work.
- Play is the only software in the market that allows to do that: translate your data analysis results into telestrated events. You can do that by importing a patterns file, which is nothing else than a json file with a specific formatting.
- You can get to that file using any coding language you prefer, but if you work in python we greatly recommend Kloppy for loading and structuring the data, and we can suggest to check out Codeball as well though it’s still a work in progress.
About Metrica Sports:
Metrica Sports was founded in 2014 by CEO Ruben Saavedra, CTO Bruno Dagnino and CMO Enzo Angilletta. Metrica uses artificial intelligence to bring insights and performance improvements to clubs, academies and athletes all over the world. The vision of the founders is to give cutting-edge video and data analysis solutions to every coach, analyst and player in the world.