InstructIR

INSTRUCTIR

Restores a photo by following a sentence in plain English, such as remove the noise, take the rain out, fix the blur, clear the haze or brighten this dark photo. One model, one instruction per request.

Image Editingimage-restorationinstruction-followingdenoisingderainingdeblurringdehazinglow-lightmitFine-tunable
InstructIR: Image Editing model on Kainguru

About InstructIR

Capabilities

  • Say what you want — one English sentence picks the repair: noise, rain, blur, haze, a dark photo or washed-out colours
  • One model — no task list to choose from: the instruction steers the same network
  • Same size out — the result has the photo's own width and height
  • Fine-tunable — train it on your own pairs of damaged and restored pictures, with an instruction for each

Good to know

  • Pictures are PNG, JPEG or WebP, at most 50 MB and 16.8 megapixels, at least 16 pixels a side; large ones are processed in overlapping tiles.
  • Instructions are English, one line of at most 256 characters (the model reads the first 64 words and word pieces). It was trained on synthetic and academic degradations, so it works best on photos damaged that way; a vague instruction such as retouch this photo gives a general clean-up.
  • Fine-tuning takes one ZIP (at most 4 GB, no password) with 4 to 1000 pairs of a damaged picture and the same picture restored, both the same size and at least 128 pixels a side, and a manifest.jsonl holding one {"input": "...", "target": "..."} line per pair, paths relative to the manifest. Every pair uses the instruction parameter unless its line has an "instruction" of its own. The text encoder and the language head are not changed: only the image network learns.
  • Training stops after the steps you ask for or after 9 hours, whichever comes first, and keeps what it has learned.

InstructIR inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—The picture to restore: PNG, JPEG or WebP, at most 50 MB and 16.8 megapixels, at least 16 pixels a side.
1–2048 characters · image/png, jpeg, webp
instructiontextYes—What to do to the picture, in plain English: for example remove the noise, my photo is too dark can you fix it, or how can I remove the fog from this photo.
1–256 characters

Output. Returns PNG image: The restored picture as a PNG of the same size.

Run InstructIR with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=INSTRUCTIR" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "instruction": "example"
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "INSTRUCTIR",
        {
          "image": "https://example.com/input.png",
          "instruction": "example"
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune InstructIR

You can fine-tune InstructIR on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, no password) with 4 to 1000 pairs of a damaged picture and the same picture restored, the same size, and manifest.jsonl with one {"input", "target"} line per pair, each with an optional "instruction". More: README.

The steps are in the docs.

InstructIR pricing

Price per image: 0.0874 credits ($0.000874). The price is shown again before every run; all prices are on the pricing page.

Licence and source

MAXIM: Image Editing model on Kainguru
Image Editing

MAXIM

Removes blur and noise from photos: motion blur from camera shake (two models, synthetic and real) and real camera…

Fine-tunable
HVI-CIDNet: Image Editing model on Kainguru
Image Editing

HVI-CIDNet

Brightens dark and low-light photos and restores their colour, lifting the shadows without washing out the highlights…

Fine-tunable
SCUNet: Image Editing model on Kainguru
Image Editing

SCUNet

Removes real-world noise from photos, such as the grain of low light, high ISO and phone cameras, and keeps their fine…

Fine-tunable
DeOldify: Image Editing model on Kainguru
Image Editing

DeOldify

Colourises old black-and-white photos in two styles: artistic, with bolder colours, or stable, calmer and more…

Fine-tunable
OmniGen v1: Image Editing model on Kainguru
Image Editing

OmniGen v1

Edits a picture from a plain-language instruction with OmniGen v1 (3.8B, MIT): add, remove or change objects, people…

Fine-tunable
Swin2SR: Image Editing model on Kainguru
Image Editing

Swin2SR

Enlarges a JPEG-compressed photo 4 times in width and height and removes its blocky compression artefacts as it does.

Fine-tunable