Ultralytics YOLO27:

xViewデータセット#

xViewデータセットは、一般公開されている衛星画像ベンチマークの中でも最大規模のものの一つです。物体検出向けに、1,400 km²を超える0.3 mのWorldView-3画像に対して、60クラスにわたる100万を超える物体インスタンスをバウンディングボックスでアノテーションしています。米国国家地理空間情報局(NGA)が主催したDIUx xView 2018 Challenge向けに公開され、約20.7 GBの手動ダウンロードが必要です。

このデータセットは、コンピュータビジョンにおける次の4つの課題を前進させるために作成されました。

  1. 検出に必要な最小解像度を下げること。
  2. 学習効率を向上させること。
  3. より多くの物体クラスの発見を可能にすること。
  4. 細粒度クラスの検出精度を向上させること。

COCOなどのベンチマークを基盤として、xViewは地上レベルの写真よりも物体がはるかに小さく、密集している上空画像を対象としています。

手動ダウンロードが必要です

xViewデータセットは自動的にはダウンロードされません。DIUx xView 2018 ChallengeのWebサイトで登録し、train_images.zip(~15 GB)、train_labels.zipval_images.zip(~5 GB)をダウンロードしてから、datasets/xView/の下に展開し、次の内容になるようにしてください。

datasets/xView/
├── train_images/          # 847 TIF satellite images
├── val_images/            # 282 TIF images (no public labels)
└── xView_train.geojson    # bounding-box annotations

最初の学習実行時に、UltralyticsはGeoJSONアノテーションをYOLO形式に変換し、ラベル付き画像をおよそ90/10の割合で学習セットと検証セットに自動分割します。手動変換は必要ありません。

主な特徴#

  • 細粒度クラス: 航空機、車両、鉄道車両、船舶、建設機械、建物にまたがる60の物体クラスで、その多くは小さく、希少で、外観が類似しています。
  • 高解像度: WorldView-3衛星から収集された、地上サンプル距離0.3 mの画像です。
  • 高密度アノテーション: 1,400 km²を超える画像範囲に、100万を超える物体インスタンスが含まれ、すべて水平バウンディングボックスでラベル付けされています。
  • 自動変換: Ultralyticsのダウンロードスクリプトは、元のGeoJSONラベルをYOLO形式に変換し、初回使用時にtrain/val分割を生成します。

データセットの構成#

xViewの画像はTIF形式の大きな衛星シーンで、公開ラベル付きで提供されるのは847枚の学習画像のみです。282枚のチャレンジ検証セットにはラベルがありません。そのため、UltralyticsのxView.yaml設定では、初回使用時にラベル付き画像を自動分割します。

分割画像説明
トレーニング847枚の約90%autosplit_train.txtに記載され、初回実行時に生成されるラベル付き画像
検証847枚の約10%autosplit_val.txtに記載され、評価に使用されるラベル付き画像

60クラスには、固定翼航空機、貨物機、小型車、バス、機関車、船舶、掘削機、建物、航空機格納庫、貯蔵タンクなどの細粒度カテゴリが含まれます。完全なリストは以下のDataset YAMLに記載されています。変換時に、元のチャレンジクラスID(11–94)は連続したインデックス0–59に再マッピングされます。

アプリケーション#

xViewは、細粒度クラスと高解像度の上空視点を備えているため、リモートセンシングにおけるディープラーニングモデルの学習および評価に利用される標準ベンチマークです。主な用途には次のものがあります。

  • 軍事・防衛偵察
  • 都市計画・開発
  • 環境モニタリング
  • 災害対応・被害評価
  • インフラのマッピング・管理

その他の上空画像ベンチマークについては、ドローンに焦点を当てたVisDroneデータセットまたは指向性ボックスを使用するDOTA-v2データセットをご覧ください。

データセット YAML#

xView.yamlファイルは、データセットのパス、60個のクラス名、GeoJSONアノテーションを変換してautosplitを生成するダウンロードスクリプトなど、データセット設定を定義します。このファイルは、Ultralyticsリポジトリのhttps://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/xView.yamlで管理されています。

ultralytics/cfg/datasets/xView.yaml
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

# DIUx xView 2018 Challenge dataset https://challenge.xviewdataset.org by U.S. National Geospatial-Intelligence Agency (NGA)
# --------  Download and extract data manually to `datasets/xView` before running the train command.  --------
# Documentation: https://docs.ultralytics.com/datasets/detect/xview
# Example usage: yolo train data=xView.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── xView ← downloads here (20.7 GB)

# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: xView # dataset root dir
train: images/autosplit_train.txt # train images (relative to 'path') 90% of 847 train images
val: images/autosplit_val.txt # val images (relative to 'path') 10% of 847 train images

# Classes
names:
  0: Fixed-wing Aircraft
  1: Small Aircraft
  2: Cargo Plane
  3: Helicopter
  4: Passenger Vehicle
  5: Small Car
  6: Bus
  7: Pickup Truck
  8: Utility Truck
  9: Truck
  10: Cargo Truck
  11: Truck w/Box
  12: Truck Tractor
  13: Trailer
  14: Truck w/Flatbed
  15: Truck w/Liquid
  16: Crane Truck
  17: Railway Vehicle
  18: Passenger Car
  19: Cargo Car
  20: Flat Car
  21: Tank car
  22: Locomotive
  23: Maritime Vessel
  24: Motorboat
  25: Sailboat
  26: Tugboat
  27: Barge
  28: Fishing Vessel
  29: Ferry
  30: Yacht
  31: Container Ship
  32: Oil Tanker
  33: Engineering Vehicle
  34: Tower crane
  35: Container Crane
  36: Reach Stacker
  37: Straddle Carrier
  38: Mobile Crane
  39: Dump Truck
  40: Haul Truck
  41: Scraper/Tractor
  42: Front loader/Bulldozer
  43: Excavator
  44: Cement Mixer
  45: Ground Grader
  46: Hut/Tent
  47: Shed
  48: Building
  49: Aircraft Hangar
  50: Damaged Building
  51: Facility
  52: Construction Site
  53: Vehicle Lot
  54: Helipad
  55: Storage Tank
  56: Shipping container lot
  57: Shipping Container
  58: Pylon
  59: Tower

# Download script/URL (optional) ---------------------------------------------------------------------------------------
download: |
  import json
  from pathlib import Path
  import shutil

  import numpy as np
  from PIL import Image

  from ultralytics.utils import TQDM
  from ultralytics.data.split import autosplit
  from ultralytics.utils.ops import xyxy2xywhn

  def convert_labels(fname=Path("xView/xView_train.geojson")):
      """Convert xView GeoJSON labels to YOLO format (classes 0-59) and save them as text files."""
      path = fname.parent
      with open(fname, encoding="utf-8") as f:
          print(f"Loading {fname}...")
          data = json.load(f)

      # Make dirs
      labels = path / "labels" / "train"
      shutil.rmtree(labels, ignore_errors=True)
      labels.mkdir(parents=True, exist_ok=True)

      # xView classes 11-94 to 0-59
      xview_class2index = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, 8, -1, 9, 10, 11,
                           12, 13, 14, 15, -1, -1, 16, 17, 18, 19, 20, 21, 22, -1, 23, 24, 25, -1, 26, 27, -1, 28, -1,
                           29, 30, 31, 32, 33, 34, 35, 36, 37, -1, 38, 39, 40, 41, 42, 43, 44, 45, -1, -1, -1, -1, 46,
                           47, 48, 49, -1, 50, 51, -1, 52, -1, -1, -1, 53, 54, -1, 55, -1, -1, 56, -1, 57, -1, 58, 59]

      shapes = {}
      for feature in TQDM(data["features"], desc=f"Converting {fname}"):
          p = feature["properties"]
          if p["bounds_imcoords"]:
              image_id = p["image_id"]
              image_file = path / "train_images" / image_id
              if image_file.exists():  # 1395.tif missing
                  try:
                      box = np.array([int(num) for num in p["bounds_imcoords"].split(",")])
                      assert box.shape[0] == 4, f"incorrect box shape {box.shape[0]}"
                      cls = p["type_id"]
                      cls = xview_class2index[int(cls)]  # xView class to 0-59
                      assert 59 >= cls >= 0, f"incorrect class index {cls}"

                      # Write YOLO label
                      if image_id not in shapes:
                          shapes[image_id] = Image.open(image_file).size
                      box = xyxy2xywhn(box[None].astype(float), w=shapes[image_id][0], h=shapes[image_id][1], clip=True)
                      with open((labels / image_id).with_suffix(".txt"), "a", encoding="utf-8") as f:
                          f.write(f"{cls} {' '.join(f'{x:.6f}' for x in box[0])}\n")  # write label.txt
                  except Exception as e:
                      print(f"WARNING: skipping one label for {image_file}: {e}")

  # Download manually from https://challenge.xviewdataset.org
  dir = Path(yaml["path"])  # dataset root dir
  # urls = [
  #     "https://d307kc0mrhucc3.cloudfront.net/train_labels.zip",  # train labels
  #     "https://d307kc0mrhucc3.cloudfront.net/train_images.zip",  # 15G, 847 train images
  #     "https://d307kc0mrhucc3.cloudfront.net/val_images.zip",  # 5G, 282 val images (no labels)
  # ]
  # download(urls, dir=dir)

  # Convert labels
  convert_labels(dir / "xView_train.geojson")

  # Move images
  images = Path(dir / "images")
  images.mkdir(parents=True, exist_ok=True)
  Path(dir / "train_images").rename(dir / "images" / "train")
  Path(dir / "val_images").rename(dir / "images" / "val")

  # Split
  autosplit(dir / "images" / "train")

