Mapillary Tools 0.15.0 is released

This release is mostly about videos: geotagging them from GPX tracks and from their own GPS is much more reliable, and more cameras are supported.

New

  • NMEA logs for videos: geotag videos from the NMEA log of an external GPS logger, the same way as from a GPX file (–video_geotag_source nmea).
  • More dashcams: the GPS of Novatek-based dashcams (Viofo A129 and A139, Vantrue N4, Anker Roav C1 Pro and others) is now read directly, so their videos can be sampled into images without ExifTool. GKU D900 and Abask A8 dashcams are read through ExifTool.
  • Saved organization names: save an organization ID under a name once (–organization_key ID --organization_name work), then upload with --organization_name work.
  • check_upload_history: see whether your files were already uploaded from this computer, without logging in.
  • Command reference: what each command does, its options, and common pitfalls: mapillary_tools/docs/command_reference.md at main · mapillary/mapillary_tools · GitHub

Major fixes

  • Videos with GPX tracks: a GPX is now lined up with the video correctly: by the video’s own GPS clock (at its real rate for timelapses), or by --video_start_time. Before, a track could land minutes off, for example on GoPro videos whose GPS starts late, or in the wrong place on timelapses. Sampling videos into images now follows the GPX too.
  • A GPX can rescue a video whose own GPS is missing or too noisy, such as a GoPro HERO12, which has no GPS.
  • FFmpeg 9: sampling videos into images works again.
  • LabPano: video times were about 10 years off, which crashed uploads with a GPX. If you sampled LabPano videos with an older version, sample them again.
  • No more silent skips: every file you give process is either processed or reported with an error saying why. GPX and NMEA files that cannot be read now say what is wrong with them.
  • Faster uploads: files that were already uploaded are skipped without being read again.

Before you upgrade scripts: some files that used to be skipped silently now fail (exit code 6). See “Backward compatibility” in the release notes.

Upgrade: pip install --upgrade mapillary_tools, or download the executable for your platform from the release page.

A new Desktop Uploader will follow…

Release notes:

8 Likes

Thank you for all the improvements to mapillary_tools. :+1: I have not tested everything yet but so far things work as expected for me.

A few mentions though:

  • Setting --organization_name should probably be managed completely through authenticate rather than partially through upload because this is probably the behavior most users might expect.

    Btw, should organization aliases be stored per user profile?

  • I really appreciate the Checksumming progress bar because it finally gives feedback on what mapillary_tools is doing and that it has not simply locked up. However, there are also other long running phases or steps before upload that may also benefit from a progress bar, if possible:

    • description file JSON schema validation (the description file may become very large)

      On a side note, the description file structure also seems inefficient for processing, parsing, and validation to me but I may be missing something. It has lots of redundant bytes and sequences are grouped a bit weirdly through MAPSequenceUUID member values on every image object. :face_with_hand_over_mouth:

    • checking files for existence
      Though, this may have already been covered by the Checksumming progress bar.

Is this security implications free? Just asking.

Thanks @Gitne for trying the release and for the detailed feedback.

Organization names. Saved names are already stored per user profile. Each one is a MAPOrganization.NAME = ID line in that profile’s section of the config file. authenticate shows them under each profile when it starts, and authenticate --user_name PROFILE --organization_name NAME --delete removes one. Deleting a profile also removes its names. Keeping them per profile makes sense because being a member of an organization belongs to an account: work can point to different organizations in different profiles, and another account may not be allowed to upload to yours.

You’re right that saving through upload and deleting through authenticate is lopsided. authenticate currently always logs in again, so saving a name there would mean typing your credentials again. To save a name without uploading anything, run upload --dry_run --organization_key ID --organization_name NAME on a processed folder. It looks up the organization, saves the name and uploads nothing.

Progress before the upload. Before the checksum bar appears, upload does two things without any output. It loads and validates the description file, then searches the folders for the files the description file lists. That search is the existence check you mention, and the checksum bar doesn’t cover it. With 100,000 images on a fast SSD, each step takes about 5 seconds. On a USB disk or a network share the folder search can take much longer.

Description file format. It’s a flat list with one self-contained entry per file. That means you can filter, merge or edit a description file with ordinary JSON tools, pipe it through --desc_path -, and handle each entry without knowing anything about the others. The sequence is stored on each image for the same reason, and process writes short values (“0”, “1”, …). It is redundant, but that’s not where the time goes. Parsing a 45 MB description file for 100,000 images takes about 0.15 s, while validating the entries takes over 4 s. Changing the format would also break every script and application that reads or writes it today.

