選項
首頁首頁 Skill 數據科學與機器學習 tao-analyze-gaps-vlm-bcq

tao-analyze-gaps-vlm-bcq

NVIDIA/skills NVIDIA/skills

透過將模型回應與真實值進行比對,從 VLM 二元分類問題的預測結果中篩選出假陽性與假陰性差距,並產出結構化的 JSONL 檔案及摘要報告,以供後續進行根本原因分析。

...展開全部
0
更新時間 2026-09-25

VLM 二元分類差距分析

讀取 VLM 預測的 JSON 檔案,將每個模型的輸出與真實標籤進行比對,並將假陽性(FP)與假陰性(FN)的失敗案例寫入 JSONL 檔案,同時附上摘要報告。

目的

在針對二元「是/否」評估任務執行 VLM 後,需將預測結果與真實標籤進行比對,以識別失敗案例。 此技能會產生一份結構化的 FP(假陽性)與 FN(假陰性)樣本清單,供下游 RCCA 階段(例如:cosmos 生成、根本原因分析)使用,以驅動 DEFT 迭代。

使用方法

在 TAO Toolkit 資料服務容器中,使用 Hydra 風格的 key=value 覆寫方式呼叫vlm_bcq動作:

gap_analysis vlm_bcq \
  predictions_json=/path/to/results.json \
  results_dir=/path/to/output/gaps

當預測結果中的video_id值為相對路徑時,請包含videos_dir:

gap_analysis vlm_bcq \
  predictions_json=/path/to/results.json \
  results_dir=/path/to/output/gaps \
  videos_dir=/path/to/videos/root

執行完畢後,從kpi_gaps_report.txt中擷取假陽性 (FP) 與假陰性 (FN) 計數,並將下游階段指向kpi_gaps.jsonl。

輸入參數

  • predictions_json:預測 JSON 檔案的路徑。必須為 JSON 陣列,其中每個項目皆包含video_id、response 及gt欄位。response和gt會以單字邊界比對方式進行解析——只要字串中任何位置出現「yes」或「no」即被識別。若樣本中同時存在兩者或皆不存在,系統會跳過該樣本並發出警告。
  • videos_dir(可選):用於解析相對video_id路徑的基目錄。若未指定,則將video_id值視為絕對路徑。

預測 JSON 格式:

[
  {
    "video_id": "/path/to/video.mp4",
    "response": "Yes, there is a collision.",
    "gt": "B. 否",
    "question": "是否存在衝突?"
  }
]

輸出

  • kpi_gaps.jsonl:每行一個 JSON 物件,對應每一個 FP/FN 案例。欄位包含:video_id(絕對路徑)、error_type(FP或FN)、question、ground_truth、response。
  • kpi_gaps_report.txt:包含總假陽性 (FP) 與假陰性 (FN) 計數的人類可讀表格。

若未發現任何差距,則不會寫入任何檔案,並會記錄一條訊息。

關鍵參數

參數 必填 說明
predictions_json 是 預測 JSON 檔案的路徑
results_dir 是 輸出目錄;若不存在則會建立
videos_dir 否 用於解析相對video_id路徑的基目錄

錯誤模式

錯誤 原因 解決方法
FileNotFoundError predictions_json檔案不存在 檢查路徑
ValueError:必須為 JSON 陣列 預測檔案不是清單 請將預測結果用[...]包起來
ValueError:缺少 'gt'/'response'/'video_id' 某個預測項目缺少必填欄位 檢查並修正預測 JSON 檔案
樣本被靜默跳過 response或gt同時包含或皆未包含 'yes'/'no' 檢查日誌中的警告訊息;檢視相關樣本
在 GitHub 上查看
---
name: tao-analyze-gaps-vlm-bcq
description: Extract false-positive and false-negative gaps from VLM binary-classification-question predictions by comparing model responses against ground truth, producing a structured JSONL file and summary report for downstream root-cause analysis.
license: Apache-2.0
---

# VLM Binary Classification Gap Analysis

Reads a VLM predictions JSON, compares each model response against ground truth, and writes FP/FN failure cases to a JSONL file with a summary report.

## Purpose

After running a VLM on a binary yes/no evaluation task, the predictions need to be compared against ground truth to identify failure cases. This skill produces a structured list of FP (false positive) and FN (false negative) samples that downstream RCCA stages (e.g., cosmos generation, root cause analysis) consume to drive a DEFT iteration.

## Usage

Invoke the `vlm_bcq` action inside the TAO Toolkit data services container with Hydra-style key=value overrides:

```bash
gap_analysis vlm_bcq \
  predictions_json=/path/to/results.json \
  results_dir=/path/to/output/gaps
```

Include `videos_dir` when `video_id` values in the predictions are relative paths:

```bash
gap_analysis vlm_bcq \
  predictions_json=/path/to/results.json \
  results_dir=/path/to/output/gaps \
  videos_dir=/path/to/videos/root
```

After the run, surface the FP/FN counts from `kpi_gaps_report.txt` and point downstream stages at `kpi_gaps.jsonl`.

## Inputs

- **predictions_json**: Path to predictions JSON file. Must be a JSON array where each item has `video_id`, `response`, and `gt` fields. `response` and `gt` are parsed with word-boundary matching — `'yes'` or `'no'` anywhere in the string is recognized. Samples where both or neither are present are skipped with a warning.
- **videos_dir** (optional): Base directory for resolving relative `video_id` paths. If omitted, `video_id` values are used as absolute paths.

**Predictions JSON format:**
```json
[
  {
    "video_id": "/path/to/video.mp4",
    "response": "Yes, there is a collision.",
    "gt": "B. No",
    "question": "Is there a collision?"
  }
]
```

## Outputs

- **kpi_gaps.jsonl**: One JSON object per line for each FP/FN case. Fields: `video_id` (absolute path), `error_type` (`FP` or `FN`), `question`, `ground_truth`, `response`.
- **kpi_gaps_report.txt**: Human-readable table with total FP/FN counts.

If no gaps are found, no files are written and a message is logged.

## Key Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| predictions_json | Yes | Path to predictions JSON file |
| results_dir | Yes | Output directory; created if it does not exist |
| videos_dir | No | Base directory for resolving relative `video_id` paths |

## Error Patterns

| Error | Cause | Fix |
|-------|-------|-----|
| `FileNotFoundError` | `predictions_json` does not exist | Check the path |
| `ValueError: must be a JSON array` | Predictions file is not a list | Wrap predictions in `[...]` |
| `ValueError: missing 'gt'/'response'/'video_id'` | A prediction item is missing a required field | Inspect and fix the predictions JSON |
| Samples silently skipped | `response` or `gt` contains both or neither 'yes'/'no' | Check logs for warnings; inspect those samples |

安裝 tao-analyze-gaps-vlm-bcq

請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。

下載 ZIP

複製儲存庫並將技能檔案複製到您的專案中。

git clone https://github.com/NVIDIA/skills/tree/main/skills/tao-analyze-gaps-vlm-bcq # Copy SKILL.md to your .claude/skills/ directory

複製 複製
快速設定: 將技能資料夾複製到 .claude/skills/ Claude 會自動偵測並使用該技能
儲存庫 NVIDIA/skills

相關技能

web-search
更新時間 2026-06-29
webapp-testing
更新時間 2026-06-29
lark-base
更新時間 2026-07-05
agentmail
更新時間 2026-06-29
OR