How kaiwen-zhu/agenticir works
AgenticIR restores complexly degraded images by assessing degradation, planning an ordered sequence of restoration subtasks, executing restoration tools, and evaluating results to select outputs or revise the plan. It can use learned experience and rollback; the README also documents synthetic degradation data generation, exploration and distillation, and evaluation. Source excerpts are partial, so links are limited to documented capabilities or visible ownership; the exact wiring of unsampled modules is not asserted.
Main entry points: iragent.py IR agent · depictqa.py LLM adapters · gpt4.py GPT-4 adapter · explore.py Experience exploration
Components 21
Restoration runtime
- Inference entry
pipeline/infer.py - IR agent
pipeline/iragent.py - Planning prompts
pipeline/prompts.py - LLM adapters
llm/depictqa.py - GPT-4 adapter
llm/gpt4.py - LLM base
llm/base_llm.py - Image workflow tree
utils/img_tree.py
Restoration tools
- Tool dispatcher
executor/__init__.py - Tool runner
executor/tool.py - Restoration models
executor/multitask_tools.py - Restoration subtasks
executor
Experience and data
- Degradation synthesis
dataset/synthesize.py - Degradation transforms
dataset/add_single_degradation.py - Exploration sequences
exploration/exhaust_seq.py - Experience exploration
exploration/explore.py - Knowledge distillation
exploration/distill.py
Evaluation
- Score computation
eval/compute_scores.py - Method comparison
eval/compare_methods.py
Other components
- Image user
- Model services
- Clean images and depth
Connections 21
- Image user → Inference entry: submits image
- Inference entry → IR agent: starts restoration
- IR agent → Planning prompts: formats requests
- IR agent → GPT-4 adapter: plans and reasons
- IR agent → LLM adapters: assesses results
- GPT-4 adapter → LLM base: uses base
- LLM adapters → LLM base: uses base
- GPT-4 adapter → Model services: queries model
- LLM adapters → Model services: queries model
- IR agent → Tool dispatcher: dispatches subtasks
- Tool dispatcher → Tool runner: runs tools
- Tool runner → Restoration models: invokes model adapters
- Restoration models → Restoration subtasks: handles restoration tasks
- IR agent → Image workflow tree: records workflow
- Degradation synthesis → Degradation transforms: applies transforms
- Clean images and depth → Degradation synthesis: supplies source data
- Exploration sequences → Tool dispatcher: generates tool sequences
- Experience exploration → LLM adapters: evaluates images
- Experience exploration → Image workflow tree: records explorations
- Knowledge distillation → Experience exploration: summarizes experience
- Score computation → Method comparison: provides scores