# Invoice Intelligence

> Build, train, and deploy PyTorch image captioning models with LSTM, Attention, and Transformer decoders.

Invoice Intelligence is a free AI agent skill on Agensi by Mohamed Aymane Badia, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Mohamed Aymane Badia](https://www.agensi.io/creators/mohamed-aymane-badia)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.0
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/invoice-intelligence
- Tags: ai-agents, pytorch, computer-vision, transformer, fastapi

## About this skill

Setting up an image captioning pipeline from scratch often results in a mess of unoptimized feature extraction, mismatched model dimensions, and brittle training scripts. This skill delivers a production-ready PyTorch codebase for building and deploying vision-language systems using ResNet50 and multiple decoder architectures.

### What it does
- **Multi-Decoder Support** implements LSTM baselines, Bahdanau attention, and Transformer architectures for comparative performance analysis.
- **Automated Feature Extraction** precomputes ResNet50 global and grid features to accelerate training by 10x compared to raw image loading.
- **Evaluation Suite** calculates BLEU-1 through BLEU-4 metrics and generates attention heatmaps to visualize model focus.
- **Feedback Loop** enables online learning from user corrections with a BLEU-based guardrail to prevent catastrophic forgetting.
- **Full-Stack Demo** scaffolds a FastAPI backend and React frontend for real-time inference and model testing.

### How it works
1. **Scaffold** the project structure and install dependencies using the provided setup scripts.
2. **Prepare Data** by processing raw images (like Flickr8k) and extracting features into optimized `.npy` files.
3. **Train and Evaluate** by selecting a decoder type and running the training script with early stopping.
4. **Deploy** via the Streamlit dashboard or the FastAPI/React stack to test captions on new images.

### Frameworks & tools
PyTorch, Torchvision, FastAPI, React, Streamlit, NumPy, Matplotlib, and Pillow.

### Why this beats prompting it yourself
Prompting an LLM to write a vision-language pipeline usually results in "hello world" scripts that fail at scale or lack proper evaluation metrics. This skill provides the plumbing for frozen encoders, precomputed feature grids, and gated retraining logic that would take weeks to debug manually.

### Use cases
- Compare the caption accuracy of RNNs versus Transformers on custom datasets.
- Build a search engine that generates textual metadata for private image libraries.
- Create an educational workbench for studying "Show, Attend and Tell" mechanisms.
- Implement a self-improving captioning API that learns from human feedback.

### Known limitations
Requires external download of the Flickr8k dataset or similar formatted data. Training on CPU is significantly slower than GPU/MPS and is only recommended for small tests.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Invoice Intelligence skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What exactly is included in the 'image captioning pytorch' skill package?

This skill provides a complete, production-ready PyTorch codebase that includes multiple decoder architectures (LSTM, Attention, Transformer), automated ResNet50 feature extraction, and a full-stack deployment suite using FastAPI and React.

### Can I use this skill to train a model on my own private image dataset?

Yes, while it includes a setup for the Flickr8k dataset, the pipeline is designed to work with any custom image-caption pairs by following the provided data preparation scripts to extract features into optimized .npy files.

### What are the hardware requirements for running these captioning models?

The codebase is optimized for GPU/MPS acceleration to handle heavy vision-language processing; while it can run on a CPU for small tests, a dedicated GPU is highly recommended for efficient training and inference.

### How does this skill handle model evaluation and refinement compared to basic scripts?

This skill solves the 'brittle script' problem by providing pre-built evaluation metrics (BLEU-1 through 4), attention heatmaps for interpretability, and a feedback loop that allows the model to learn from human corrections without crashing.

### How easy is it to deploy the trained model into a production environment?

The skill provides a ready-to-use FastAPI backend and a Streamlit dashboard, making it easy to integrate the captioning engine as a microservice within larger AI agent workflows or web applications.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
