Recently I took part in AI Hackaton (2nd prize btw!) in Minsk with a pretty interesting challenge. My team tried to build a model that detects weeds at fields aerophotos. The photos were taken with a special multispectrum camera and looked like this:
A sample of image with two types of weeds marked up.
We marked up the photos manually and fitted the model (it was based on this repository). Results looked promising before I tried to feed the model with my own photo. I was kind of surprised to see a lot of “weeds” on my face.
We expected some smart ass from the jury could try to do the same, so it was obvious problem to resolve. The solution was straigtforward - we needed to fit the model not only with the fields photos, but also with various crap - the more variety the better. At the same time we were limited by schedule, so we could not feed the network gigabytes of data trying to reach the variety.
So the solution was to create collages.
How to create collages
First of all you need to find wide variety of pictures. It’s pretty easy. Open Dataset is our friend here. Find a link for “Image URLs and metadata” file and download it.
You need nothing specific but almost standard libraries - numpy
, PIL
, requests
, pandas
. Last two are not really that required, however I guess you have them installed.
Let’s make pictures with 3*4 crops. These pics were good for the hackaton solution (quick and dirty), more mature solutions may need more random included.
The script generates pics 2048*1536 - that’s what we needed. For most problems it’s too big, so you may need to tune it a bit.
Result images may looks impressive.
This guy is watching you!
A puppy wearing hood, a chart, fire and a naked man. Nice combo!