Tag Archive for: Hackathon

Hackathon – Image Recognition Slackbot

Our internal hackathons give us extra opportunities to play with software and carry out quick projects we can’t usually justify sinking time into.

A while ago we built our Slackbot, it’s a bit of fun, from providing inspirational quotes to tracking who’s made the most cups of tea. It’s well on it’s way to doing everything you never wanted.

The Problem

DogsBOT reacts to discussions regarding lunch. Initially this was with ? emoji. Since we don’t eat spaghetti every day I switched it to the ? emoji but this also became routine.  What we needed was a less predictable, more intelligent reaction.  My criteria for this was:

  • Linked to the current weekly menu
  • Some element of chance

A Solution

The canteen menu for the week is available as a PDF on the site intranet. It was an easy choice to use it as the source for DogsBOT’s lunch reactions.  As there are multiple options each day DogsBOT would be able to pick one for today at random.

With that decided we just needed to convert the PDF of the menu to text.  Given my bias to use python, a quick google indicated PyPDF2 would be the perfect tool. Unfortunately the menu turned out to be almost entirely images.  All I was able to pull out was the title and a bunch of meta data.  I needed to switch to an image recognition tool.

For the image recognition I wanted to run the code locally so ignored the various cloud solutions.  This still left a lot of choice of software.  I found this guide which did everything I was looking for using OpenCV (to clean up the image) and Tesseract (to pull out the text).

Now I’d got the text, I needed to work out which day the food would be served on. I was starting to run out of time so I set-up a quick loop.  It assumes each item is from the day of the week it most recently passed.  Happy that this was mostly working so I moved on to converting the food to emoji.  I did this by attempting to convert each word to an emoji and using the ones that were successful.  In hindsight I would have been better off selecting reactions based on shortnames in this data as Slack reactions use them rather than emoji.

Conclusion

The new improved lunch plugin mostly works.  I had fun playing with PyPDF2, ImageMagick, OpenCV and Tesseract as well as learning a little more about how Slack reactions work.

Tesseract is impressively good.   Given that I’d been planning to just pull the text out of the PDF I didn’t spend huge amount of time comparing it with the alternatives since it did everything I needed.  If spent more time on this I’d like to spend more time tweaking the OpenCV commands to work with different lower quality images.

More hackathons

Whether we’re fitting out a storm trooper or camping in a field we all love spending a day out doing something different.  For our next hackathon we’re planning to try and break in to our internal servers.  If you’ve got any hackathons lined up you think we’re missing out on let us know in the comments.

Five Go on a Hacking Weekend

Last weekend (25th & 26th November 2016) Dogsbody Technology headed off to St. John’s church Hoxton in Shoreditch, London to attend (what turned out to be the last) Over the Air 2016.

Over the Air is an annual 2-day mobile developer event with a mix of technical workshops put on by the community, a Hackathon to celebrate programming & making as a creative discipline, and Lightning Talks to entertain and inspire.

This year the Dogsbody Technology team decided to do their first hack and enter the Hackathon Challenges for the first time – and boy did we have fun! It all started with us finding a 4ft Stormtropper while out shopping which we knew we could improve on! We named it ‘Dolly Stormageddon‘, or Stormy for short.

On Friday morning we packed the car full with Raspberrys Pi’s, Arduino’s, Lasers, Lego, wire, speakers, batteries, soldering irons, microphones, USB dongles, cable ties, SD cards, cables, drills, duct tape, sleeping gear and more! Heading off with a general plan of what we wanted to try and achieve.

After the welcome speech and Friday keynote presentation by Hadley Beeman on the effects of Brexit and Trump to the tech industry, we set ourselves up in the Crypt under the church and got to work.

We had a list of stuff we really wanted to do and a list of nice to haves as we knew time was limited to less than 24 hours!

Nexmo was a sponsor of Over the Air and so we decided to use their SMS API to make Dolly read out text messages. Rob set up the Nexmo SMS API and we used an existing Pushover script to communicate this to a Raspbery Pi which then used Amazon Ivona text to speech software (we picked Welsh) to read the text message out over a speaker we put in Dolly’s leg. This was all scripted/set up by Gary. We even added the function that if someone texted ‘shoot’ it made a blaster noise!

For a good demo you always need lights and movement so Dan wired up a laser pointer to his gun and Jim used Lego to mount a servo and programmed an Arduino to get his head to move side to side.

Finally we added an NFC Tag inside his chest with the number for people to text.

Testing included texts such as “I’ve got a brand new combine harvester” and the complete lyrics to Queens “I want to break free” – which is slightly strange spoken by a 4ft Stromtropper in a Welsh accent!

We entered three categories in the Hackathon Challenges –  The Nexmo APIs Challenge, The Best Hardware / IoT  Entry and The Best Use of Other Features. Below is our Show & Tell! We had exactly 90 seconds to present what we worked on.

WE WON!!!

The Best Hardware / IoT  Hack!! with an Nexmo Honourable mention

We got a pile of new toys to play with from our win and we couldn’t be happier

Dan, Jim, Claire and Rob attended a few talks but the hack took up most of our time, the always interesting and funny lightening talks included a  talk on ’10 stupid stuff I’ve bought on the internet’ (he had to narrow that down from over 40!) which include 1000 plastic ducks and entering an inflatable marathon whilst intoxicated.

Dolly and the Dogsbody Team are now home and the ultimate idea is Dolly will be in our office and alert us when a server goes down..we will rebuild Dolly better, faster, stronger…

Dogsbody Technology would like to say a BIG Thank you to the Organisers and sponsors of Over The Air throughout the years for a great event. We had an amazing time!

 

Feature image by Andy Piper