How it works

How in-browser AI works

The short answer

ImgTagger delivers the AI model to your browser and runs it there. The tagger downloads a WD14 model from Hugging Face when you first open it, stores it in your browser if it can, and runs it on your own CPU using ONNX Runtime Web and WebAssembly. The costs are a large first download, heavy memory use and high CPU load while tagging. This guide explains what is downloaded, where it is stored and how to remove it.

Many online AI image tools run their model on a server. ImgTagger's taggers run the model in your browser instead. The model is delivered to your browser once, and the analysis happens on your own computer. Below is what gets downloaded, where it is stored and what it costs your machine. For what data we may collect, see our privacy policy.

What happens when you open the tagger

When you load the auto-tagger, the page goes through these steps:

  1. The page loads. This includes our HTML, scripts and styles from imgtagger.com (served through Cloudflare), including the JSZip library that builds ZIP downloads, and Google's ad script.
  2. The engine loads. ONNX Runtime Web 1.22.0 fetches its WebAssembly files from imgtagger.com.
  3. The model is found or fetched. The page looks for the selected model in your browser's IndexedDB storage, in a database called onnx-model-cache. If it isn't there, it downloads model.onnx and the tag list selected_tags.csv from the model's Hugging Face repository and saves both. The links are pinned to one fixed revision of each file. If the browser won't let the page save them, the model still loads and simply downloads again next time.
  4. Workers start. The page starts a pool of background workers. Each one gets its own copy of the model and prepares it to run.
  5. Ready. From here on, tagging needs no network connection at all.

The download in step 3 is the big one. The six models are all by SmilingWolf and published on Hugging Face. All six model cards state the Apache-2.0 license.

ModelDownload sizeTags it can output
ViT v3 (default)379 MB10,861
SwinV2 v3467 MB10,861
ConvNeXt v3395 MB10,861
ConvNeXt V2 (2023)388 MB9,083
Swin V2 (2023)455 MB9,083
ViT V2 (2023)373 MB9,083

Our WD14 model comparison explains the differences between them. The one-picture taggers, such as the character tagger, use ViT v3 and the same storage, so a model downloaded on one page is not downloaded again on another.

What happens when you tag an image

  1. You drop or choose files. The browser reads them from your disk into the tab's memory with the standard FileReader API.
  2. For each image, the page draws it onto an invisible canvas. It pads the image to a square with white, resizes it to 448×448 pixels, and turns the pixels into a list of 602,112 numbers (448 × 448 × 3 color channels).
  3. Those numbers are handed to a free worker. This hand-off happens inside your browser's memory and never touches the network.
  4. The worker runs the model and returns a confidence score for every tag in the list.
  5. The page keeps the tags that clear your confidence threshold, drops anything on your blacklist, and adds the rest to the image.

The raw scores are kept in memory for each model you use. If you change the threshold or blacklist and run again, the model doesn't need to run a second time. Your tags, edits and images exist only in that tab until you download them as a ZIP.

What the tab connects to when you use a toolThe tab fetches pages and the model engine from imgtagger.com, models from Hugging Face, and a HEIC decoder from jsDelivr only when a HEIC photo needs one. Pictures are processed inside the tab. Pictures added to our tools are also sent to our API, and Google receives analytics and ad requests. Your files on disk are only read.Your browser tabthe picture is processed hereimgtagger.compages and scriptsjsDelivrHEIC decoder, if neededHugging Facethe model, onceOur APIpictures added to toolsGoogleanalytics and adsYour diskfiles never changedsolid: comes into the tab dashed: goes out of it
The table in the text lists each destination and when it is used. The picture is processed inside your tab, but a copy of pictures added to our tools is also sent to our own API, as the privacy policy describes.

ONNX Runtime Web and WebAssembly, in brief

ONNX is an open file format for trained AI models. A model trained in one framework can be exported to ONNX and run anywhere with an ONNX runtime. ONNX Runtime Web is the browser version of ONNX Runtime, Microsoft's open-source engine for running these models.

WebAssembly (WASM) is a compact code format that browsers can run at close to native speed. It runs inside the same security sandbox as any other web page code, so it can't read your files unless you hand them to the page. ONNX Runtime Web can use several "backends". The taggers use the WebAssembly backend, which runs on your CPU, so the tagging model doesn't run on your graphics card. A few of our other tools can use the graphics chip through WebGPU, covered further down.

The worker pool: how many and why

