How to add sequence_delete_interval sub-command to delete part of a sequence?
Los mantenedores suelen responder en 4 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
Línea de trabajo
Start with the existing command entry points in mapillary_tools/commands/main.py and authentication flow used by authenticate.fetch_user_items. Review the proposed mapillary_tools/commands/sequence_delete_interval.py against the Graph API operations and existing command conventions, especially credential handling and interval ordering. Done means the command is registered, reliably identifies one sequence interval, confirms deletion safely, and reports failures without corrupting command state.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi,
Request to add a new sequence_delete_interval subcommand.
Background
I have noticed two somewhat frequently recurring issues that case some of the images in a sequence to be "2bad":
- The video stream is started before the GPS-position has stabilized.
- The GPS-receiver is bumped, causing the gps position to go off true significantly.
With the Rioch ThetaX, the first 1~2 GPS positions are usually always inaccurate; in most cases it just annoying as it isn
t visible on the map, however in some cases it adds quite a few phantom images. (as in cfJCbTLBPqgEAvY0W3GuwS it adds 20 phantom images. Likely mostly due to handling the to start the recording so Issue #2. Other handling mistakes also tend result in 12 GPS positions that are really inaccurate, and interpolation can lead to quite a few phantom images in the middle of a sequence (that are nearly identical).
With the Dashcam seems provide more consistent position data overall, but it is not uncommon that the first half of the first video file (after power-on) has really inaccurate position data.
Cleaning up the resulting faulty images in the Web-GUI is really tedious and time-consuming; especially as one ether has to wait a long time for the image delete to be completed, or try to continue with the next one and risk that completion message interrupts the ongoing request before confirmation and thus corrupts the Web-GUI state.
Attepted solution
Add a new sequence_delete_interval subcommand to mapillary_tools, to automate the removal of a interval in a sequence, using two image key form the Web-GUI to mark the interval to be removed.
(Attempting to Vibe-code this may not have been the best ida, but it is a starting point for further work - too late to do more today. Retrieving the keys to delete seems to workable, but the authentication for delete proved problematic gotr Gemini.)
mapillary_tools/commands/sequence_delete_interval.py
import requests
from .. import authenticate
GRAPH_URL = "https://graph.mapillary.com"
class Command:
name = "sequence_delete_interval"
help = "Delete a range of images in a sequence between two keyframes"
def add_basic_arguments(self, parser):
parser.add_argument("start_key", type=str, help="Starting image key/ID")
parser.add_argument("end_key", type=str, help="Ending image key/ID")
parser.add_argument(
"--yes",
"-y",
action="store_true",
help="Skip interactive deletion confirmation prompt",
)
def run(self, vars_args: dict):
start_key = vars_args["start_key"]
end_key = vars_args["end_key"]
skip_confirm = vars_args.get("yes", False)
# 1. Fetch user items dynamically via internal helper
user_items = authenticate.fetch_user_items()
user_token = None
if user_items:
# Handle list or dict return types from fetch_user_items
item = user_items[0] if isinstance(user_items, list) and len(user_items) > 0 else user_items
if isinstance(item, dict):
user_token = (
item.get("user_upload_token")
or item.get("MAPGlobalUserAccessToken")
or item.get("user_access_token")
)
if not user_token:
raise RuntimeError(
"No saved Mapillary credentials found. "
"Please run `mapillary_tools authenticate` first."
)
headers = {"Authorization": f"OAuth {user_token}"}
print(f"Fetching sequence information for start image '{start_key}' and end image '{end_key}'...")
# 2. Fetch sequence IDs for keyframes
res_start = requests.get(
f"{GRAPH_URL}/{start_key}",
headers=headers,
params={"fields": "id,sequence", "access_token": user_token},
).json()
res_end = requests.get(
f"{GRAPH_URL}/{end_key}",
headers=headers,
params={"fields": "id,sequence", "access_token": user_token},
).json()
if "error" in res_start:
raise RuntimeError(f"Start key error: {res_start['error']['message']}")
if "error" in res_end:
raise RuntimeError(f"End key error: {res_end['error']['message']}")
seq_start = res_start.get("sequence")
seq_end = res_end.get("sequence")
if not seq_start or not seq_end:
raise ValueError("One or both images do not belong to a valid sequence.")
if seq_start != seq_end:
raise ValueError(f"Images belong to different sequences ({seq_start} vs {seq_end}).")
# 3. Retrieve sequence image list
seq_res = requests.get(
f"{GRAPH_URL}/image_ids",
headers=headers,
params={"sequence_id": seq_start, "access_token": user_token},
).json()
if "error" in seq_res:
raise RuntimeError(f"Sequence query error: {seq_res['error']['message']}")
images_in_seq = seq_res.get("data", [])
detailed = []
for img in images_in_seq:
img_id = str(img["id"])
item = requests.get(
f"{GRAPH_URL}/{img_id}",
headers=headers,
params={"fields": "id,captured_at", "access_token": user_token},
).json()
if "id" in item:
detailed.append(item)
sorted_imgs = sorted(detailed, key=lambda x: x.get("captured_at", 0))
ordered_ids = [str(x["id"]) for x in sorted_imgs]
idx_start = ordered_ids.index(start_key)
idx_end = ordered_ids.index(end_key)
if idx_start <= idx_end:
target_ids = ordered_ids[idx_start : idx_end + 1]
else:
target_ids = ordered_ids[idx_end : idx_start + 1][::-1]
print(f"\nFound {len(target_ids)} image(s) to delete:")
for idx, img_id in enumerate(target_ids, 1):
print(f" {idx}. {img_id}")
if not skip_confirm:
confirm = input(f"\nAre you sure you want to delete these {len(target_ids)} images? [y/N]: ")
if confirm.lower() not in ("y", "yes"):
print("Aborted.")
return
# 4. Perform Deletion
for idx, img_id in enumerate(target_ids, 1):
del_res = requests.delete(
f"{GRAPH_URL}/{img_id}",
headers=headers,
params={"access_token": user_token},
)
if del_res.status_code == 200:
print(f"[{idx}/{len(target_ids)}] Deleted: {img_id}")
else:
print(f"[{idx}/{len(target_ids)}] Failed to delete {img_id}: {del_res.text}")
Changes to mapillary_tools/commands/main.py
...
from . import (
authenticate,
process,
process_and_upload,
sample_video,
upload,
video_process,
video_process_and_upload,
zip,
+ sequence_delete_interval,
)
mapillary_tools_commands = [
process,
upload,
sample_video,
video_process,
authenticate,
process_and_upload,
video_process_and_upload,
zip,
+ sequence_delete_interval,
]
...
- Lenguaje dominante
- Python
- Estrellas
- 316
- Forks
- 145
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mapillary/mapillary_tools
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
mapillary/mapillary_tools#827 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
mapillary/mapillary_tools#819 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mapillary/mapillary_tools#783 · 3 comentarios ·
Los mantenedores suelen responder en 4 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
mapillary/mapillary_tools#748 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
mapillary/mapillary_tools#747 · 9 comentarios ·
Los mantenedores suelen responder en 4 días
Todos los issues de mapillary/mapillary_tools
Issues similares
-
Broken links found in docsAbiertodocs pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
pydantic/pydantic-ai#10113 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
GreedyBear-Project/GreedyBear#1727 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
ARM-software/CMSIS-DSP#354 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
kiat/codeAssist#391 ·
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
darnitdevorg/darnit#587 ·
Los mantenedores suelen responder en 1 día