The problem in brief
Screenshots were taken at random places in a Minecraft world. For 774 of them you know the position where they were taken, plus the camera's yaw (left-right rotation) and pitch (up-down). For 952 others you only have the image, the yaw and the pitch, and you must say where the camera was. The images are tiny ( or pixels) and no two screenshots share a position. It is a visual geolocation problem, like guessing the country from a street photo.
How you are scored
With the mean Euclidean distance between predicted and true positions,
So gives 0 points and gives 100 points. The Kattis program must run in 1 second, so in practice you compute the predictions offline and submit a program that prints them. The true positions of the test images are hidden; we estimate with 5-fold cross-validation on the 774 labelled screenshots.
First look at the data
- The training positions cover the map uniformly, with a typical spacing of about 40 blocks between neighbouring screenshots: no two images show exactly the same spot.
- Always answering the centre of the map gives , 8 points. That is the score of knowing nothing.
- Looking at the images, what changes with position is not objects but the landscape palette: green plains, dark jungle, blue ocean with sandy islands, snowy mountains, orange mesa. Minecraft generates biomes, large regions of a few hundred blocks with a characteristic look.
- Many screenshots are mostly sky (high pitch or a view over the sea), and the sky is the same blue everywhere.

The left map is the whole idea: colour is a (weak) function of position. Nearby screenshots look alike because they are in the same biome.
A first baseline
The natural first try for "find similar images" is a pretrained CNN. We describe each screenshot by the 512-dimensional pooled features of an ImageNet ResNet-34 and predict the position of the most similar training image (cosine similarity, 1-nearest neighbour).
| approach (5-fold CV) | points | |
|---|---|---|
| always the map centre | 953 | 8 |
| ResNet-34 features, 1 nearest neighbour | 973 | 5 |
| ResNet-34 features, weighted average of 10 neighbours | 788 | 35 |
The 1-NN is worse than guessing the centre. Two lessons. First, ImageNet features describe objects and shapes (a "mountain", a "tree"), which exist everywhere in the world; they barely encode which green or which sand. Second, under a mean-distance metric, committing to one neighbour is risky: a wrong match costs up to 2 500, while averaging several plausible neighbours hedges toward the middle of the candidate area.
The key idea
Describe the image by its colour distribution, without the sky, and average the positions of the most similar screenshots.
- Convert to HSV and quantise each channel into 16 levels, giving colour bins. Fine bins matter: Minecraft blocks have exact, repeated colours, so "this exact green of jungle leaves" is a strong clue that coarse bins blur away.
- Drop the sky pixels (bright, blue hue, moderate saturation) before counting: they carry no information about position and, depending on the pitch, can fill most of the image, which would make every high-pitch screenshot look like every other.
- Compare histograms with the Hellinger similarity: take the square root of each normalised histogram, L2-normalise, and use the dot product. The square root damps dominant colours so that a small patch of sand or snow still counts.
- Predict with a soft -nearest-neighbour regression: take the most similar training screenshots and average their positions with weights , , where is the similarity.
Why averaging is right for this metric: if the evidence says "this is jungle, and jungle exists in three regions", the point that minimises the expected distance lies between those regions (it is the geometric median of the plausible positions; the weighted mean is a simple stand-in for it), not in one of them. Small trusts close matches; larger and hedge more. We also tried pulling predictions further toward the map centre, and it only hurt (from 551 to 560 with 10 % shrinkage): the neighbour averaging already hedges enough.

The full solution
solution.py (about 80 lines):
q = np.minimum(hsv.reshape(-1, 3) * 16 // 256, 15) # 16 levels per channel
q = q[~is_sky(hsv).reshape(-1)] # drop sky pixels
h = np.bincount(q[:, 0] * 256 + q[:, 1] * 16 + q[:, 2], minlength=4096)
f = np.sqrt(h / h.sum()); f /= np.linalg.norm(f) # Hellinger embedding
S = F_test @ F_train.T # cosine similarities
# 10 best neighbours, softmax weights with temperature 0.02, weighted mean of their (x, z)
The predictions are computed once (seconds on a CPU) and written as then for each test image, which a trivial program prints within Kattis's 1-second limit. Yaw and pitch are not used by the final model; we only exploit pitch indirectly, by removing the sky that high-pitch views are full of.
Results
5-fold cross-validation on the 774 labelled screenshots (the official test positions are private):
| approach | estimated points | |
|---|---|---|
| map centre | 953 | 8 |
| ResNet-34 features, 1-NN | 973 | 5 |
| ResNet-34 features, | 788 | 35 |
| HSV histogram, 6 levels per channel, | 662 | 56 |
| HSV histogram, 16 levels, | 601 | 67 |
| 16 levels, sky removed, , (final) | 551 | 75 |
| same + 10 % of ResNet features in the similarity | 550 | 75 |
| same + shrink 10 % toward the centre | 560 | 73 |
The errors are very unequal (right panel of the first figure): the median is 423, almost the 100-point level, and 48 % of the screenshots are placed within 400 blocks, but a tail of confusions between distant regions of the same biome costs more than 1 000 each and pulls the mean up to 551. Reaching 400 on average would need cues that tell apart two forests of the same type: the shapes of specific landmarks, or a model that uses yaw and pitch to know which direction it is looking (a learned image embedding trained on these 774 images, with augmentations, is the natural next step).
What to remember
- Ask what actually varies with the target. Here it is the colour palette of biomes, not objects, so a hand-crafted colour histogram beats ImageNet features by a wide margin.
- Remove the parts of the input that carry no signal (the sky): it makes similarities meaningful.
- Fine quantisation and a square-root (Hellinger) transform are cheap ways to make histograms discriminative and robust.
- Match the prediction rule to the metric. For a mean distance, a weighted average of several plausible neighbours beats the single nearest neighbour.
- Validate the way you are tested: cross-validated mean distance, converted to points with the official formula, before ever submitting.