A Web Worker is a background thread that a page can start. Work done in a worker doesn't freeze the page, and several workers can run at once on different CPU cores. ImgTagger runs one model engine per worker, each using a single WebAssembly thread, and tags several images in parallel.

The pool size is 80% of the number your browser reports in navigator.hardwareConcurrency, rounded down, with a minimum of 4 and a maximum of 20. That number is the count of logical processors, which on many CPUs is twice the number of physical cores.

Logical processors reportedWorkers started
2, 4 or 64
86
129
1612
2419
32 or more20

Some browsers and privacy settings report a lower number than your real processor count. If so, you get a smaller pool, but never fewer than four workers. Phones, tablets and computers that report 4 GB of memory or less run one worker with the 8-bit copy of ViT v3, since every worker holds its own copy of the model.

The costs of running AI in your browser

A large first download

Each model is a one-time download of 373 to 467 MB, as long as your browser keeps it (99 MB for our 8-bit copy of ViT v3, which phones and tablets get). If you try all six, that is about 2.5 GB of downloads and the same amount of browser storage. On a metered or slow connection, pick one model and stick with it.

Memory

This is the biggest cost. Every worker holds its own copy of the model, and the page keeps at least one more. Multiplying the model size by the number of workers gives a rough lower bound for memory use. The real figure is higher, because the model also needs working memory while it runs.

WorkersViT v3 (379 MB)ConvNeXt v3 (395 MB)SwinV2 v3 (467 MB)
4~1.5 GB~1.6 GB~1.9 GB
6~2.3 GB~2.4 GB~2.8 GB
12~4.5 GB~4.7 GB~5.6 GB
20~7.6 GB~7.9 GB~9.3 GB

This is an estimate from file sizes, not a measurement, but the pattern holds: a machine with many processors starts many workers and needs a lot of RAM. There is currently no setting to run fewer workers. On a machine with 8 GB of memory or less:

  • Close other browser tabs and memory-heavy apps before tagging.
  • Use ViT v3 or ConvNeXt v3 rather than SwinV2 v3, the largest model.
  • Avoid switching models back and forth. Models you have loaded stay in the page's memory until you reload the tab, so reload after switching.

If the tab runs out of memory, the browser usually shows a crash page. Reload and try again with less open.

CPU, heat and battery

With 80% of your logical processors busy, a large batch keeps most of your CPU working flat out. Expect fans to spin up and laptops to get warm, and plug in for big batches, because a long run drains a battery quickly. Browsers also throttle hidden tabs to save power, so a batch can slow down or pause until you switch back to it.

Smaller copies of a model: 8-bit and 4-bit

A model file is mostly weights, the millions of numbers learned in training, and the original exports store each one as a 32-bit floating-point value. Quantizing a model stores the weights of its large matrix multiplications as 8-bit or 4-bit integers plus scale factors that map them back to approximate values. The file shrinks roughly in proportion to the bit width, and the answers shift slightly, because every weight is now a close approximation of the original.

We use quantized copies in three places:

ModelSizesNotes
WD14 ViT v3 tagger379 MB full, 99 MB as our 8-bit copyOnly the matrix-multiplication weights are 8-bit; the tag list is the same 10,861 tags. Phones, tablets and computers reporting 4 GB or less get this copy
The AI Image Checker's detector57 MB at 4 bits (the one we ship)On 249 test pictures, AUC 0.896 at full precision, 0.881 at 8 bits, 0.902 at 4 bits
CLIP ViT-B/32 for Search Images577 MB full, 146 MB at 8 bitsOne-word searches on 80 photos: 0.900 of the top 8 right in the page, 0.912 for the 8-bit model run natively, 0.875 for the full-size model

In both of our tests with a full-size comparison, the smaller file scored about as well as the full one, and slightly better on these particular pictures. Differences of a few points on a few hundred pictures could easily reverse on another test set, so the fair reading is "no measurable loss" rather than "quantizing improves a model". What quantizing reliably changes is the download and the memory: the 8-bit tagger is about a quarter of the full file, which is what makes it usable on a phone.

Where the model is stored, and how to delete it

Downloaded models live in your browser's IndexedDB, a storage area that belongs to imgtagger.com only. Other websites can't read it. There are two ways to remove them.

In the app: click Delete downloaded models under Advanced in the tagger's Auto-tag panel and confirm. This deletes every cached model and tag list. The next time you load the tagger, the selected model downloads again.

