Hacker News new | past | comments | ask | show | jobs | submit login
NHL goal celebration hack: real-time machine learning and hue light show (francoismaillet.com)
258 points by cotsog on April 22, 2015 | hide | past | favorite | 46 comments



I'm the guy who did this; really happy this is trending on HN!

Hope everyone enjoys the game tonight! :D


I guess it probably didn't go off much tonight.


Go Habs go :)


Really cool.

What are you doing for away games? Can it still detect Habs goals? You mentioned you had to train the algorithm not to detect the opponents' goal horn. Couldn't you just scrape the schedule to detect if you're playing at home or away and use a different model for each?


It's really about the comentator's yell, not the goal horn. So as far as he's excited for Habs goals and not too excited for the other team's goals, it works fine.


You watch the French commentary, I presume.


Yup, the current model is trained on the TVA sports broadcast


Yes, the English broadcasters at least pretend to be neutral.


Go Sens Go!


Pretty cool my man but how do you deal with false positives?

I don't know about hockey but in soccer (football), commentators are as much excited about near-goal scenarios like the ball hitting one of the posts or the goalie making a superb save as goals themselves.

I can't imagine employing such a system for football games. What do you think?


For false positives during a live broadcast, I have the big USB button ready to cancel the light show and goal song. I did not mention in the blog post is that it stops the goal song by playing the Fail Trombone sound (https://www.youtube.com/watch?v=iMpXAknykeg) when you use the USB button to cancel light show

Really not sure how it would work for other sports. The only reason it worked so well is probably because they GOOOAAAAAALLLLLLLL yell is long and distinctive versus everything else. It's not about intensity as much as a pattern in the frequency spectrum. I think it's worth a try with soccer and football.


Did you consider trying to use speech recognition rather than spectrogram analysis?


This is really awesome. I've managed to do something similar, but for the Washington Capitals. When the game starts the lights change to the color of the home team, and when they score the flash. I'm using a little web scraper to pull from nhl.com to get the data, however, sometimes it's quite out of sync with the actual game (streaming or live tv). Usually about 30 seconds to a minute delay.

The best part is when I forget that they are playing and the lights start flashing randomly. Always scares guests :)


I've been using MLB.com's api and Windows' text-to-speech to build a robo-announcer for baseball games. It builds a little narrative from the ridiculous amount of data they share. Sure, I could just listen to the streaming audio, but it's been an excuse to learn some Racket.

I kid about building a robo-color-commentator that tells old stories and bad jokes.


That sounds neat! Do you have a link to a demo of it?


I'd love to get your code for that if you're willing to share. I have my hue lights set up and synced with the ESPN app in IFTTT but that triggers for every game event not just goals. Would love to get it set up with something that will work a bit better.


The model is really specific to the station and commentator. I've trained it on games from a local Montreal station. I tried the other local station with the same model and the it detected no goals at all. So to make it work on any other station, we'd need to rebuild a dataset from scratch.


I know this post isn't really about the hockey part and more about the ML part, but I think it would be more practical to analyze and maybe use the Budweiser Redlight API if possible (I haven't looked into it yet or have one) to get almost instant goal reporting for your team of choice.

I have seen it in action and it's like ~2 seconds off from a live feed.

http://www.budweiser.ca/redlight/

Really nice post and I'll be using it implement a few things around the house (like trying to monitor kids crying, etc).


I believe their system works by employing a man to push a button, which is then routed to your light.

They note in their fine print that they may end the service at any point, which renders it fairly useless.

As you said, you may be able to find a way of spoofing the goal signal. But now, you are just the man pushing the button.


I feel like human-integrated solutions are starting to become more and more of a thing, for example, Magic, this Budweiser Redlight, Rabbit (I think that's what it's called? For IT-related tasks), and so on. I'm surprised these services didn't exist sooner.


I am impressed that it's able to work for both when the Habs are at home and on the road. The only similar thing would be the commentator's reaction. The ambient sound is reversed (cheers and horns when the Sens score). I would think you would have to train the algorithm separately for both cases, and tell it whether the current game is at home or not.

