Skip to content

feat: add batch_procedures() and comparison grid to LandmarkDiffPipeline#406

Open
P-r-e-m-i-u-m wants to merge 1 commit intodreamlessx:mainfrom
P-r-e-m-i-u-m:feat/batch-procedures
Open

feat: add batch_procedures() and comparison grid to LandmarkDiffPipeline#406
P-r-e-m-i-u-m wants to merge 1 commit intodreamlessx:mainfrom
P-r-e-m-i-u-m:feat/batch-procedures

Conversation

@P-r-e-m-i-u-m
Copy link
Contributor

Closes #403

Adds batch processing mode to LandmarkDiffPipeline that applies multiple procedures to the same image in a single run.

Changes

landmarkdiff/inference.py

  • Added batch_procedures(image, procedures) method to LandmarkDiffPipeline
    • Extracts landmarks once and shares them across all procedures
    • Calls generate() for each procedure
    • Returns list of results + comparison grid image
  • Added _build_comparison_grid() helper
    • Stacks input + all procedure outputs horizontally
    • Adds labeled bar above each panel (Original, Rhinoplasty, etc.)

Usage

pipe = LandmarkDiffPipeline(mode="tps")
pipe.load()
result = pipe.batch_procedures(image, ["rhinoplasty", "blepharoplasty", "mentoplasty"])
cv2.imwrite("comparison.png", result["grid"])

…DiffPipeline

Signed-off-by: 🄂ʏᴇᴅ 🄰ʙᴅᴜʟ 🄰ᴍᴀ🄝 ✧ <amanbaba9404522@gmail.com>
@dreamlessx
Copy link
Owner

Thanks for the quick turnaround @P-r-e-m-i-u-m! The batch_procedures() API and comparison grid look good structurally.

Two things to fix before merge:

  1. CI lint failure — ruff is flagging something. Quick fix:

    ruff check landmarkdiff/inference.py --fix
    ruff format landmarkdiff/inference.py
    git add -u && git commit -m "style: fix lint" && git push
  2. Minor: landmark sharing — the method calls extract_landmarks(image_512) but the result (face) is never passed into self.generate(), which extracts landmarks again internally. This works correctly but doesn't actually share the landmark computation. Not blocking — we can optimize in a follow-up.

Fix the lint and this is good to merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add multi-procedure batch processing mode

2 participants