BUG: Installing Semantic Search after videos are indexed skips video frame embedding and semantic scoring backfill

Open
#1,800 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@neo0007777 is already working on this.

Since Nov 30, 2026.

  • #1801 by @neo0007777 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend, database

Research direction

Read backend/app/routes/models.py and the existing backfill tests in backend/tests/test_models.py; compare the model installation flow with the folder sync flow described in the issue. The issue identifies the missing video processing and scoring tasks, and done means installing the semantic tier backfills previously indexed videos as well as images. Pull request #1801 is already open for this issue.

Written by the indexing model from the issue text.

Description

bug
Is there an existing issue for this?
  • I have searched the existing issues
What happened?
Summary

When a user indexes folders containing videos before installing the Semantic Search (semantic) model tier, later installing the semantic models only backfills image embeddings and image semantic scores — it never submits video_util_process_unembedded_frames or semantic_util_score_videos.

As a result, every video indexed prior to installing Semantic Search remains permanently unembedded (video_frames.isEmbedded = 0, zero rows in video_frame_embeddings, zero semantic tags in video_classes), and GET /videos/semantic-search omits all of those videos (or returns "No video frames have been embedded yet."). Even restarting the app does not fix it.


How Users Hit This
  1. On initial setup/AI tagging, ensure_ai_tagging_models() (backend/app/utils/model_bootstrap.py:22-30) installs the preferred YOLO tier + facenet, not the semantic tier (siglip2_base_vision, siglip2_base_text, siglip2_base_tokenizer).
  2. User adds/syncs a folder containing photos and videos (post_sync_folder_sequence in backend/app/routes/folders.py:209-242 or post_ai_tagging_sequence at 180-199):
    • video_util_process_untagged_videos() extracts keyframes into video_frames (default isEmbedded = 0 in backend/app/database/video_frames.py:37).
    • video_util_process_unembedded_frames() (backend/app/utils/videos.py:1120-1124) skips embedding because SigLIP2_Base_Vision.onnx is not installed yet ("SigLIP2 vision model not installed; skipping frame embedding pass").
  3. Later, user opens Settings -> AI Models -> Available and installs the Semantic Search tier (POST /models/setup with tier="semantic", or POST /models/download/siglip2_base_vision).
  4. submit_embedding_backfill_if_semantic() (backend/app/routes/models.py:40-59) runs for images only.
  5. After backfill completes, searching via GET /videos/semantic-search (backend/app/routes/videos.py:114-173) never finds the previously indexed videos until the user happens to trigger another folder sync or toggle AI tagging off/on.

Root Cause

In backend/app/routes/models.py:40-59:

def submit_embedding_backfill_if_semantic(
    model_keys: List[str], executor: ProcessPoolExecutor
) -> None:
    if any(
        MODEL_REGISTRY[key].get("feature") in SEMANTIC_FEATURES for key in model_keys
    ):
        executor.submit(semantic_util_build_label_embeddings)
        executor.submit(image_util_process_unembedded_images)
        executor.submit(semantic_util_score_images)
        executor.submit(xmp_export_if_enabled)
  • Unlike post_ai_tagging_sequence (backend/app/routes/folders.py:197-198) and post_sync_folder_sequence (backend/app/routes/folders.py:240-241), submit_embedding_backfill_if_semantic() never submits video_util_process_unembedded_frames (backend/app/utils/videos.py:1096, whose own docstring describes it as "the video counterpart of image_util_process_unembedded_images") or semantic_util_score_videos (backend/app/utils/semantic_labels.py:253).
  • App startup in backend/main.py:115-117 submits semantic_util_build_label_embeddings, semantic_util_score_images, and semantic_util_score_videos, but also does not run video_util_process_unembedded_frames, so restarting does not recover unembedded video keyframes either.

Expected Behavior

Installing a semantic model via POST /models/setup or POST /models/download/{model_key} should backfill both photos and videos:

  • video_util_process_unembedded_frames (already self-gating when SigLIP2_Base_Vision.onnx is missing)
  • semantic_util_score_videos (already self-gating when label embeddings aren't cached yet)

(Optionally, the Semantic Search Installed info dialog in frontend/src/pages/ModelManager/AvailableTab.tsx:226-237 could also mention photos and videos rather than only photos.)


Affected Files
  • backend/app/routes/models.py (submit_embedding_backfill_if_semantic, lines 40-59)
  • backend/tests/test_models.py (TestEmbeddingBackfillTrigger, lines 918-994)
  • backend/tests/test_metadata_export_pipeline.py (lines 89-102)
Record
  • I agree to follow this project's Code of Conduct
Dominant language
Python
Stars
322
Forks
793
Avg merge
6d 10h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/PictoPy

All issues in AOSSIE-Org/PictoPy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.