In your browser: deleting imgtagger.com's site data removes the models too.

  • Chrome and Edge: click the icon to the left of the address bar, open the site settings, and delete the site's data.
  • Firefox: click the padlock in the address bar and choose to clear cookies and site data.
  • Safari: open Settings, go to Privacy, choose Manage Website Data, search for imgtagger.com and remove it.

Clearing all site data also resets your saved settings, such as the blacklist and prepend tags, which are kept in the browser's local storage. If you want to see the cached models first, open DevTools, go to the Application tab (Storage in Firefox) and expand IndexedDB.

How much a browser lets a site store

Whether the model stays cached depends on the browser's storage rules. These figures come from MDN's page on storage quotas and eviction:

BrowserMost one site can storeWhen the browser deletes it on its own
Chrome, Edge and other Chromium browsersUp to 60% of the total disk sizeWhen the disk runs low, starting with the least recently used sites
Firefox10% of the disk or 10 GiB, whichever is smallerThe same least-recently-used rule
Safari on macOS 14 and iOS 17 or laterAround 60% of the total disk sizeThe same rule, and with cross-site tracking prevention on, data a site created from script is deleted if you have not clicked or tapped on that site in the last seven days of browser use

Three things follow for the tagger. First, room is rarely the problem: even all six models (about 2.5 GB) fit well inside these limits on a computer with a normal amount of free space. Second, Safari users who come back after more than a week of browsing elsewhere should expect the model to download again. Third, when a browser evicts a site, MDN says it deletes all of that site's data at once, so your saved blacklist and prepend tags go with the models. Older Safari versions gave each site 1 GiB and then asked permission to store more, so on those a second model can trigger a prompt.

What the site connects to

DestinationWhat it fetchesWhen
imgtagger.com (served through Cloudflare)Pages, scripts, styles, the worker script and the ONNX Runtime Web engine filesEvery visit; the engine files on tool pages that run a model
cdn.jsdelivr.netThe HEIC decoderAdding a HEIC photo your browser cannot open itself
huggingface.co and its hf.co download serversModel file and tag listOpening the batch tagger or switching models, or adding a picture to a single-picture tagger, unless that model is already cached
Our API (Cloudflare Workers)Receives content you add to our tools, as described in our privacy policyWhen you add images to a tool
Google ad services, and the ad content they loadAdsPages that show ads
Google Analytics (googletagmanager.com, google-analytics.com)Visit statistics: page viewed, device and browser type, approximate locationEvery page view

The duplicate finder and color fixer don't download a model at all. They do their work with ordinary JavaScript and the browser's canvas.

The ads are served by Google AdSense. Like the ads on any ad-supported site, they run Google's scripts on the page and may use cookies. Google Analytics records which pages are visited so we know what to improve. Our privacy policy explains both. Every request a page makes also shows up in your browser's developer tools (press F12 and open the Network tab).

Other model tools: processor or graphics chip

The taggers are one of several pages that run a model in the tab. The others follow the same pattern (download once, keep a copy, run locally), but they differ in size, in where the copy is kept and in whether they can use the graphics chip.

ToolModel and downloadRuns onKept in
Background RemoverIS-Net: 44 MB (photos) or 176 MB (drawings)ProcessorIndexedDB
Denoise ImageSCUNet, 73 MBGraphics chip when the browser offers WebGPU, otherwise processorIndexedDB
AI Image Checker4-bit detector, 57 MBProcessorIndexedDB
Image Caption GeneratorFlorence-2 base: about 343 MB for the graphics-chip set, about 265 MB for the processor setGraphics chip if it supports 16-bit floating point in shaders, otherwise processorThe browser's Cache API
Search Images and Group Similar ImagesCLIP ViT-B/32 at 8 bits: 146 MB for search, 85 MB for grouping (which never loads the text half)ProcessorThe browser's Cache API

WebGPU is the browser interface that lets a page run calculations on the graphics chip. When it works, the gap is large. On the busy laptop we test with, the caption generator wrote all three caption lengths for a picture in about 2 to 2.8 seconds on the graphics chip and in about 21 seconds on the processor. If the graphics chip fails to start or fails on a picture, both the caption generator and the denoiser switch to the processor, say so on the page and repeat the step that failed.

The processor path also varies by browser. The AI Image Checker's detector takes about 1.1 seconds per run in Chromium and 16.8 seconds in Firefox: the same model file running in the same ONNX Runtime Web build, so the difference lies in how each browser runs it. If a model tool feels slow, trying it in another browser is a quick test.

