メインコンテンツへスキップ
見出し画像

AIオーケストレーションを試す〜”【Apple Silicon】Gemma4 + Falcon Perception” と”【CUDA】Gemma4 + Sam3”の比較〜

    AIオーケストレーション

    最新のGoogle/DeepMindのLocal VLMモデルGemma4と画像AIモデルを組み合わせたAIオーケストレーションを試してみました。

    色々なデータで試しましたが、精度はまだまだといった感じではあります。

    こちらは、Gemma4とMetaのSAM3.1の組み合わせです。

    We are in the era of local AI orchestration

    Gemma 4 evaluates a scene, reasons about what to ask, and calls a segmentation model to execute the vision tasks:

    🚗 "Segment all vehicles." ➔ 64 found
    🚙 "Now just the white ones." ➔ 23 found

    All happening offline on a laptop. pic.twitter.com/xH9fFcvCKe

    — Google Gemma (@googlegemma) April 14, 2026

    Gemma 4 が駐車場を見る。 何を尋ねるかを決める。 SAM 3.1 を呼び出す。 -「すべての車両をセグメント化せよ。」 64 個見つかりました。
    -「今度は白いものだけ。」 23 個見つかりました。
    一つのモデルが推論し、オーケストレーションする。 一つのモデルが実行する。 両方とも MacBook 上でローカルに動作。 MLX。クラウドなし。API なし。

    X投稿より

    こちらは、Gemma4とFalcon Perceptionとの組み合わせです。

    I used Gemma4 + Falcon Perception from this mlx-vlm release to build a grounded reasoning agent runs fully local on M3

    the idea: VLMs are great at reasoning but not great at measuring. Falcon Perception is great at segmentation but cant reason. so you loop them: Gemma4 decides… https://t.co/Db62U60cdw pic.twitter.com/0pTEALG3Mr

    — Yasser Dahou (@dahou_yasser) April 4, 2026

    VLMsは推論が得意ですが、測定はあまり得意ではありません。Falcon Perceptionはセグメンテーションが得意ですが、推論できません。なので、それらをループさせます
    Gemma4が何を探すかを決め、FPがそれをセグメントしてピクセル単位の正確な座標を返し、Gemma4が数字に基づいて推論します

    X投稿より

    Gemma4-Visual-Agent

    モデル概要

    Gemma4とFalcon Perceptionの組み合わせ
    Apple Siliconで動作します。

    Gemma4とFalcon Perceptionモデルについてはこちら

    画像
    モデル詳細

    準備

    推奨環境はこんな感じ。

    • macOS with Apple Silicon (M1/M2/M3/M4)

    • Python 3.10+

    • 16 GB+ RAM recommended

    • ~7 GB disk for model weights (auto-downloaded)

    私の実行環境は、M2 Max 96GB です。

    仮想環境で試すのがいいです。
    Github:https://github.com/PromtEngineer/Gemma4-Visual-Agent  
    ですので、まずは git clone します。

    git clone https://github.com/PromtEngineer/Gemma4-Visual-Agent

    次に以下をインストールします。

    # Install dependencies
    pip install mlx-vlm gradio opencv-python-headless Pillow numpy pycocotools
    pip install "falcon-perception[mlx] @ git+https://github.com/tiiuae/falcon-perception.git"
    pip install fastapi uvicorn

    画像向けのアプリ立ち上げ

    # Launch
    python vision_studio.py

    GradioのUIが立ち上がります。

    画像
    Gradio初期画面

    実行

    初期プロンプト
    Are there more cars than people?

    Segment 'cars'
    Found 5 instance(s) of 'cars'

    画像

    Segment 'people'
    Found 6 instance(s) of 'people'

    画像

    Compare counts
    cars: 5 | people: 6 — More people (6) than cars (5)

    画像

    Final answer
    Found 6 people(s). More people (6) than cars (5)

    全体の流れは以下の通り。

    User: "Are there more cars than people?"
                        |
                  Plan Router
               (pattern matching)
                /              \
        DETECT 'cars'    DETECT 'people'
        Falcon (0.6B)    Falcon (0.6B)
        5 found          6 found
                \              /
                 COMPARE counts
                 cars: 5 | people: 6
                        |
                     ANSWER
        "More people(6)than cars (5)"

    以下で動画もできます。

    python video_tracker.py

    ※参考

    画像

    SAM3-Gemma4-CUDA

    準備

    私の実行環境
    - NVIDIA GeForce 4060
    - CUDA Version 12.7

    Github: https://github.com/PRITHIVSAKTHIUR/SAM3-Gemma4-CUDA 

    git clone

    git clone https://github.com/PRITHIVSAKTHIUR/SAM3-Gemma4-CUDA

    各種ライブラリインストール

    pip install -r requirements.txt

    この後、SAM3を使うので、huggingface (https://huggingface.co/facebook/sam3)のアカウント作成とアクセストークンの取得が必要です。
    その後、以下でhuggingfaceにログインします。

    HuggingFace HubのCLIをインストール

    pip install -U "huggingface_hub[cli]"

    python起動しログイン

    python
    >>>from huggingface_hub import login
    >>>login()

     ゲットしたアクセストークン(hf_xxxxxxxxxx)を以下にコピペ

    画像

    実行

    アプリ実行でGradioが立ち上がります。

    python app.py

    プロンプトは、セグメントする対象を指定します。

    プロンプト
    "people"

    画像
    Gradio画面

    Gemma4の回答

    1. **Object(s) Selected:** Four instances of "people" (pedestrians).
    2. **Match to Prompt:** The selected regions clearly highlight individuals walking across the crosswalk and standing near the vehicles.
    3. **Reliability:** The result seems reliable as the bounding boxes accurately capture the people present in the scene.

    Gemma4

    訳:

    1. 選択された物体: 「人(歩行者)」が4人選択されています。

    2. プロンプトとの一致: 選択された領域は、横断歩道を歩いている人々や車の近くに立っている人々を明確に示しています。

    3. 信頼性: バウンディングボックスがシーン内の人物を正確に捉えているため、この結果は信頼できるように見えます。


    人の数は4人と言っていますが、実際は6人ですね。

    参考

    Falcon Perception

    SAM3


     
     
    医療AI/モビリティAI/AI・Python教材制作/元コンサル 日本メディカルAI学会公認資格 大規模言語モデル2024(東大),AI-Quest2020修了 国内AIデータ分析コンペに参加:Nishika Aランク(金1銀1銅2)SIGNATE Master称号(金1銅3)

    あなたへのおすすめ