Photos are in random order in upload screen

I often go through my photos before uploading then, and it has been very irritating that the photos often are in somewhat random order.

Within Mapillary:

Proper order:

This makes it really time consuming to process!

Anybody else seeing this?

1 Like

I’m not seeing and I’m nothing to do with Mapillary themselves, but the best way to figure out why this is happening would be to create a minimal reproducable test case: take a copy of the folder containing all the images, delete all except three that are out-of-sequence, once you’ve got a minimal number that show the problem, zip 'em up and share them somewhere (google drive, dropbox, onedrive etc).

Then people can download that zip file and save it to their Android upload dir to see if they have the same problem, they can also check out the EXIF data in the images and the file dates to see if there’s an obvious cause. Even if we can’t pinpoint the problem, if other people can at least reproduce it then the devs will have a proper end-goal (“make sure these three images are displayed in the right order” is a much more doable task than “figure out why some people see an ordering problem and then fix it”)

Analysing the directory is an interesting approach, I had not though of that, I will definitely try to make such a test.

However, I sincerely doubt the problem lies in the directory or the images themselves. Reading the EXIF data from the images and using that to sort them, would cause long delays every time you open a folder of images. Even on a computer with a fast disk, sorting 600 images (my most common sequence size) by EXIF data would take a considerable amount of time.

The most logical strategy would be to sort by filename (fast, and should be sufficient for Mapillary photos), but clearly that is not done. My guess is that sorting information is stored in the app somewhere, or in configuration data, but I will follow your advice of creating a test folder to test that.

Loading the EXIF data shouldn’t take much time, even with 600 images. It’s binary and what, 1k of parsing per image maximum? No seek times because it’s on flash memory. It probably takes more processing than that to load the map.

That’s not to say it’s the way the app does it, it’s just that it’s not such an overhead.

@pbb It would be great if you can zip the sequence and send it over to me so I can debug and fix the problem

Sadly, as I expected, the messed up sorting order is not based on something in the images or their folder.

I made an exact copy of a folder with images that were in the wrong order (the only change being a different folder name). The copy showed up as a new sequence in the Mapillary app, but the images were now in the correct order.

This means two things:

  1. I cannot send anybody a copy of the folder to test on, because the error is not in the folder or the images.
  2. I can “fix” my problem by creating a copy of the randomly ordered folder, but this is quite cumbersome. (Simply renaming the folder does not help, for some reason Mapillary is able to see that it is still the same folder, and does not correct the order of the images.)

My guess is the app “caches” the sorting order of every sequence (this would be a logical decision, as it makes the app much faster), and that the sorting error is inside this cache.

1 Like

Are the timestamps on the images the same in both test dirs? If you make a copy they may have different creation/modification dates.

If renaming it doesn’t help but copying does, maybe they all have the same (bad) timestamp.

I double-checked the folders, and yes in both the original and copy folders, the time stamp are correct. (It would be a terrible file manager that changes timestamps on copy :grin:)

Interesting. I wonder how it manages to recognise that the dirs are the same after renaming? Maybe try a reboot then rename before opening the app, it could have a file handle to the dir open, which won’t change when the name does. If that fixes it then (if your Android version allows it) set system -> recent app management to “deep clear”, then it’ll force terminate Mapillary when you swipe it off the task manager, removing all its file handles.

I have the same problem. Huawei Mate 20 Pro.

I had the same problem on Oneplus 3t running on 9.03 (Pie)

Okay, I know how the order of photos is determined.

The Mapillary app is not doing any ordering at all; it is using the order in which the images are stored. I did the following test:

  1. Create an empty folder inside the folder where all the sequences are stored.
  2. Copy over a single, recent photo from another folder.
  3. Copy over another, somewhat older photo.
  4. Copy over an even older photo.

Now open Mapillary, and look for the new sequence. It will show the photos in the order in which they were copied over, not in any way sorted.

So the problem is, the Mapillary app does not do any sorting of the photos in the sequences. If the OS is causing the photos to be written in random order (“write-behind”, “delayed writing” or whatever), then Mapillary will show them in this random order in the sequence/upload screen.

1 Like

@Ovi, is there any chance Mapillary can implement sorting of the images (by filename should be enough in 99.9% of situations) in the upload tab of the Android app?

Nice detective work! So with that in mind, save this to a file:

#!/bin/sh
cd /sdcard/Android/data/app.mapillary/files
files=$(find -name '*.jpg' | sort)
for f in $files
do
    sleep 0.001
    touch $f
done

Save it to the root of your flash memory as “fix_mapillary_timestamps.sh” (I use DroidEdit to edit scripts, save to “local” to save to root of the card) then install a terminal emulator (“shell terminal emulator”), and you should then be able to type sh /sdcard/fix_mapillary_timestamps.sh in the terminal to fix the ordering.

And write to support@mapillary.com and ask for the images to be ordered by name, not timestamp.

If that doesn’t work then they’re being added in whatever order the filesystem wants to show them, Linux makes no guarantees on that. If find /sdcard/Android/data/app.mapillary/files shows the bad order, then they’re relying on the default filesystem that Android uses but your device manufacturer is using something different. In that case they still need to sort by name.

I’ve noticed the same problem for a few years now. I can confirm it for my last phone (Motorola G2, Lineage) and my current phone (Huawei P20 lite).
It’s not a big problem, but a fix would be nice though.