taking picture

Photo by Redd Angelo, public domain/CC0.

The Upload to Commons Android app allows users to easily upload pictures from their mobile device to the Wikimedia Commons database. Recent changes to the app have improved the image categorization functionality of the app by offering relevant category suggestions based on geolocation, and making category search more flexible.

Category suggestions based on geolocation

If a picture with geolocation is uploaded, nearby category suggestions are offered based on the categories of other nearby Commons images. We query the Commons MediaWiki API for the Commons categories of pictures with geolocation within a radius of 10km of the uploaded pic’s geolocation. The categories found are also cached using the quadtree library, so that if another picture with similar geolocation is uploaded, the cached categories are displayed and the API is not queried. This is done to reduce the load on the API, as people often upload several pics with similar locations.

Example: Uploading an image of the Hamilton Gardens with geolocation

Entering the title and description:
hamiltongardens_titledesc
Category suggestions obtained:
hamiltongardens_categories
If a picture with no geolocation is uploaded, nearby category suggestions can be offered based on the user’s current location. This is useful if someone doesn’t want to geotag their pictures, and uploads them while still in the same area. The feature is optional and only works if enabled in Settings (disabled by default for privacy).

Enabling the ‘use current location’ settings:
settings

More flexible category search

Category search (when typing in the search field) has been made more flexible. Prior to this, category search was done solely by prefix search. E.g. if you searched for ‘latte’, you would only get categories that start with ‘latte’, which excludes many potentially relevant categories (i.e. ‘iced latte’). Prefix search is useful when you are certain of what the exact name of the category you want is, but not so useful if you are unsure. So we wanted to retain prefix search, but also provide additional suggestions for relevant categories that do not share that prefix.

We query the Commons MediaWiki API for pages of type “Category” (srnamespace=14), maximum 10 results (srlimit=10). These results are aggregated with the prefix search results and the duplicate suggestions are eliminated before they are displayed.

Example: Searching for ‘latte’ categories:
latte_categories

Missing features/known bugs

The scope of this project mainly involves improving the categorization functionality of the app via the abovementioned 2 methods, but there are various other improvements that can be made as well.

The list of missing features and known bugs for the app can be found on GitHub issues, and you can read more about this project at the links below.

Josephine Lim (Misaochan) is a computer science graduate who lives in New Zealand. You can follow her blog for more information on her coding activities.

This post is based on Lim’s final project report on Phabricator. All screenshots in the post are courtesy of Lim.