Anyway, this is very good work, the light setup is very clean. I hope that the (your?) system will get a lot of "true positives" during tonight's game :).


Not enough unfortunately :(


You might also have good luck by analyzing the chat data from hockeystreams - just look for when a few dozen people write something along the lines of "GOOOOOOOOAAAAAAAALLLLLLLLLL", and take it from there.

Granted, not as much fun as setting up the whole system you did, but another option.


HockeyStreams has an API for scores - for free. I'm not sure how quickly it updates though: https://www.hockeystreams.com/api#scoresapi

Highly recommended to anyone that have to deal with blackouts from GameCentre.


There's also a similar community on freenode at ##reddit-hockey we're a pretty reliable data source as well.


This is great. I use a simple IFTTT recipe to blink my hue's at the start of the Yankees games but the ESPN api hook is always off by 10 minutes or more.


Nerdy Habs fans: combining obsessive love of tech with obsessive love for hockey.

All the goal horns are on youtube, maybe you could create a training set with that?


Would not work for away games. Could easily use goal horn for home games though for higher accuracy.


This is awesome. Well done. Wondering if there was any real time speech to text that could be trained. Seems like these commentators all have their canned lines when the team scores. "He scores", "Goal", etc. etc. Seems like you might be able to fairly accurately capture that and add the sentence as an attribute? Well done. My Oilers need something like this for every time we win the Draft Lottery! McDavid!!!!!!


This is a cool idea, but the light show going off erroneously in my own home for the opposing team would be disheartening to any die hard fan. Any chance of this happening, let alone once every 4 games, would be unacceptable. And the pain of knowing I rigged it up myself would make it that much worse. I applaud OP for the wherewithal it must've taken to see this project through to the end.


lol well it does go off erroneously sometimes... statistically speaking once every 4 games. BUT... I do have the big USB button ready to cancel the light show and goal song. Something I did not mention in the blog post is that it stops the goal song by playing the Fail Trombone sound (https://www.youtube.com/watch?v=iMpXAknykeg) when you use the USB button to cancel light show. Yes really disheartening, but the one time it happened it made the whole thing pretty funny actually :)


Nice work, and great mood lightening sound :)

Maybe it would be more accurate to detect when the siren light behind the goal goes off if it's always viewable on screen.


It seems like analyzing the video would be much easier, as you could basically just OCR the on-screen scoreboard.


Scoreboards will take a bit longer to react than the announcers and goal horn.


Indeed, on our local broadcast sometimes the scoreboard doesn't change until well after the goal has been reviewed and approved in Toronto.


Nice!

I was playing with the Belleds lights (friend's recent Kickstarter; similar to Hue but somewhat cheaper), wrote a Python API for it, which worked great, but then I hit a mental block in coming up with something actually cool to do with RGB lights.

I hooked it up to a text sentiment analyzer but this just wasn't all that cool. https://github.com/dheera/python-belleds/blob/master/sample-...

Hooking it up to a sports match though, that's definitely cool and useful.


What happens when a goal is scored by the other team?


Usually the commentator is way less excited so the system can make the difference.


Its trained for the response of a particular commentator (presumably a Habs fan).


Very cool. Would a Closed Caption feed be superior?


Not a bad idea. However it would probably be hard to make the difference between goals for and against your team without analyzing a lot of what's said prior to a goal.


As a fan of both ML and hockey, I love this! Can't wait to beat you again this year (let's go Rangers)

You can probably get some improved performance using hidden markov models to place of the voting scheme.


> Being able to see the patterns with the naked eye is very encouraging in terms of being able to train a model to detect it.

Would that that were true!


Was playing the goal song through home audio system triggered too? How (or is it Mac's audio piped through speakers)? Great idea btw


Mac Mini is hooked up to speakers and TV and it plays the goal song. I set the volume of the media player so that it's just right with the game broadcast so everything sounds good together.


Very cool. Lets go Islanders!!!!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: