# `mix image_vision.download_models`
[🔗](https://github.com/elixir-image/image_vision/blob/v0.2.0/lib/mix/tasks/image_vision.download_models.ex#L1)

Pre-downloads the default models used by `Image.Classification`,
`Image.Segmentation`, `Image.Detection`, `Image.Background`,
`Image.Captioning`, and `Image.ZeroShot` so that first-call latency
is eliminated and the application can run fully offline.

By default, every category's models are fetched. Pass one or more
of `--classify`, `--segment`, `--detect`, `--background`,
`--caption`, `--zero-shot` to limit the scope. Any category whose
optional dependency is not loaded is skipped with a notice rather
than treated as an error.

ONNX weights for segmentation and detection are stored under the
`ImageVision.ModelCache` cache root (see that module for cache
configuration). Bumblebee classifier and embedder weights are
stored under Bumblebee's own HuggingFace cache (controlled by
`BUMBLEBEE_CACHE_DIR` / the standard HF cache env vars).

## Usage

    mix image_vision.download_models
    mix image_vision.download_models --classify
    mix image_vision.download_models --segment --detect
    mix image_vision.download_models --background --caption --zero-shot

## Configuration

The task respects user overrides for the Bumblebee classifier and
embedder:

    config :image_vision, :classifier,
      model: {:hf, "facebook/convnext-large-224-22k-1k"},
      featurizer: {:hf, "facebook/convnext-large-224-22k-1k"}

Configured values are downloaded; unset values fall back to the
library defaults.

## Options

* `--classify` downloads the classifier and embedder Bumblebee
  models. Requires `:bumblebee` and `:nx`.

* `--segment` downloads the SAM 2 and DETR-panoptic ONNX weights.
  Requires `:ortex`.

* `--detect` downloads the RT-DETR ONNX weights. Requires
  `:ortex`.

* `--background` downloads the BiRefNet lite ONNX weights for
  background removal. Requires `:ortex`.

* `--caption` downloads the BLIP image-captioning model, featurizer,
  tokenizer, and generation config. Requires `:bumblebee`.

* `--zero-shot` downloads the CLIP model, featurizer, and tokenizer
  for zero-shot classification. Requires `:bumblebee`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
