We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

CourtVisionPH: A System for the Extraction of Field Goal Attempt Locations and Spatial Analysis of Shooting Using Broadcast Basketball Videos

00:00

Formal Metadata

Title
CourtVisionPH: A System for the Extraction of Field Goal Attempt Locations and Spatial Analysis of Shooting Using Broadcast Basketball Videos
Title of Series
Number of Parts
183
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language
Producer
Production Year2015
Production PlaceSeoul, South Korea

Content Metadata

Subject Area
Genre
Abstract
The presentation is about the development and application of CourtVisionPH. CourtVisionPH is a system developed for the extraction, storage, and analysis of basketball-related spatial information. It focuses on the extraction of field goal attempt (FGA) locations from broadcast basketball videos and the spatial analysis of shooting by means of statistics and maps/visualizations. The system was developed using the Python Programming Language. It features a database for storing spatial and non-spatial information and a Graphical User Interface (GUI) to help the user and the system interact. The modules used in the development include Tkinter for the GUI, SQLite for the database, Numpy for the computations, Pillow for image processing, and OpenCV for video rendering. The system has three independent but interconnected functionalities each with its own specific task: (1) Data Management which handles database connections, (2) Spatial Data Extraction for user-assisted extraction of FGA locations from videos using 2D-projective coordinate transformation and validation of transformed FGA locations sing RMSE and back-transformation, and (3) Spatial Analysis that computes statistics, generates maps/visualizations, and query-based analysis. After the development of the system, it was applied on UP Fighting Maroons and the DLSU Green Archers during the 2nd Round of University Athletics Association of the Philippines (UAAP) Season 76 (2013-2014). Videos publicly available online through youtube.com were used for extracting field goal attempt locations. Shots taken too far from the basket (half-court heaves, etc.) or those with bad RMSE or back-substitution results were excluded from the extraction. The extracted FGA locations were then validated using box-scores. Afterwhich, the system was used to analyze and compare the two teams and their players using statistics and visualizations and show that spatial analysis provides more information and allows for better characterization and appreciation of shooting than conventional, non-spatial techniques.
126
Goodness of fitAreaSquare numberWordSystem programmingSet (mathematics)Broadcasting (networking)Metric systemRange (statistics)Cellular automatonUniqueness quantificationStreaming mediaPresentation of a groupConfidence intervalAudiovisualisierungAnalytic setFirst-person shooterInsertion lossMultiplication signObservational studyPerspective (visual)Game theoryCoordinate systemParameter (computer programming)Mathematical analysisPoint (geometry)Total S.A.DatabaseGroup actionProcess (computing)Exception handlingProjective planeMereologyEndliche ModelltheorieUser interfaceField (computer science)InformationTransformation (genetics)Source codeReal numberData managementNumerical analysisNeuroinformatikForm (programming)Uniform resource locatoroutputFigurate numberRight angleDiagramResultantStatisticsAssociative propertyVisualization (computer graphics)Limit (category theory)Spline (mathematics)CountingSoftware developerYouTubeInternet service providerLibrary (computing)FunktionalanalysisOrder (biology)Object-oriented programmingHand fanType theoryPay televisionMechanism designMassCartesian coordinate systemAngleShooting methodAverageSocial classPersonal digital assistantComputer fontRelational databaseMachine visionMetreGraphical user interfaceWell-formed formulaLevel (video gaming)MethodenbankComputer animation
AreaMultiplication signDependent and independent variablesRange (statistics)TheoryAudiovisualisierungUniverse (mathematics)Right angleLevel (video gaming)CuboidNumerical analysisGraph coloringPoint (geometry)Parameter (computer programming)PlotterProjective planeContent (media)Inheritance (object-oriented programming)Exception handlingEndliche ModelltheorieConnected spaceFingerprintDistribution (mathematics)Transzendente ZahlDistanceNatural languageOrder (biology)Data managementQuery languageFreewareAngleGame theoryRule of inferenceFile formatFunction (mathematics)Cartesian coordinate systemNeuroinformatikMereologySpectrum (functional analysis)Presentation of a groupValidity (statistics)Streaming mediaDatabaseResultantField (computer science)System programmingYouTubeStatisticsSubstitute goodDifferent (Kate Ryan album)Error messageMathematical analysisVisualization (computer graphics)Software developerTransformation (genetics)Spline (mathematics)Pairwise comparisonComa BerenicesState of matterAverageState observerCompilation albumNumbering schemeNear-ringCellular automatonLine (geometry)Online helpLimit (category theory)outputGraphical user interfaceTerm (mathematics)MetreComputer animation
System programmingSet (mathematics)Mathematical analysisVariable (mathematics)Shooting methodAudiovisualisierungLevel (video gaming)DatabaseNeuroinformatikStreaming mediaDifferent (Kate Ryan album)ResultantAlgorithmGame theoryPosition operatorDeterminantMultiplication signPresentation of a groupMereologySubstitute goodProof theoryCASE <Informatik>Universe (mathematics)Condition numberOpen sourceTerm (mathematics)AreaImage processingPoint (geometry)FunktionalanalysisPairwise comparisonXINGCartesian coordinate systemType theoryNumerical analysisArmMathematicsMatching (graph theory)Instance (computer science)InformationDecision theoryPattern recognitionView (database)Visualization (computer graphics)Field (computer science)Source codeData managementHand fanIntercept theoremGraph coloringHydraulic jumpWorkstation <Musikinstrument>Category of beingBroadcasting (networking)Motion captureCuboidUniform resource locatorAverageTable (information)Limit (category theory)TrailCodeHypothesisVertex (graph theory)Sinc functionMethodenbankComputer animation
Computer animation
Transcript: English(auto-generated)
So, good afternoon everyone. I will be your last presenter for this session. My name is Engineer Ben Herpintor. I am from the University of the Philippines, Department of Judetic Engineering. And on behalf of Mr. Nico Boikatan Yag and Assistant Professor Maria Rosario Concepcion Ang,
I will be presenting Court Vision PH, a system for the extraction of field goal attempt locations and special analysis of shooting using broadcast basketball videos. A short outline of my presentation will be as follows. First, I would provide an introduction as to what the study or the system is about,
the problems that it wants to address, its objectives, the methodology that we used for development and application of such a system, a discussion of the results, and finally some conclusions and recommendations that we gathered from this study.
So, I'm a really big basketball fan. A few years ago, in 2012, I encountered and read a research by Dr. Kirk Goldsberry, which she presented during the 2012 MIT Sloan Sports Conference in Boston. The title was Court Vision, New Visual and Special Analytics for the NBA.
Basically, if you've read it, you know that he wanted to address the issue of who the best shooter in the NBA was at that time. And he wanted to address the fact that most of the conventional statistics being used in the NBA during that time failed to account for the special aspect of shooting.
So, from his study, he used sport VU player tracking system data from 2005 to 2006-2011, and he found out that a majority, if not all, of the shots taken during a basketball game was limited
to a scoring area of 1,248 square feet. He divided it into one square foot cells, resulting in 1,248 shooting cells. Using that scoring area, he was able to create two metrics,
which was spread and range. Spread was merely how many cells, unique cells, a player attempts at least one field goal. And range was the number of shooting cells, wherein a player averages at least one point per attempt. Now, as I've said, he used the sport VU
player tracking system by Stats LLC for this study. This actually, this system uses six cameras above the court to track players, the ball. It simultaneously observes and records a basketball game. And recently, it's become available online.
NBA data, special data is available online. So from this, what did I get when I read that paper, and I realized that there was something like this. I realized that basketball is special. And because I really, really love basketball, and if you've ever been to the Philippines, you know that we're crazy about basketball.
It is the number one sport in our country, without a doubt. It has a rich history, it's part of our culture, there's a lot of money involved. So I wanted to actually do this kind of study in our country. The problem was, I encountered a few, actually. The problems were, first of all, there was actually no system in place to gather special information from basketball games.
So unlike the NBA, where they have the sport VU player tracking system, there's no such thing in place in the Philippines. So I have a problem with data, first of all. Second, the type of analysis and management in the country is still very traditional. If you look at the premier basketball league in our country,
the Philippine Basketball Association, they still limit their analysis, their statistic skipping to simple counting and ratio statistics. For shooting, they use field goal percentage, three-point percentage. So it doesn't account, just like Dr. Goldsberry's study, it doesn't account for the special aspect of shooting itself.
So what did we want to do? We wanted to develop a system that could actually extract field goal applications from broadcast basketball videos. We decided to use broadcast basketball videos because it was the most readily available.
Usually it is uploaded on YouTube so we could get it publicly without needing to actually pay the providers for such videos. So after extraction, we wanted to be able to perform special analysis after extracting the data and then be able to present the results using statistics and visualizations.
Aside from that, we wanted to show that special analysis of shooting actually has advantages over the conventional non-special statistics that were used during that time and still actually currently being used in the Philippines right now. So for our methodology, we divided into two.
First is the development. So we wanted to develop a system. So we decided to use Python and some of its libraries. So NumPy for computations are databases, SQLite, TakeNter for the GUI, OpenCV for video manipulation and rendering,
and Pillow for the images. So if you notice, most of it are just built-in modules in Python so we didn't need to import or add so many external dependencies. So for the development of our system, we divided it into three main parts
or functionalities. We needed a data management system that could actually store both the information that we need. We needed an extraction system that could extract those field goal locations from the videos.
And lastly, we needed a system that could analyze the data that we extracted from those videos. So for our data management, basically this. We have a user that can actually input all those information into a database. Basically, you have a GUI for that and on your right,
you can see the ER diagram, a simple ER diagram of what the database contains. For our extraction, it's a bit manual. It is actually manual. We have a video. You have a system that plays the video
and the user selects manually the shots, the field goal attempts from the video itself. So this is actually the bottleneck of the system. It's a limitation. We wanted to look into automating this process,
but the constraint of time did not allow us to actually automate the process itself. So we decided to use, to actually manually extract those information. So what actually happens during extraction is this. Wait, first. Since we're using broadcast basketball videos
from just one camera, and that camera is usually positioned in such a way that it's oblique from the court itself. The coordinate transformation that we used was 2D projective coordinate transformation
provided by those formulas. And on the right side, that was the court model that we used with 23 control points. So we all know if you have two images, a map and the real world image, you can get transformation parameters by solving for them
if you know the coordinates of a point in both coordinate systems. So we also defined the scoring area as a 15 meter by 10 meter grid composed of one square, one meter by one meter cells. So we had a total of 150 total cells for our spatial analysis.
So basically for extraction, this is what you were doing. You would pause the video. You would have to select the control points from the image and select the user, the shooter. And after that, you allow the system to compute
for the transformation parameters. It would actually output the computed RMSE just to validate if it's a good transformation or not. And it will also back project the court model that I showed you before onto the image itself so that you have an idea whether or not
the transformation was successful or not. So in this example, you have the player there shooting the ball, the blue one. Then you have one, two, three, and four, five control points. Then the system computes for the transformation parameters
and on the second image, you see the court was back projected. It was actually, if you look at the court lines, the back projection was actually quite good, actually. So you accept the computed parameters and the coordinates by the system and it inputs it onto the database.
If it's not that accurate, you could actually prevent the system from inputting it into the database because if it's an inaccurate transformation, it would just corrupt the cleanliness of the data that you have. So aside from extraction, we wanted to be able to perform
the spatial analysis. So once you have gathered, you have enough data for analysis, a user can actually query the system to create statistics or visualizations based on those field goal applications that were extracted. So this is just the GUI of it.
You put a query on top or on that text box. We decided to use a text-based query so that you could actually create scenarios. You're not limited to just querying teams, players, et cetera. You can actually query specific scenarios, like say,
you wanted to know how well a team performs during the last three minutes of a game. So you query team is team A, time quarter equals four, time left equals three. And the system will tell you the results
of what it is that you're querying. So after the development, after we developed the system, we applied it to study the performance of two teams in the University Athletics Association of the Philippines, or UAP, season 76.
This was in 2013 and 2014. Those two teams were the UP Fighting Maroons, which is my alma mater, and the De La Salle University Green Archers. They were the champs. They were the champions of that season. So the data that we used, as I've said, there were videos publicly available through YouTube.
And then to be able to actually validate those data that we gathered, we used box scores and play-by-play data available online. We also excluded several field goal attempts from the database. So if it was outside the scoring area, we excluded it.
At the same time, if it had bad RMSE or bad substitution results, we excluded it. So when we checked the database, we found out that about 20%, there's about 20% difference between the number of extracted field goal attempts
and those from the actual box scores of that league. So we credited this kind of error to, well, first, the personal limitation of the user. Since you're manually extracting points, you're manually extracting field goal attempts, and if the user is not that knowledgeable about basketball,
he could miss some data, some field goal attempts, actually. And at the same time, as Ev said, we excluded shots outside of the scoring area as well as those with low RMSE. So those shots were not included in the database itself.
So from that, we were able to compute certain statistics. If it's a spread, spatial statistics basically, spread, percentage, range percentage, how many shots or what percentage of those shots are taken within this distance from the basket,
how well did they shoot within that distance, how many points did they score per attempt. If you actually, if you try to look at it, you'll notice that the UP Fighting Maroons and the DLSU Green Archers actually have
almost the same distribution of shots in terms of distance, only that UP has a slight, slight, slight advantage for shots near the basket, which is less than one meter and three pointers, but in all other areas of the court,
it was the DLSU Archers who had a better, significantly better performance than the UP Fighting Maroons. So what makes the system great is not just the statistics, it's actually the visualizations. Because if you are able to see, if you are able to account for where on the court
a team or a player performs better, then you can actually prepare for them better. So this is just the range percentage visualization of UP and its opponents. On your left is UP and on your right is its opponents. If you look at the map,
the very first thing that you'll notice is that near the basket, on areas near the basket, UP actually performs really, really poor. They have like a yellow one, an orange one, and very small, very small sizes of the boxes.
The sizes of the boxes indicate the amount, the number of field goal attempts taken in that cell. And then the color indicates how many points are scored per attempt. So if you look at this area, UP actually performs really, really poor here compared to what their opponents do.
So from that itself, you can actually conclude that this team has a problem converting and defending shots near the basket. Then, aside from that, we can also look at, if you look at this, this is De La Salle, and then its opponents.
The main thing that you can see here is that La Salle actually converts at a high rate, especially at this area of the three-point line. So if you were playing them, you could actually say, prevent them from taking shots here. Just let them take shots somewhere here or near this baseline,
because that's where they actually perform poorer. This is a comparison of two players, one from UP, which is Mr. Marata, and one from De La Salle, which was Mr. Teng. If you can see, Mr. Marata's range map is very peppered.
It has a peppered look. It means that it takes a lot of shots everywhere, even though he actually only makes, he is only actually effective here and about here. Compare that to Mr. Teng, wherein most of his shots are concentrated near the paint, in the paint area.
He rarely takes mid-range shots, and he rarely takes three-pointers. Of those shots that he takes within the paint area, he usually succeeds. He has a very high point-per-attempt average in this area. So these are just the observations.
As I've said, they have similar distribution when it comes to distance from basket, only a slight advantage for UP in areas near the, in atrium shots and three-pointers, but significant difference for La Salle, advantage for La Salle on close-range to mid-range shots.
Again, UP has difficulties converting and defending those shots near the basket, if you've seen it in the map, and only 36, actually, of those shots were taken near the basket. Compare that to their opponents who took 52% of their shots within that area and converted that 1.15 point-per-attempt.
And this is what I was saying about La Salle. They allow their opponents to take only 36% of the shots within that area and force them into long three-pointers and mid-range shots, which their opponents actually converted at a very poor rate,
0.62 point-per-attempt. If you look at an average, the average should be at least one point-per-attempt. So again, these are just Mr. Marat and Mr. Teng's comparison. So for some conclusions, we were able to develop, at least show a proof-of-concept
that a system can be made that can extract field goal-attempt locations using broadcast basketball videos, and then be able to perform spatial analysis of shooting using freely available resources and data. We were also able to demonstrate that
the spatial analysis, it provides better characterization and appreciation of shooting, because if I just give you a set of tables and of numbers, you won't actually appreciate it. You appreciate data more if it's visual. You can see it on a map. And the visualizations provided by the system does that.
We also found out that aside from the quality of the videos that we used, the system was pretty much limited by the user, how he could actually extract the field goal attempts from the videos,
because being able to completely and correctly extract those would make a significant difference into the accuracy of the analysis itself. So recommendations. You could expand the database. You can change it. Don't use SQLite. Use something more spatial, basically. You could add better video and image processing algorithms.
These three actually are very good. You could actually automate the shot and position determination if you wanted to do that, since the system was made in such a way that those three functionalities could be edited without actually changing how it reacts
or how it communicates with the other two functionalities. Lastly, you could use your own cameras or video capture device systems, and then you just use those coupled with some image processing, video processing algorithms
to actually detect the shots on your own, not just like the way the sports video player telling system does it. So the data fed into the system, in terms of application, the data fed should be complete. You can use supplementary sources
in the play-by-play data box course available online to make sure that it's complete. And you could also allow, if you're using the system as it is right now, you should use it. You should allow a person with intimate knowledge of basketball to be the one that extracts the data, because someone who's not a fan of basketball would have a very difficult time
of extracting those information. So, here's some references. Thank you.
I was thinking, is this on? Do you see any use for this, and could this be used for other sports? Yes, yes, actually. Like soccer? Yeah. And one more question. Did you use only one camera, or did you use multiple cameras?
As it is right now, the system only uses a single camera, which is the camera of the TV station capturing the game. But, of course, since we're geospatial scientists here, we know that if you have more cameras, more views, you'll have better, you'll actually get the position more accurately.
Yes, and you have to manually know which number the player who's shooting has. Oh, yes, yes. How much do you have to do manually? I saw the slide, but you have to, like, point on the person shooting,
and you have to type in the number of the person shooting? Yes, the number. And then it will actually check the database if that number is actually assigned to a specific player. So if it's not, it will tell you, no, that's the wrong person, the wrong team. That's not the one playing.
Could you say anything about the amount of manual work? How much time does it take for one person to do one match, for instance? Say, for one basketball game, you could actually say, you can do it after the game, about two hours.
So the next day, you can actually provide the team, if they're asking, if they're asking for data. You can actually finish it within a night, within a night. So tomorrow, if you ask me, if you give me data today, I could give you the results tomorrow. Have you been trying to maybe track the ball in the video?
Oh, not yet. We actually wanted to automatically track everything, but it was difficult to do, given the amount of time that we were given to finish the research. So we opted to just use manual extraction first
and then try to look into automated tracking of players and the ball. And one of the big limitations was that the videos that were used were very low quality. So it's very hard to differentiate between, aside from players, if the ball is moving fast,
it's very difficult to find, especially for low quality videos. I think it was a very interesting presentation, so thank you. I'll echo that. This was very cool, thank you. I have just a couple of quick questions. First, I assume, because the conference we're at,
that this is open source. Could you talk about how hard it is for someone to set up this system? It took me about six, no, two months of thinking about how to create the system and then another two months to actually creating it.
I just divided it into three parts. As I've said, it's data management, extraction, and then spatial analysis. So I tackled it separately, so that if ever I could find better ways to do something, I could just change it.
So if you notice, I used built-in modules by Python to make it, it's a proof of concept. I wanted to show that it could be done. Okay, but could other people run your code? Is it available somewhere? The problem is, actually, I have an agreement right now
with my thesis advisor and the university. I'm still waiting if they would allow me to actually upload my code. Okay, fair enough. And then the last one before I give up the mic. I'm curious how you figure out how high the ball is off the court when it's released, right? Because you need to know how high someone is jumping
to intersect with the transformed court. So how do you figure that out? We didn't. We assume that if a person is jumping, we just assume that the person is jumping vertically. So, here, or, no actually,
we picked the location before he jumped. So while his feet are still on the court, that was the position where we picked as the spot where he took the shot. Okay, so you clicked with the mouse or something. Okay, thank you.