The storage column decides what the tagger's Delete downloaded models button reaches. It empties the shared IndexedDB store, which holds the tagger models and the models of the Background Remover, the denoiser and the AI checker, because they all download through the same helper. The caption and CLIP models are kept by the transformers.js library in the Cache API, and clearing imgtagger.com's site data in your browser is what removes those.

Browser support caveats

  • Use a current browser. The tagger needs WebAssembly and module Web Workers, and uses IndexedDB to cache the model when it is available. Recent versions of Chrome, Edge, Firefox and Safari support all of them.
  • Private windows may not keep the model. Private and incognito modes often limit storage or delete it when you close the window, so the model may download again every time.
  • Storage depends on free disk space. Browsers only let a site store so much, based on your free disk space. If the model can't be saved, the tagger still works, but it downloads the model again on your next visit.
  • Phones and tablets get a lighter setup. They run one worker with the 99 MB 8-bit copy of ViT v3, because four full copies of a model do not fit in a phone's memory. That tags one picture at a time, so large batches go much faster on a desktop or laptop.
  • Blocked domains break loading. If an extension, firewall or workplace network blocks huggingface.co, the tagger can't load its model.

When a model download fails

A download of a few hundred megabytes over a phone connection or a busy hotel network does not always finish in one go, so every model download on the site goes through one shared helper that is built to keep going:

  • Up to five tries, with waits of 2, 4, 8 and 12 seconds between them. If the browser reports that the connection is back, the wait ends early.
  • Resuming instead of restarting. After a break, the next try asks the server for the rest of the file from the byte where it stopped (an HTTP range request, on servers that allow it), so a drop at 90% costs only the last 10%.
  • Pausing in the background. While the tab is hidden or the browser is offline, the tries are not used up. The helper waits, for up to 10 minutes, and carries on when the tab and the connection are back.
  • One buffer. The file is written into a single block of memory of its final size. A phone often has no room for the pieces plus a joined copy.

If it still fails, the page says which of these happened and what to do:

What the message saysWhat happenedWhat to do
You're offlineThe browser has no connectionReconnect and press Try again. The download goes on from where it stopped
The connection dropped (with a percentage)The transfer broke partwayPress Try again while the page is still open, so the kept bytes are reused. On a phone, Wi-Fi is steadier
Couldn't reach the serverNo answer at allA weak signal, a VPN or a content blocker is the usual cause. Switch between Wi-Fi and mobile data, or turn the blocker off for this site
The server is busy (error 5xx or 429)The file host is overloaded or rate-limitingWait a minute and try again
The server did not allow the download (other 4xx errors)The request was refusedTry later, or in another browser
This device ran out of memoryThe tab could not hold the modelClose other tabs and apps, or use a computer
Downloaded but could not startThe model arrived but the engine would not run it in this browserTry again, then another browser

On Chrome, which reports a device's memory to pages, a device that reports 2 GB or less also gets a short note on the tagger's progress line that it may not manage the model.

Once the tagger is running, our image dataset workflow shows how the tools fit together.

Put this into practice

Run WD14 tagger models on a whole folder, then search, filter and bulk-edit the tags before exporting .txt caption files. It runs in your browser. Open the Batch WD14 Tagger & Editor.

Frequently asked questions

Does ImgTagger work offline?

Partly. Once the page and model are loaded, tagging and editing work without a connection. The page itself still has to be loaded from the internet, and there is no installable offline version. If you reload while offline, the page won't open.

Can Hugging Face see which images I tag?

No. Hugging Face only receives an ordinary download request for the model file and tag list, like any file download, including your IP address. The request contains no image data.

What happens to my tags if I close the tab?

They are gone from the page. Download a ZIP of your .txt files before you close the tab or reload it.

How can I see how much space imgtagger.com is using in my browser?

In Chrome or Edge, click the icon to the left of the address bar and open the site settings, which show the stored data. In any current browser you can also open DevTools, go to the Console and run await navigator.storage.estimate(). It returns usage and quota in bytes for this site. MDN notes the usage figure is an estimate, so expect it to differ a little from the file sizes in the model table.

Can I copy a downloaded model to another browser or computer?

No. The cached copy belongs to one browser profile and one site, and other browsers cannot read it. Each browser you use, and each private window, downloads its own copy the first time.