İçeriğe geç

Ultralytics HUB Inference API

Bir modeli eğittikten sonra, Paylaşılan Inference API'sini ücretsiz olarak kullanabilirsiniz. Eğer bir Pro kullanıcısıysanız, Özel Inference API'sine erişebilirsiniz. Ultralytics HUB Inference API, Ultralytics YOLO ortamını yerel olarak kurmanıza ve ayarlamanıza gerek kalmadan REST API'miz aracılığıyla çıkarım çalıştırmanıza olanak tanır.

Model sayfasındaki Dağıt sekmesinin, Özel Inference API kartını ve Paylaşılan Inference API kartını gösteren oklarla işaretlenmiş Ultralytics HUB ekran görüntüsü


İzle: Ultralytics HUB Inference API İzlenecek Yol

Özel Inference API

Yüksek talep ve yaygın ilgiye yanıt olarak, Ultralytics HUB Özel Inference API'sini duyurmaktan heyecan duyuyoruz ve Pro kullanıcılarımız için özel bir ortamda tek tıklamayla dağıtım sunuyoruz!

Not

Bu özelliği, Pro Plan kapsamında halka açık beta sürümümüzde ÜCRETSİZ olarak sunmaktan heyecan duyuyoruz ve gelecekte ücretli katmanlar mümkün olabilir.

  • Global Kapsama: Dünya çapında 38 bölgede konuşlandırılmış olup, her konumdan düşük gecikmeli erişim sağlar. Google Cloud bölgelerinin tam listesine bakın.
  • Google Cloud Run Destekli: Sonsuz ölçeklenebilir ve yüksek güvenilirliğe sahip altyapı sağlayan Google Cloud Run tarafından desteklenmektedir.
  • Yüksek Hız: Ultralytics testlerine göre, yakındaki bölgelerden 640 çözünürlükte YOLOv8n çıkarımı için 100 ms'nin altında gecikme süresi mümkündür.
  • Gelişmiş Güvenlik: Verilerinizi korumak ve endüstri standartlarına uyumu sağlamak için güçlü güvenlik özellikleri sağlar. Google Cloud güvenliği hakkında daha fazla bilgi edinin.

Ultralytics HUB Özel Inference API'sini kullanmak için Uç Noktayı Başlat düğmesine tıklayın. Ardından, aşağıdaki kılavuzlarda açıklandığı gibi benzersiz uç nokta URL'sini kullanın.

Model sayfasındaki Dağıtım sekmesinin, Özel Inference API kartındaki Başlangıç Uç Noktası düğmesini gösteren ok ile Ultralytics HUB ekran görüntüsü

İpucu

belgelerde açıklandığı gibi en iyi performans için en düşük gecikme süresine sahip bölgeyi seçin.

Özel uç noktasını kapatmak için Uç Noktayı Durdur düğmesine tıklayın.

Model sayfasındaki Dağıtım sekmesinin, Özel Inference API kartındaki Durdurma Uç Noktası düğmesini gösteren ok ile Ultralytics HUB ekran görüntüsü

Paylaşımlı Inference API

Ultralytics HUB Paylaşımlı Inference API'sini kullanmak için aşağıdaki kılavuzları izleyin.

Ultralytics HUB Paylaşılan Inference API'sinin aşağıdaki kullanım sınırları vardır:

  • 100 çağrı / saat

Python

Ultralytics HUB Inference API'ye Python kullanarak erişmek için aşağıdaki kodu kullanın:

import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())

Not

Değiştir MODEL_ID istenen model kimliği ile, API_KEY gerçek API anahtarınızla ve path/to/image.jpg çıkarım çalıştırmak istediğiniz görüntünün yolu ile.

Eğer bizim Özel Inference API, şunu değiştirin: url aynı zamanda.

cURL

Ultralytics HUB Inference API'ye cURL kullanarak erişmek için aşağıdaki kodu kullanın:

curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"

Not

Değiştir MODEL_ID istenen model kimliği ile, API_KEY gerçek API anahtarınızla ve path/to/image.jpg çıkarım çalıştırmak istediğiniz görüntünün yolu ile.

Eğer bizim Özel Inference API, şunu değiştirin: url aynı zamanda.

Argümanlar

Mevcut çıkarım argümanlarının tam listesi için aşağıdaki tabloya bakın.

ArgümanVarsayılanTürAçıklama
filefileÇıkarım için kullanılacak resim veya video dosyası.
imgsz640intGiriş görüntüsünün boyutu, geçerli aralık 32 - 1280 piksel.
conf0.25floatTahminler için güven eşiği, geçerli aralık 0.01 - 1.0.
iou0.45floatKesişim Üzerinden Birleşim (Intersection over Union) (IoU) eşiği, geçerli aralık 0.0 - 0.95.

Yanıt

Ultralytics HUB Inference API'si bir JSON yanıtı döndürür.

