Go to Post You have accomplished and learned more in the past six weeks than...a majority of people in the country. Be proud of your machine. Don't kick it to the gutter. Stand behind it. Believe in it. Give it your all. Take pride in your robot. :) - sanddrag [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-08-2017, 11:45 AM
andrewda's Avatar
andrewda andrewda is offline
Programmer
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Eugene, OR
Posts: 24
andrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to all
Introducing frc-livescore a Python package for processing livestreams

GitHub: https://github.com/andrewda/frc-livescore


FRC Live Replay was just one of the many awesome new tools released by the community last year that involved parsing live FRC streams to get fast data.

Anyone who has worked with the FIRST API knows that it can be pretty slow, taking several minutes to publish scores after the completion of the match. The live streams, though, almost always have only a few seconds of delay, meaning we can get results from them much faster than we can the official API. With many advancements in OCR (optical character recognition) software, we can now process the text within images quickly and with a very high degree of accuracy.

After that brief little intro to the problem, here's the solution: frc-livescore. This Python package uses OpenCV and Tesseract to take a frame from an FRC stream and return the current match string, red/blue scores, and time remaining (more to come in the near future would love help from contributors!). What's more, it's fully customizable, meaning that if a stream uses a different format for their scoreboard (and maybe nicer, *cough* Chezy Champs *cough*), you can quickly create a template for the different important areas and use those instead. This package will allow the creation of many more real-time apps that would not have been possible before with large wait times for the FIRST API. Go ahead, make something awesome!

P.S. I would love more contributors/collaborators on this project! <3

Example Programs:
Reply With Quote
  #2   Spotlight this post!  
Unread 07-08-2017, 03:34 PM
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,956
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Introducing frc-livescore a Python package for processing livestreams

This is pretty great. I could see this being very useful for off-season events.

Potential ideas
- Score screens in the driver stations that just show the two current scores and time remaining.
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #3   Spotlight this post!  
Unread 07-08-2017, 04:02 PM
tjf tjf is offline
Registered User
AKA: Tim Flynn
FRC #1257 (Parallel Universe), #1228 (RoboTribe)
Team Role: Mentor
 
Join Date: Jun 2016
Rookie Year: 2012
Location: Central New Jersey (it exists!)
Posts: 349
tjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
Well, if it's actually readind the match data from a livestream, just get the current time since start, and use it to create starts and stops, and then you could run it through ffmpeg to extract only the start of a match and the end (plus or minus like 5 seconds I suppose.)

I'm looking at it like a programmer, but this overall is awesome!
__________________

1257 (2016) - Student
1257 (2017-Present) - Overactive Alumn | 1228 (2017-Present) - I do stuff
KD2KRT
Reply With Quote
  #4   Spotlight this post!  
Unread 07-08-2017, 07:36 PM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 550
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
This is pretty great. I could see this being very useful for off-season events.

Potential ideas
- Score screens in the driver stations that just show the two current scores and time remaining.
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-08-2017, 08:59 PM
Hitchhiker 42's Avatar
Hitchhiker 42 Hitchhiker 42 is offline
Roboter
AKA: Mark Lavrentyev
FRC #4557 (FullMetal Falcons)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: Connecticut
Posts: 920
Hitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by ollien View Post
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
Not to mention it'd be easier for the field to simply provide access to scores the way they do with time and alliance and position and y'know.
__________________
Don't forget your towel!

Reply With Quote
  #6   Spotlight this post!  
Unread 07-08-2017, 10:08 PM
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,956
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by ollien View Post
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
I mean for events to be able to set up screens to be used by teams. Not for teams to have their own.
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #7   Spotlight this post!  
Unread 07-09-2017, 01:02 AM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 550
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
I mean for events to be able to set up screens to be used by teams. Not for teams to have their own.
Got it. Thanks for clearing that up.
Reply With Quote
  #8   Spotlight this post!  
Unread 07-10-2017, 11:37 PM
Praj's Avatar
Praj Praj is offline
Registered User
FRC #6325 (Reset Robotics)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Alpharetta
Posts: 120
Praj is a jewel in the roughPraj is a jewel in the roughPraj is a jewel in the rough
Re: Introducing frc-livescore a Python package for processing livestreams

This looks really neat. I am looking into parsing rotors/balls/climbs scored and maybe teams on both alliances as well. I am wondering if maybe if the OCR can be used to read how many exact gears are on an airship for semi-automatic scouting (however this might be too inconsistent).
__________________



2017-Rookie All Star/Rookie Inspiration/Highest Rookie Seed. PCH District Championship Rookie All Star
Reply With Quote
  #9   Spotlight this post!  
