This weekend we participated in the Hackathon for good event at The Hague. We teamed up with Eddie, Joanna and Lora. It was a super random team, we met each other at meetups and hackathons and we turned out to be a great team. Eddie is a super extrovert developer/influencer, Lora is an awesome technical product owner, and Joanna is a “solve anything” data consultant.
We chose the Red Cross challenge, which was to classify damage of buildings based on their aerial images taken by drones and building outline geo data of St Martin. We decided to use a mix of tech:
- Python for image processing
- R for stats and geo plotting
- CustomVision from Azure to train our model.
- We were running our code on kaggle.
None of us had any experience working with image processing so it was quite a big challenge. We flew in on Thursday night already so we could prepare before the hackathon on Saturday.
Processing satellite images
The first obstacle was that images were huge (a few hundred megabytes). We could not open them in any browser. They were TIF images that include geo coordinates. After a bit of research we decided to use rasterio with python that can manipulate and crop these images for us.
Working with geojson data
Geojson is a type of dataset where the form of an object (like a building) is described by its boundary’s coordinates.
An example for a geojson dataset:
To display geojson we used geopandas, which reads the json dataset, returns a pandas dataframe and converts the coordinate data to a geometric dataset.
Combining Tif with geojson
We decided that to train our model we wanted to have a cropped image of all buildings that were pre-classified as:
- No damage
- Partial damage
- Significant damage
We had to find a way to crop the drone aerial images and find the buildings.
This resulted in a group of building images:
We then wanted to apply some filters so the model can better understand the images. We used equalization and edge detection to transform images.
We realized that not damage buildings have a more condensed pixel frequency and clearer edges.
We used scikit-image to manipulate images.
We then uploaded all the images into customvision.ai and trained the model (sorry but none of us has experience with ML, I promise next time we will build our own model).
We got a result of almost 80% precision.
CustomVision was very easy to use, but it’s a blackbox so we would need to read a bit more about how it was trained and what was the neural network architecture.
This was one of the best hackathons I’ve been to. The organisation was great, the datasets were amazing and we all had a lot of fun. We had fun activities, massage, awesome healthy food, drinks and sleeping place provided.
Things that didn’t go well
- Using kaggle was not that easy: We ran out of the max 500 output file limit (we had 7000 building images)
- Customvision.ai is a paid service and also has a limit of 5000 image uploads
- This was one of our hardest hackathon, I felt like I could not be a teamplayer as I wanted to be as I was busy learning
Things that went well
- I am so happy I could get to know the people in my team, I look up on all of them and respect them for their achievements
- The Hague is a pretty and fun city, when I last visited (at 19) I didn’t like it, but this time it was amazing. We went out for a lovely dinner on Saturday and we met really nice Dutch people
- The mentors were really awesome and I think we all learnt a lot this weekend
Thesis of our mentor from Red Cross, Daniel Kersbergen.