s = Sequence(root,
                             skip_folders=['duplicates', 'success'],
                             skip_subfolders=True)

                # interpolate compass direction if missing
                directions = s.interpolate_direction()

                # Add a sequence uuid per sub-folder
                if len(s.file_list) > 0:
                    sequence_uuid = uuid.uuid4()
                    print("  sequence uuid: {}".format(sequence_uuid))

                file_list = []
                for i, filename in enumerate(s.file_list):
                    if is_image(filename):
                        filepath = os.path.join(filename)
                        if verify_exif(filepath):
                            if not retry_upload:
                                # skip creating new sequence id for failed images
                                create_mapillary_description(
                                    filepath, MAPILLARY_USERNAME,
                                    MAPILLARY_EMAIL, upload_token,
                                    sequence_uuid, directions[filepath])
                            file_list.append(filepath)
                        else:
                            missing_groups.append(filepath)
                    else:
                        print "   Ignoring {0}".format(
                            os.path.join(root, filename))
                    lib.io.progress(i, len(s.file_list),
        for root, sub_folders, files in os.walk(path):
            if ('duplicates' not in root) and ('success' not in root):
                s = Sequence(root, skip_folders=['duplicates', 'success'], skip_subfolders=True)

                # interpolate compass direction if missing
                print("\n=== Interpolating direction per sequence ...")
                directions = s.interpolate_direction()

                # Add a sequence uuid per sub-folder
                if len(s.file_list) > 0:
                    sequence_uuid = uuid.uuid4()
                    print("  sequence uuid: {}".format(sequence_uuid))

                file_list = []
                for i, filename in enumerate(s.file_list):
                    if is_image(filename):
                        filepath = os.path.join(filename)

                        # Determine whether use interpolated direction or not
                        if interpolate_directions and len(s.file_list) > 1:
                            bearing = directions[filepath]
                        else:
                            bearing = None

                        if verify_exif(filepath):
                            if not retry_upload:
                                # skip creating new sequence id for failed images
                                create_mapillary_description(filepath,
                                                             MAPILLARY_USERNAME,
                                                             MAPILLARY_EMAIL,
                                                             upload_token,