Skip to content

Register now for

# xView Dataset

The xView dataset is one of the largest publicly available datasets of overhead imagery, containing images from complex scenes around the world annotated using bounding boxes. The goal of the xView dataset is to accelerate progress in four computer vision frontiers:

1. Reduce minimum resolution for detection.
2. Improve learning efficiency.
3. Enable discovery of more object classes.
4. Improve detection of fine-grained classes.

xView builds on the success of challenges like Common Objects in Context (COCO) and aims to leverage computer vision to analyze the growing amount of available imagery from space in order to understand the visual world in new ways and address a range of important applications.

Manual Download Required

The xView dataset is not automatically downloaded by Ultralytics scripts. You must manually download the dataset first from the official source:

- Source: DIUx xView 2018 Challenge by U.S. National Geospatial-Intelligence Agency (NGA)
- URL: https://challenge.xviewdataset.org

Important: After downloading the necessary files (e.g., `train_images.tif`, `val_images.tif`, `xView_train.geojson`), you need to extract them and place them into the correct directory structure, typically expected under a `datasets/xView/` folder, before running the training commands provided below. Ensure the dataset is properly set up as per the challenge instructions.

## Key Features

- xView contains over 1 million object instances across 60 classes.
- The dataset has a resolution of 0.3 meters, providing higher resolution imagery than most public satellite imagery datasets.
- xView features a diverse collection of small, rare, fine-grained, and multi-type objects with bounding box annotation.
- Comes with a pre-trained baseline model using the TensorFlow object detection API and an example for PyTorch.

## Dataset Structure

The xView dataset is composed of satellite images collected from WorldView-3 satellites at a 0.3m ground sample distance. It contains over 1 million objects across 60 classes in over 1,400 km² of imagery. The dataset is particularly valuable for remote sensing applications and environmental monitoring.

## Applications

The xView dataset is widely used for training and evaluating deep learning models for object detection in overhead imagery. The dataset's diverse set of object classes and high-resolution imagery make it a valuable resource for researchers and practitioners in the field of computer vision, especially for satellite imagery analysis. Applications include:

- Military and defense reconnaissance
- Urban planning and development
- Environmental monitoring
- Disaster response and assessment
- Infrastructure mapping and management

## Dataset YAML

A YAML (Yet Another Markup Language) file is used to define the dataset configuration. It contains information about the dataset's paths, classes, and other relevant information. In the case of the xView dataset, the `xView.yaml` file is maintained at 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 https://challenge.xviewdataset.org by U.S. National Geospatial-Intelligence Agency (NGA)
    # --------  DOWNLOAD DATA MANUALLY and jar xf val_images.zip to 'datasets/xView' before running 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 # train 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
      import os
      from pathlib import Path

      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")):
          """Converts xView geoJSON labels to YOLO format, mapping classes to indices 0-59 and saving 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(path / "labels" / "train")
          os.system(f"rm -rf {labels}")
          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"]:
                  id = p["image_id"]
                  file = path / "train_images" / id
                  if 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-60
                          assert 59 >= cls >= 0, f"incorrect class index {cls}"

                          # Write YOLO label
                          if id not in shapes:
                              shapes[id] = Image.open(file).size
                          box = xyxy2xywhn(box[None].astype(np.float), w=shapes[id][0], h=shapes[id][1], clip=True)
                          with open((labels / 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 {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")

## Usage

To train a model on the xView dataset for 100 epochs with an image size of 640, you can use the following code snippets. For a comprehensive list of available arguments, refer to the model Training page.

Train Example

Python CLI

    from ultralytics import YOLO

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

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

    # Start training from a pretrained *.pt model
    yolo detect train data=xView.yaml model=yolo11n.pt epochs=100 imgsz=640

## Sample Data and Annotations

The xView dataset contains high-resolution satellite images with a diverse set of objects annotated using bounding boxes. Here are some examples of data from the dataset, along with their corresponding annotations:

- Overhead Imagery: This image demonstrates an example of object detection in overhead imagery, where objects are annotated with bounding boxes. The dataset provides high-resolution satellite images to facilitate the development of models for this task.

The example showcases the variety and complexity of the data in the xView dataset and highlights the importance of high-quality satellite imagery for object detection tasks.

## Related Datasets

If you're working with satellite imagery, you might also be interested in exploring these related datasets:

- DOTA-v2: A dataset for oriented object detection in aerial images
- VisDrone: A dataset for object detection and tracking in drone-captured imagery
- Argoverse: A dataset for autonomous driving with 3D tracking annotations

## Citations and Acknowledgments

If you use the xView dataset in your research or development work, please cite the following paper:

BibTeX

    @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}
    }

We would like to acknowledge the Defense Innovation Unit (DIU) and the creators of the xView dataset for their valuable contribution to the computer vision research community. For more information about the xView dataset and its creators, visit the xView dataset website.

## FAQ

### What is the xView dataset and how does it benefit computer vision research?

The xView dataset is one of the largest publicly available collections of high-resolution overhead imagery, containing over 1 million object instances across 60 classes. It is designed to enhance various facets of computer vision research such as reducing the minimum resolution for detection, improving learning efficiency, discovering more object classes, and advancing fine-grained object detection.

### How can I use Ultralytics YOLO to train a model on the xView dataset?

To train a model on the xView dataset using Ultralytics YOLO, follow these steps:

Train Example

Python CLI

    from ultralytics import YOLO

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

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

    # Start training from a pretrained *.pt model
    yolo detect train data=xView.yaml model=yolo11n.pt epochs=100 imgsz=640

For detailed arguments and settings, refer to the model Training page.

### What are the key features of the xView dataset?

The xView dataset stands out due to its comprehensive set of features:

- Over 1 million object instances across 60 distinct classes.
- High-resolution imagery at 0.3 meters.
- Diverse object types including small, rare, and fine-grained objects, all annotated with bounding boxes.
- Availability of a pre-trained baseline model and examples in TensorFlow and PyTorch.

### What is the dataset structure of xView, and how is it annotated?

The xView dataset contains high-resolution satellite imagery captured by WorldView-3 satellites at a 0.3m ground sample distance, covering over 1 million objects across 60 distinct classes within approximately 1,400 km² of annotated imagery. Each object is labeled with bounding boxes, making the dataset highly suitable for training and evaluating deep learning models for object detection in overhead views. For a detailed breakdown, refer to the Dataset Structure section.

### How do I cite the xView dataset in my research?

If you utilize the xView dataset in your research, please cite the following paper:

BibTeX

    @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}
    }

For more information about the xView dataset, visit the official xView dataset website.

📅 Created 1 year ago ✏️ Updated 5 months ago

## Comments