界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
设计与创意 · SKILL.md

chest-xray-analysis

chest-xray-analysis

【设计与创意】Operate MedRAX chest-X-ray classification, segmentation, report, visual-QA, phrase-grounding, and optional image-generation tools with explicit resource and output checks.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: chest-xray-analysis description: "Operate MedRAX chest-X-ray classification, segmentation, report, visual-QA, phrase-grounding, and optional image-generation tools with explicit resource and output checks." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

Chest X-ray analysis

Use this skill when a Researcher needs to operate one of MedRAX's chest-X-ray model tools on an already available JPG or PNG image. Treat all model outputs as assistive observations, not a diagnosis or a measurement suitable for clinical decision-making without qualified review.

Scope and routing

  • Use classification for a bounded screen across the 18 TorchXRayVision pathology labels.
  • Use segmentation for anatomical masks, an overlay, and approximate image metrics; route DICOM conversion or display concerns to image-data-utilities.
  • Use report generation for a deterministic two-section findings/impression draft.
  • Use CheXagent VQA for multi-image visual questions and broad CXR reasoning.
  • Use MAIRA-2 grounding for a phrase and its localized bounding boxes.
  • Use LLaVA-Med only for optional, broad medical visual QA; it is not the preferred detailed CXR interpreter.
  • Use RoentGen generation only for synthetic-image experiments when its manually supplied weights are already available.
  • Route tool selection, graph execution, and agent state to agent-orchestration; route benchmark claims to benchmark-evaluation.

Do not accept DICOM as a direct input to these tools: the tool schemas describe JPG/PNG paths. Use the image-data utility workflow before analysis when a DICOM study must be converted, and preserve the fact that conversion can change metadata and pixel semantics.

Fast decision matrix

NeedSelectMain cost or caveat
18-label abnormality likelihoodsChestXRayClassifierToolDenseNet weights; values are probabilities, not calibrated diagnoses
Organ boundaries/overlayChestXRaySegmentationToolPSPNet; area is not accurate for non-DICOM input
Findings plus impression proseChestXRayReportGeneratorToolTwo encoder-decoder models; substantial model storage
Ask one or more image questionsXRayVQAToolCheXagent 2-3B, remote code, usually CUDA and bfloat16
Locate a phraseXRayPhraseGroundingToolMAIRA-2; CUDA and optional bitsandbytes are practical constraints
General medical image QALlavaMedToolLarge optional model; implementation uses CUDA tensors directly
Create a synthetic CXRChestXRayGeneratorToolRoentGen weights must be supplied manually; no clinical use

For a low-memory run, start with CPU-side path/schema validation, then choose one CUDA tool: classifier for labels, segmentation for anatomy, grounding with 8-bit loading for localization, or CheXagent only when QA is essential. Keep report generation, LLaVA-Med, and RoentGen disabled until their weights, CUDA memory, and compatible dependencies are proven. This selection verifies resource discipline, not model quality; unrun models remain unverified.

Operating procedure

  1. Preflight without loading models. Run the bundled validator from scripts/validate_inputs.py. Confirm regular files, .jpg, .jpeg, or .png suffixes, required text fields, positive token/image parameters, and exact segmentation organ names.
  2. Declare resources. Record the requested device, dtype, quantization, caller-managed cache/temp locations, whether weights are already present, and whether the run may use external model access. Never silently download a large model or require credentials.
  3. Construct only the selected tool. Constructor options and model prerequisites are in references/api-reference.md and references/model-overview.md. Avoid initializing every tool at once.
  4. Invoke with the tool schema. MedRAX tools are LangChain BaseTool objects; pass the documented field names. They return a value plus metadata (except an error may be encoded in the value). Check analysis_status and preserve returned paths before interpreting content.
  5. Check output semantics. Classifier scores are per-label likelihood values. Segmentation metrics are mask-derived image metrics. Grounding boxes use normalized coordinates unless converted to original-image pixels. Generated prose and images require human review.
  6. Recover narrowly. For an error, use the matching row in references/troubleshooting.md; do not switch devices, quantization, or model sources blindly. Re-run only after recording the changed setting.

Output checklist

  • Record input image identity, requested tool, constructor settings, device, dtype/quantization, model availability, and analysis_status.
  • Classification returns (scores, metadata) where scores map the 18 labels to numeric values in the source's 0–1 convention.
  • Segmentation returns (output, metadata): segmentation_image_path, a per-organ metrics dictionary, original/model sizes, requested and processed organs, and the fixed pixel-spacing assumption. An empty organ result is not proof of absence.
  • Reports contain CHEST X-RAY REPORT, FINDINGS, and IMPRESSION, plus metadata listing both generated sections.
  • VQA returns {"response": text} and metadata containing image paths, prompt, token limit, and status. It does not expose a calibrated confidence score.
  • Grounding returns predictions with model and original-image boxes and may return visualization_path; completed_no_finding is distinct from failure.
  • LLaVA-Med returns answer text and question/image/status metadata.
  • RoentGen returns a generated image_path and prompt, sampling, device, and size metadata. Generated images are synthetic artifacts, not evidence.

High-risk interpretation rules

  • Do not threshold classifier scores as diagnoses unless a separately validated threshold is supplied; the tool supplies no threshold or calibration.
  • Do not report segmentation area_cm2 as physically accurate for JPG/PNG. The implementation uses a fixed 0.2 mm/pixel assumption; request DICOM-aware processing for measurement work and route conversion/display separately.
  • Grounding coordinates are [x_min, y_min, x_max, y_max] in normalized model/image conventions as documented in the API reference. Use the returned image_coordinates for the original image and do not mix the two spaces.
  • A missing/empty prediction, a failed model load, and a model's negative finding are different observations. Preserve status and error metadata.
  • Reports, VQA answers, LLaVA answers, and generated images can hallucinate; corroborate with the image and an appropriate validated workflow.

References

  • API reference: exact fields, constructors, outputs, labels, coordinates, and artifacts.
  • Model overview: weights, devices, dtypes, quantization, caches, and external-resource boundaries.
  • Workflows: bounded selection and low-memory runs.
  • Troubleshooting: predictable failures and recovery actions.
  • Safe input validator: local path/schema checks only; it never imports model libraries, downloads weights, or runs inference.
我的收藏