使用方法#

20.7 GBの手動ダウンロード

学習では、上記の手動ダウンロードをdatasets/xView/の下に展開しておく必要があります。その後、アノテーションの変換とtrain/val分割が自動的に実行されます。

xViewデータセットで画像サイズ640、100エポックのモデル学習を行うには、次のコードスニペットを使用できます。利用可能な引数の一覧については、モデルのTrainingページを参照してください。

トレーニング例
from ultralytics import YOLO

# Load a model
model = YOLO("yolo26n.pt")  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data="xView.yaml", epochs=100, imgsz=640)

追加の衛星画像にラベルを付け、ブラウザーでxViewの学習実行を管理するには、Ultralytics Platformを使用してください。

サンプルデータとアノテーション#

以下の例は、典型的なxViewシーンを示しています。車両や建物などの小さな物体がバウンディングボックスでアノテーションされた高解像度の上空画像であり、衛星画像における物体検出で細粒度の位置特定が求められる理由を示しています。

物体検出を含むxViewデータセットの上空衛星画像

引用と謝辞#

研究または開発でxViewデータセットを使用する場合は、次の論文を引用してください。

引用
@misc{lam2018xview,
      title={xView: Objects in Context in Overhead Imagery},
      author={Darius Lam and Richard Kuzma and Kevin McGee and Samuel Dooley and Michael Laielli and Matthew Klaric and Yaroslav Bulatov and Brendan McCord},
      year={2018},
      eprint={1802.07856},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Defense Innovation Unit(DIU)およびxViewデータセットの作成者による、コンピュータビジョン研究コミュニティへの貴重な貢献に感謝します。詳細については、xViewデータセットのWebサイトをご覧ください。

FAQ#

  • xViewデータセットは、米国国家地理空間情報局がDIUx xView 2018 Challenge向けに公開した衛星画像ベンチマークです。0.3 mのWorldView-3画像において、60の細粒度クラスにわたる100万を超える物体インスタンスを提供します。地上レベルの写真に写る物体よりもはるかに検出が難しい、上空視点の小さく、希少で、細粒度の物体の検出研究を支援します。

  • xViewには手動ダウンロードが必要です。DIUx xView 2018 ChallengeのWebサイトで登録し、train_images.zip(~15 GB)、train_labels.zipval_images.zip(~5 GB)をダウンロードします。合計で約20.7 GBとなります。これらを、このページ上部の警告に示された構成に従ってdatasets/xView/の下に展開してください。最初の学習実行時に、UltralyticsがGeoJSONアノテーションをYOLO形式に自動変換し、train/validation分割を作成します。

  • xViewには、ラベル付き学習画像847枚と、公開ラベルのない検証画像282枚が含まれており、すべてWorldView-3衛星によって0.3 mの解像度で撮影されています。アノテーションは、60クラスにわたる100万を超える物体インスタンスを対象としています。学習ラベルのみが公開されているため、UltralyticsのxView.yaml設定では、ラベル付き847枚をおよそ90/10の割合で学習セットと検証セットに分割します。詳細についてはDataset Structureを参照してください。

  • xViewでYOLO26nモデルを、画像サイズ640、100エポックで学習します。

    トレーニング例
    from ultralytics import YOLO
    
    # Load a model
    model = YOLO("yolo26n.pt")  # load a pretrained model (recommended for training)
    
    # Train the model
    results = model.train(data="xView.yaml", epochs=100, imgsz=640)

    詳細な引数と設定については、モデルのTrainingページを参照してください。

  • 論文「xView: Objects in Context in Overhead Imagery」(Lam et al., arXiv:1802.07856, 2018)を引用してください。完全なBibTeXエントリは、上記のCitations and Acknowledgmentsセクションに記載されています。

コメント