T-Rex

IDEA-Research长期未更新

T-Rex2 是 ECCV2024 开源的通用目标检测模型,结合文本提示与视觉提示,实现开放场景下的目标检测和计数。

[ECCV2024] API code for T-Rex2: Towards Generic Object Detection via Text-Visual Prompt Synergy

暂无版本2,717star171fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/IDEA-Research/T-Rex.git
cd T-Rex
pip install dds-cloudapi-sdk==0.1.1
pip install -v -e .
硬件要求按 README 说明

README 未说明本地显存或 GPU 要求,示例均通过云端 API 调用,只需能联网运行 Python 即可

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

T-Rex2 是文本与视觉提示协同的通用目标检测 API,无需训练即可检测任意类别

T-Rex2 是 ECCV2024 开源的通用目标检测模型,结合文本提示与视觉提示,实现开放场景下的目标检测和计数。

核心能力

  • 融合文本提示与视觉提示实现零样本目标检测
  • 支持框或点形式的交互式视觉提示指定目标
  • 用参考图视觉提示在另一张图上做通用检测
  • 用多张图定制类别视觉嵌入并复用于任意图像推理
  • 提供本地 Gradio 演示界面便于交互试用

容易踩的坑

需要先在 cloud.deepdataspace.com 申请 API key,所有示例都要传 --token;dds-cloudapi-sdk 固定为 0.1.1 版本;Gradio 演示需额外安装 gradio-image-prompter

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Static Badge arXiv preprint Homepage Hits Static Badge


    🔥 [2025/10/15] Rex-Omni: Still using traditional detectors? We've turned object detection into a simple "Next-Token Prediction" task with an MLLM! One model (fully open-sourced), zero-shot SOTA performance, tackling detection, referring, OCR, and GUI grounding all at once. Come see the next generation of perception models

    👉 Check out Rex-Omni!


    📌 You can get API access here https://cloud.deepdataspace.com/dashboard/usage. Once you get the API key, you can try T-Rex2 by following these example codes: https://github.com/IDEA-Research/T-Rex/tree/trex2/demo_examples


    Introduction Video 🎥

    Turn on the music if possible 🎧

    Video Name

    News 📰

    • 2024-06-24: We have introduced two new free products based on T-Rex2:
      • Count Anything APP: CountAnything is a versatile, efficient, and cost-effective counting tool that utilizes advanced computer vision algorithms, specifically T-Rex, for automated counting. It is applicable across various industries, including manufacturing, agriculture, and aquaculture.

    Video Name

    • T-Rex Label: T-Rex Label is an advanced annotation tool powerd by T-Rex2, specifically designed to handle the complexities of various industries and scenarios. It is the ideal choice for those aiming to streamline their workflows and effortlessly create high-quality datasets.

    Video Name

    • 2024-05-17: Grounding DINO 1.5 is released. This is IDEA Research's Most Capable Open-World Object Detection Model Series. It can detect any object throught text prompts!

    Contents 📜

    1. Introduction 📚

    Object detection, the ability to locate and identify objects within an image, is a cornerstone of computer vision, pivotal to applications ranging from autonomous driving to content moderation. A notable limitation of traditional object detection models is their closed-set nature. These models are trained on a predetermined set of categories, confining their ability to recognize only those specific categories. The training process itself is arduous, demanding expert knowledge, extensive datasets, and intricate model tuning to achieve desirable accuracy. Moreover, the introduction of a novel object category, exacerbates these challenges, necessitating the entire process to be repeated.

    T-Rex2 addresses these limitations by integrating both text and visual prompts in one model, thereby harnessing the strengths of both modalities. The synergy of text and visual prompts equips T-Rex2 with robust zero-shot capabilities, making it a versatile tool in the ever-changing landscape of object detection.

    What Can T-Rex Do 📝

    T-Rex2 is well-suited for a variety of real-world applications, including but not limited to: agriculture, industry, livstock and wild animals monitoring, biology, medicine, OCR, retail, electronics, transportation, logistics, and more. T-Rex2 mainly supports three major workflows including interactive visual prompt workflow, generic visual prompt workflow and text prompt workflow. It can cover most of the application scenarios that require object detection

    Video Name

    2. Try Demo 🎮

    We are now opening online demo for T-Rex2. Check our demo here

    3. API Usage Examples📚

    📌 You can get API access here https://cloud.deepdataspace.com/dashboard/usage. Once you get the API key, you can try T-Rex2 by following these example codes: https://github.com/IDEA-Research/T-Rex/tree/trex2/demo_examples

    Setup

    Install the API package and acquire the API token from the email.

    git clone https://github.com/IDEA-Research/T-Rex.git
    cd T-Rex
    pip install dds-cloudapi-sdk==0.1.1
    pip install -v -e .
    

    Interactive Visual Prompt API

    • In interactive visual prompt workflow, users can provide visual prompts in boxes or points format on a given image to specify the object to be detected.

      python demo_examples/interactive_inference.py --token <your_token> 
      
      • You are supposed get the following visualization results at demo_vis/

    Generic Visual Prompt API

    • In generic visual prompt workflow, users can provide visual prompts on one reference image and detect on the other image.

      python demo_examples/generic_inference.py --token <your_token> 
      
      • You are supposed get the following visualization results at demo_vis/

    Customize Visual Prompt Embedding API

    In this workflow, you can customize a visual embedding for a object category using multiple images. With this embedding, you can detect on any images.

    python demo_examples/customize_embedding.py --token <your_token> 
    
    • You are supposed to get a download link for this visual prompt embedding in safetensors format. Save it and let's use it for embedding_inference.

    Embedding Inference API

    With the visual prompt embeddings generated from the previous API. You can use it detect on any images.

      python demo_examples/embedding_inference.py --token <your_token> 
    

    4. Local Gradio Demo with API🎨

    4.1. Setup

    • Install T-Rex2 API if you haven't done so
    - install gradio and other dependencies
    ```bash
    ## install gradio and other dependencies
    pip install gradio-image-prompter
    

    4.2. Run the Gradio Demo

    python gradio_demo.py --trex2_api_token <your_token>
    

    4.3. Basic Operations

    • Draw Box: Draw a box on the image to specify the object to be detected. Drag the left mouse button to draw a box.
    • Draw Point: Draw a point on the image to specify the object to be detected. Click the left mouse button to draw a point.
    • Interactive Visual Prompt: Provide visual prompts in boxes or points format on a given image to specify the object to be detected. The Input Target Image and Interactive Visual Prompt Image should be the same
    • Generic Visual Prompt: Provide visual prompts on multiple reference images and detect on the other image.

    5. Related Works

    :fire: We release the training and inference code and demo link of DINOv, which can handle in-context visual prompts for open-set and referring detection & segmentation. Check it out!

    6. LICENSE

    We use IDEA License 1.0

    BibTeX 📚

    @misc{jiang2024trex2,
          title={T-Rex2: Towards Generic Object Detection via Text-Visual Prompt Synergy}, 
          author={Qing Jiang and Feng Li and Zhaoyang Zeng and Tianhe Ren and Shilong Liu and Lei Zhang},
          year={2024},
          eprint={2403.14610},
          archivePrefix={arXiv},
          primaryClass={cs.CV}
    }