Sınıflandırma

Sınıflandırma Modeli

from ultralytics import YOLO

# Load model
model = YOLO("yolov8n-cls.pt")

# Run inference
results = model("image.jpg")

# Print image.jpg results in JSON format
print(results[0].to_json())
curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"
import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
{
  "images": [
    {
      "results": [
        {
          "class": 0,
          "name": "person",
          "confidence": 0.92
        }
      ],
      "shape": [
        750,
        600
      ],
      "speed": {
        "inference": 200.8,
        "postprocess": 0.8,
        "preprocess": 2.8
      }
    }
  ],
  "metadata": ...
}

Algılama

Algılama Modeli

from ultralytics import YOLO

# Load model
model = YOLO("yolov8n.pt")

# Run inference
results = model("image.jpg")

# Print image.jpg results in JSON format
print(results[0].to_json())
curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"
import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
{
  "images": [
    {
      "results": [
        {
          "class": 0,
          "name": "person",
          "confidence": 0.92,
          "box": {
            "x1": 118,
            "x2": 416,
            "y1": 112,
            "y2": 660
          }
        }
      ],
      "shape": [
        750,
        600
      ],
      "speed": {
        "inference": 200.8,
        "postprocess": 0.8,
        "preprocess": 2.8
      }
    }
  ],
  "metadata": ...
}

OBB

OBB Modeli

from ultralytics import YOLO

# Load model
model = YOLO("yolov8n-obb.pt")

# Run inference
results = model("image.jpg")

# Print image.jpg results in JSON format
print(results[0].tojson())
curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"
import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
{
  "images": [
    {
      "results": [
        {
          "class": 0,
          "name": "person",
          "confidence": 0.92,
          "box": {
            "x1": 374.85565,
            "x2": 392.31824,
            "x3": 412.81805,
            "x4": 395.35547,
            "y1": 264.40704,
            "y2": 267.45728,
            "y3": 150.0966,
            "y4": 147.04634
          }
        }
      ],
      "shape": [
        750,
        600
      ],
      "speed": {
        "inference": 200.8,
        "postprocess": 0.8,
        "preprocess": 2.8
      }
    }
  ],
  "metadata": ...
}

Segmentasyon

Segmentasyon Modeli

from ultralytics import YOLO

# Load model
model = YOLO("yolov8n-seg.pt")

# Run inference
results = model("image.jpg")

# Print image.jpg results in JSON format
print(results[0].tojson())
curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"
import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
{
  "images": [
    {
      "results": [
        {
          "class": 0,
          "name": "person",
          "confidence": 0.92,
          "box": {
            "x1": 118,
            "x2": 416,
            "y1": 112,
            "y2": 660
          },
          "segments": {
            "x": [
              266.015625,
              266.015625,
              258.984375,
              ...
            ],
            "y": [
              110.15625,
              113.67188262939453,
              120.70311737060547,
              ...
            ]
          }
        }
      ],
      "shape": [
        750,
        600
      ],
      "speed": {
        "inference": 200.8,
        "postprocess": 0.8,
        "preprocess": 2.8
      }
    }
  ],
  "metadata": ...
}

Poz

Poz Modeli

from ultralytics import YOLO

# Load model
model = YOLO("yolov8n-pose.pt")

# Run inference
results = model("image.jpg")

# Print image.jpg results in JSON format
print(results[0].tojson())
curl -X POST "https://predict.ultralytics.com" \
  -H "x-api-key: API_KEY" \
  -F "model=https://hub.ultralytics.com/models/MODEL_ID" \
  -F "file=@/path/to/image.jpg" \
  -F "imgsz=640" \
  -F "conf=0.25" \
  -F "iou=0.45"
import requests

# API URL
url = "https://predict.ultralytics.com"

# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}

# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}

# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
    files = {"file": image_file}
    response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
{
  "images": [
    {
      "results": [
        {
          "class": 0,
          "name": "person",
          "confidence": 0.92,
          "box": {
            "x1": 118,
            "x2": 416,
            "y1": 112,
            "y2": 660
          },
          "keypoints": {
            "visible": [
              0.9909399747848511,
              0.8162999749183655,
              0.9872099757194519,
              ...
            ],
            "x": [
              316.3871765136719,
              315.9374694824219,
              304.878173828125,
              ...
            ],
            "y": [
              156.4207763671875,
              148.05775451660156,
              144.93240356445312,
              ...
            ]
          }
        }
      ],
      "shape": [
        750,
        600
      ],
      "speed": {
        "inference": 200.8,
        "postprocess": 0.8,
        "preprocess": 2.8
      }
    }
  ],
  "metadata": ...
}


📅 1 yıl önce oluşturuldu ✏️ 8 ay önce güncellendi
glenn-jochersergiuwaxmannMatthewNoycejk4eUltralyticsAssistantRizwanMunawarpriytosh-tripathi

Yorumlar