跳到正文
cccskills
免费在 GitHub 公开

sports-field-visualization

Use when maintaining sports field visualization or Tkinter GUI and standalone CLI integration with Matplotlib.

中文简介正在准备中。当前显示原文说明。

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md3.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Sports Field Visualization & GUI-CLI Integration

This skill documents the patterns and fixes for maintaining cross-platform compatibility between Tkinter GUIs and standalone CLI tools using Matplotlib, specifically focusing on the drawsportsfields.py and markerless_3d_analysis.py modules.

vailá maintenance rule (version/date)

When you edit drawsportsfields.py, markerless_3d_analysis.py, or any *.py in this repo, also update:

  • edited script header Update Date (today) + Version (global, from vaila.py header/banner)
  • root README.md line Last updated: YYYY-MM-DD
  • help docs: matching vaila/help/<module>.md + .html, plus vaila/help/index.md + .html (“Generated on”)
  • installers / vaila.py if change impacts install/run UX

Reference checklist: AGENTS.md (“Mandatory: Update metadata on any script change”).

Context

The vailá project uses a dual-mode execution pattern for many modules:

  1. Integrated GUI: Modules are imported into vaila.py and run inside the main Tkinter notebook.
  2. Standalone CLI: Modules are run directly (e.g., uv run vaila/module.py --arg value).

Key Challenges & Solutions

1. Matplotlib Backend Synchronization

Issue: Standing-alone CLI execution often defaults to the QtAgg backend. If the system lacks Qt dependencies (common in minimal Linux installs or headless environments), the script crashes with qt.qpa.plugin errors. Solution: Explicitly set the backend to TkAgg before importing pyplot if the module is designed for Tkinter integration.

import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt

2. GUI vs. CLI Execution Paths

Issue: Modules originally designed as GUIs often trigger the full tk.Tk() main loop even when run with CLI arguments (e.g., --field), leading to unnecessary window creation or crashes in non-interactive sessions. Solution: Use the if __name__ == "__main__": block to distinguish between a full GUI launch and a simple plot visualization.

if __name__ == "__main__":
    if args.field:
        # Static plot mode (CLI)
        plot_field(df)
        plt.show()
    else:
        # Interactive GUI mode
        run_gui()

3. App Class Portability

Issue: Defining the main application class inside if __name__ == "__main__": prevents it from being imported by other modules. Also, restricting master to tk.Tk prevents embedding it in tk.Toplevel windows. Solution:

  • Move the App class to the module level.
  • Update type hints to tk.Tk | tk.Toplevel.
class App:
    def __init__(self, master: tk.Tk | tk.Toplevel):
        self.master = master
        # initialization logic...

4. Matplotlib Colormap Deprecations

Issue: Direct attribute access like plt.cm.rainbow is deprecated in modern Matplotlib versions and triggers linting errors. Solution: Use the registry-based retrieval method.

# GOOD
cmap = plt.get_cmap("rainbow")

# BAD
cmap = plt.cm.rainbow

FIFA Field Geometry Integration

The "FIFA" layout is now natively supported using a coordinate system centered at (0,0,0).

  • Reference File: vaila/models/soccerfield_ref3d_fifa.csv
  • Registry Entry:
SPORT_REGISTRY["fifa"] = SportDef(
    label="FIFA Starter Kit",
    model_csv="soccerfield_ref3d_fifa.csv",
    title="FIFA Skeletal Tracking Pitch",
    plot_fn=plot_field,
)

Related Modules

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Configures best-practice alerting policies for AI agents using OpenTelemetry (OTel) metrics, generating output as Terraform (.tf) configuration files. Use when analyzing, writing, or deploying alerting policies to monitor agent latency, error rates, token usage, and quality metrics. Don't use for standard infrastructure monitoring unrelated to AI agents, or when the agent is not instrumented with OpenTelemetry (for Reliability, Cost, Safety, Security alerts). NOTE: Reliability, Cost, Safety, and Security alerts use generic OTel metrics and work across runtimes (such as Cloud Run, Vertex AI). Quality alerts rely on Vertex AI Online Monitors and are strictly bound to Vertex AI deployments.

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up resources by undeploying models and deleting endpoints. Use when asked to actively deploy a model, list the Model Garden CATALOG of available models, check if a specific model is deployable (`gcloud ai model-garden models list-deployment-config`), query deployment cost, troubleshoot deployment errors (like quota limits), or undeploy/clean up endpoints. Also use when copying and deploying a 1P Tuned Model. Don't use for pure listing/discovery questions of the form "is X deployed?", "list my endpoints", or "which regions have models running?" — for those use `agent-platform-endpoint-management`. Don't use for public Vertex AI deployments (use the `vertex-deploy` skill) or for running model evaluations (use the `agent-platform-eval-flywheel` skill).

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for running model evaluations.

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

Measures and improves the quality of AI models and agents on Google Cloud using the Eval Quality Flywheel methodology. Use when evaluating an agent or model, building an eval dataset, picking or writing evaluation metrics, analyzing failures, comparing results before and after a fix, or when guidance is needed on Agent Platform eval methodology — including dataset schema, LLM-as-judge scoring, and common failure causes. For fine-tuning, use agent-platform-tuning. For general production deployment, use agent-platform-deploy.

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

Connects to and performs inference with Google Cloud Agent Platform GenAI models, including First-Party Gemini models and Third-Party OpenMaaS models (Llama, DeepSeek, Qwen, etc.). Use when asked to perform inference, ask a model a question, run a test prompt, execute chat completions, or generate code for calling Gemini or OpenMaaS models, authenticate with GenAI SDK, OpenAI SDK, or legacy Agent Platform SDK, configure base URLs and global/regional endpoints, or troubleshoot 429 Resource Exhausted (DSQ), 400 User Validation, or 404 Not Found errors. Don't use for deploying models to endpoints or for running model evaluations.

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

Guides agents and users through migrating from Gemini API in Google AI Studio to Gemini Enterprise Agent Platform (formerly Vertex AI). Use this skill when moving applications to Google Cloud, to leverage Cloud credits, or to unify inferencing with other Cloud infrastructure (IAM, billing, telemetry).

中文简介正在准备中。当前显示原文说明。

vaila-multimodaltoolbox/vaila212026年10月23日 更新

查看 vaila-multimodaltoolbox 的全部技能

报告此技能的问题