Add Action Recognition Block#2397
Open
Matvezy wants to merge 5 commits into
Open
Conversation
…er/action-rec Resolve loader.py import conflict (keep both action_recognition and openrouter imports). Collapse Action Recognition v1->v2: drop the old frame-count v1, make the time-domain block v1, and expand its docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Providers behind an OpenAI-compatible API (e.g. DeepInfra-proxied Gemini) do
not always honor the response_format json-schema, returning the answer as a
bare JSON string ("A"), under a different key ({"answer": "A"}), or in a
short sentence. _parse_letter only accepted {"letter": "X"} and used raw[0]
as a fallback, so every such answer parsed to None and the block emitted an
empty letter on every frame. Harden the parser to accept these shapes (case-
insensitive, word-boundary matched to avoid false hits like the B in "Based")
and add regression tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@grzegorz-roboflow @PawelPeczek-Roboflow this PR is getting the action recognition block across the line, taking basically the latest state me and @probicheaux had it at working and merging. Would love your review whenever you have a chance 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds an Action Recognition workflow block that classifies actions in a video stream via an OpenAI-compatible VLM, sending a rolling window of recent frames and getting back a single letter from caller-defined choices. Key inputs: video image, prompt, choices, timing (window_seconds/stride_seconds/sample_fps), and provider settings (base_url/model_name/api_key); outputs letter, output, and error_status.
Type of Change
Testing
Tested locally
Test details:
Unit tests cover manifest validation, the buffering/firing logic (mocked client), and the response parser across the answer shapes providers actually return. Also verified end-to-end locally in workflows with different api endpoints, and football and tennis videos for action recognition.
Checklist
Additional Context
N/A