check_upload_history. It runs entirely on your computer. It reads the description file, reads your files to compute their checksums, and looks those up in the local upload history that upload writes. It doesn’t contact Mapillary, doesn’t read your profile or token, and adds no upload records. “Without logging in” means just that: no account is involved. Two things worth knowing:

  • The answer comes from local records only. It means “uploaded from this computer before”, not “on Mapillary now”. The checksums are MD5, which is fine for recognising your own files but is not an integrity check.
  • The upload history stores the descriptions of uploaded files (paths, coordinates, capture times) as plain JSON, as earlier versions did too. Anyone who can read that folder can see what you uploaded. It’s in the mapillary_tools data folder (~/Library/Application Support/mapillary_tools/upload_history on macOS, ~/.local/share/mapillary_tools/upload_history on Linux), or wherever MAPILLARY_UPLOAD_HISTORY_PATH points. Setting that variable to an empty value turns the history off, but then already uploaded files are no longer skipped.
1 Like

Thank you for the detailed explanation. :smiley:
I do not want to spar with you but just share my thoughts and troubles that I and potentially many other contributors experience too.

Organization Names

I would really like to see this properly resolved through authenticate only because it seems like a natural place to be done. Having to resort to workarounds to add organization names, which is valid and proper functionality is imho unprofessional. I do not recall how exactly I have added the name for my organization but it must have been something similar to what you proposed, which is quite telling already and shows that a workaround should not be a permanent solution.

Makes sense although neither mapillary_tools nor the Mapillary upload backend does seem to enforce this relation. The last time I checked, any contributor could upload to any organization. :wink: Just mentioning it. And, I am okay with it.

Progress Before Upload

It is true that the existence check on SSDs is very quick, even for large amounts of files. However, many users continue to use HDDs for many reasons. So, like you say, on USB, hard disk, and network drives latency is the largest contributing factor here. With an average access time of 10-15 ms on modern HDDs at 100k files things multiply quickly to ≈ 1000-1500 s ≈ 16:40-25 minutes. Hence, it is a non‑neglegible issue. Unfortunately, most systems cannot do batch existence checks. But perhaps directory listing files with os.scandir() and checking just file entries instead of doing file‑by‑file checks with os.path.exists() could improve the situation here already? Or, you could move the file‑by‑file existence check into the checksumming step, which requires a file to exist to succeed anyway.

Description File Validation

Yes, mapillary_tools’ JSON validator works acceptably fast on x86/x86_64 machines with a large L2 cache, high single core throughput, and a working Python JIT compiler. However, the Python situation on ARM is still quite dire today. :slightly_frowning_face:
I do not care much about the description file format per se, that is its filtering or editing properties. However, I do care that lots of redundant bytes clog up limited L2 caches on many/my ARM machines. My general issue is that mapillary_tools should be heavily optimized for quickly processing large amounts of files no matter what machines it runs on because this is its daily business. So far, using mapillary_tools feels like riding with the parking/handbrake on.

Whenever one has to deal with thousands of files or items, one usually wants to have progress indicators, even if they often progress quickly because the next order of magnitude is always just around the corner.

Thanks @GITNE. No sparring taken, this is useful.

Organization names. Agreed. There’s now a pull request for exactly that: #953 adds authenticate --user_name PROFILE --organization_key ID --organization_name NAME. It doesn’t log an existing profile in again: it checks the saved token, looks up the organization and saves the name. Saving through upload keeps working for anyone who already does it that way.

Organization membership. You were right to check. mapillary_tools only looks the organization up by its ID; it doesn’t check membership itself. The server checks it now and doesn’t accept an upload to an organization the account isn’t a member of. Looking into it turned up a bug, though: mapillary_tools 0.15.0 doesn’t report that refusal. It says the upload finished and writes it to the upload history, so later runs skip those files as already uploaded. #955 makes it stop with an error that says to check the membership, and it records nothing. If this ever happened to you, those files weren’t uploaded: once you’ve joined the organization, or without --organization_key, upload them again with --reupload.

Progress before the upload. You’re right that there’s work for every file before the checksum bar. 0.15.0 lists the folders with os.walk, which uses os.scandir, but it does that three times (images, videos, zip files). It also resolves the full path of each file it finds twice, and once more for each entry of the description file. #952 lists the folders once and resolves each folder once, checking each file only for being a link. It also shows progress bars while it loads the description file and finds the files. With 100,000 images on an SSD, finding the files went from 7.2 s to 2.3 s. I haven’t measured on a hard disk.

It’s a folder search rather than a check during checksumming because it does two other jobs: it picks the entries of the description file that belong to the folders you pass, and it finds zip files, which the description file doesn’t list.

Validation on ARM. The numbers I quoted were measured on an Apple M4 Pro. That’s ARM, but with fast cores and a large cache, so it’s close to the best case, and some machines will take longer. I agree with the general point: a tool that handles this many files should be quick on any machine, and it should show progress even for steps that are usually short.

1 Like

Great! :+1: Looking forward to all the fixes and speedups in the next release. Thank you.

1 Like

We just released 0.15.1 to address some of these. @GITNE thank you for your valuable feedback.
https://forum.mapillary.com/t/mapillary-tools-0-15-1-is-released/

2 Likes