Unread 07-11-2017, 11:37 AM
ngreen ngreen is offline
Registered User
AKA: Nelson Green
FRC #1108 (Panther Robotics)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Paola, KS
Posts: 962
ngreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant future
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by Praj View Post
This looks really neat. I am looking into parsing rotors/balls/climbs scored and maybe teams on both alliances as well. I am wondering if maybe if the OCR can be used to read how many exact gears are on an airship for semi-automatic scouting (however this might be too inconsistent).
I don't think exact gears are possible, but interpolations from rotors would be. You could from the times and rotors derive a gear scoring rate. There would be some problems still because of the unequal tiers. The first rotor rate wouldn't be reliable because it doesn't take multiple gears and is automatic. The fourth rate wouldn't always happen. So you might need to take some average of the 2nd and 3rd rotor rates. You also then have to deconvolute this to make it a team-based rather than an alliance-based rate.

I'd researched ocr'ing the stream (for gear rates), so I'm glad someone has at least done it for the score. I'd found this example: https://waldo.jaquith.org/blog/2011/02/ocr-video/, but didn't get very far. I basically reached the part before the Tesseract part, but I wasn't processing the stream in a systematic way. I hadn't yet figured how to start/stop the match time. The background color changes throughout the match and at key times, so that was where I was thinking I could key onto (like the color change at 30 seconds remaining).

Last edited by ngreen : 07-11-2017 at 11:45 AM.
Reply With Quote
  #10   Spotlight this post!  
Unread 07-14-2017, 12:26 PM
andrewda's Avatar
andrewda andrewda is offline
Programmer
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Eugene, OR
Posts: 24
andrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to all
Re: Introducing frc-livescore a Python package for processing livestreams

It's now spamming twitter at @FRClivescore. Please report any incorrect scores if possible! It seems like it's most inaccurate with the blue score at the moment, occasionally appending a number at the end.
Reply With Quote
  #11   Spotlight this post!  
Unread 07-14-2017, 12:37 PM
andrewda's Avatar
andrewda andrewda is offline
Programmer
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Eugene, OR
Posts: 24
andrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to all
Re: Introducing frc-livescore a Python package for processing livestreams

Just kidding... I'll set it up on a Raspberry Pi tonight and get it up and running on Twitter for tomorrow.
Reply With Quote
  #12   Spotlight this post!  
Unread 02-26-2018, 04:40 PM
andrewda's Avatar
andrewda andrewda is offline
Programmer
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Eugene, OR
Posts: 24
andrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to allandrewda is a name known to all
Re: Introducing frc-livescore a Python package for processing livestreams

With a huge amount of help from Eugene Fang, the 2018 version of FRC Livescore is ready to go for the season. There are a ton of new changes for this latest version, including (but not limited to):
  • Using SURF to detect the scale and position of the scoreboard,
  • Only trying to detect the position of the scoreboard if OCR fails. Otherwise, uses the last detected positions. This allows for much faster results.
  • Detecting if the red/blue alliances are swapped on the scoreboard.
  • Detecting the match mode: pre_match, auto, teleop, post_match
  • Using a KNN classifier trained by Tesseract for faster digit OCR

Some of you may have already seen this in Week 0, but FRC Livescore is now being used on The Blue Alliance to show the real-time scoreboard on an event's page! This feature is still in the very early stages and is subject to change as the season progresses, but it's a very cool use of this technology and am super excited for it to be used during the season. It should also provide us with some unique statistics about matches this year, and how different ownership times affect the outcomes of games.

Thanks to everyone who has contributed to make FRC Livescore amazing! Check out the latest version on GitHub: https://github.com/andrewda/frc-livescore.

Finally, here are some example images using the new FRC Livescore (from 2017 and 2018):



Reply With Quote
  #13   Spotlight this post!  
Unread 02-26-2018, 04:48 PM
Brandon_L Brandon_L is offline
Seeking CD cool kid club nomination
AKA: Brandon Liatys
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Hamilton, NJ
Posts: 1,334
Brandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by Hitchhiker 42 View Post
Not to mention it'd be easier for the field to simply provide access to scores the way they do with time and alliance and position and y'know.
Wait...why isn't this a thing???
__________________


FRC 2495 - Hamilton West Robotics [2007-2014] - 2013 Seneca Winner; 2014 Lenape Quality Award, MAR DCMP alliance captain, H.E.R.E. Captain & Winner
FRC 2180 - Zero Gravity [2017-]
- 2017 Hatboro Spirit Award; 2018 Westtown Winner, Seneca Finalist

frclocks.com
Reply With Quote
  #14   Spotlight this post!  
Unread 02-26-2018, 05:43 PM
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
FRC #0604 (Quixilver)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 1,013
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by Brandon_L View Post
Wait...why isn't this a thing???
We thought it was going to be a thing when FIRST announced field state info... Turns out that was just LLL/RRR/LRL/RLR.
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-Present)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App | TBA Blog | TBA Swag
Reply With Quote
  #15   Spotlight this post!  
Unread 02-26-2018, 06:23 PM
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is online now
Discount Nate Silver
AKA: inkling16
no team
 
Join Date: Feb 2011
Rookie Year: 2009
Location: Minneapolis, Minnesota
Posts: 1,502
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by Eugene Fang View Post
Turns out that was just LLL/RRR/LRL/RLR.
But at least the infrastructure is there now for future games... maybe...

Are there any plans to have this data accessible via TBA's API?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:31 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi