anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Captions images, finds objects and reads text in pictures when you pair an image with a short task prompt. Made for developers and researchers who run vision tasks in Python with transformers.
Florence-2-large is a kit in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page, a zip of its files. Nothing in it runs by itself.
pip install -U huggingface_hub hf download microsoft/Florence-2-large
Florence-2-large is a vision model from Microsoft. You give it an image and a short text prompt, and it answers with text for tasks such as captioning, object detection and segmentation. This copy is a continued pretrained version with a 4k context length and 777M parameters. Its OCR output now separates lines with a newline.
It suits developers and researchers who want one model for several image tasks, chosen by changing the prompt instead of swapping models.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Retail | Catalog engineers | Caption product pictures and detect the objects in them | Drafting a short description for a product photo |
| Research | Computer vision researchers | Study a prompt-based vision model and compare its sizes | Comparing large with the base model on the same images |
| Document work | App developers | Run the OCR task on page images or screenshots | Reading the text from a screenshot, line by line |
| Accessibility | App teams | Describe images in words for people who cannot see them | Drafting a text description for a photo |
Skip it if your work is text only, since this model always works on an image paired with a task prompt.
| Use case | Who | What they get back |
|---|---|---|
| Caption an image | Developers | A written description of the picture |
| Detect objects | Computer vision teams | Detected objects as a parsed answer |
| Read text in a picture | App developers | Recognized text, with line breaks between lines |
pip install -U huggingface_hub hf download microsoft/Florence-2-large
You choose a task prompt, pass it with an image to the processor, and call generate. Then post_process_generation turns the raw text into a parsed answer for that task. The card's own example uses the object detection prompt.
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", torch_dtype=torch_dtype, trust_remote_code=True).to(device)
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
prompt = "<OD>"
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device, torch_dtype)
generated_ids = model.generate(
input_ids=inputs["input_ids"],
pixel_values=inputs["pixel_values"],
max_new_tokens=4096,
num_beams=3,
do_sample=False
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))
print(parsed_answer)| Tool | What it does |
|---|---|
| AutoProcessor | Prepares the text prompt and the image for the model |
| AutoModelForCausalLM | Loads the model, with trust_remote_code set to True |
| generate | Produces the answer tokens for the prompt and image |
| post_process_generation | Turns the generated text into a parsed answer for the task |
You hand the model a picture and the prompt <OD>. The script decodes the generated text and prints the parsed answer, which holds the objects the model found in the picture. The image variable is a PIL image you load yourself.
Think of it as one model that you steer with a short instruction. A good first try is to run the card's object detection code on a single picture and read what it prints.
If you know the field, note that it uses a sequence-to-sequence design and was trained on the FLD-5B dataset, which the card puts at 5.4 billion annotations over 126 million images. The card reports a COCO object detection AP of 39.8 for this version. This version had only 0.1B samples of continued pretraining.
Captions images, finds objects and reads text in pictures when you pair an image with a short task prompt. Made for developers and researchers who run vision tasks in Python with transformers.
Made by microsoft on Hugging Face. These notes are Mindket's, written from its model page and model card; the model's own files and license are on Hugging Face.
What it is: Florence-2-large is a vision model from Microsoft. You give it an image and a short text prompt, and it answers with text for tasks such as captioning, object detection and segmentation. This copy is a continued pretrained version with a 4k context length and 777M parameters. Its OCR output now separates lines with a newline.
Who it suits: It suits developers and researchers who want one model for several image tasks, chosen by changing the prompt instead of swapping models.
Industry | Who uses it | How they use it | Example
Retail | Catalog engineers | Caption product pictures and detect the objects in them | Drafting a short description for a product photo
Research | Computer vision researchers | Study a prompt-based vision model and compare its sizes | Comparing large with the base model on the same images
Document work | App developers | Run the OCR task on page images or screenshots | Reading the text from a screenshot, line by line
Accessibility | App teams | Describe images in words for people who cannot see them | Drafting a text description for a photo
Skip it if your work is text only, since this model always works on an image paired with a task prompt.
Where to use it:
Use case | Who | What they get back
Caption an image | Developers | A written description of the picture
Detect objects | Computer vision teams | Detected objects as a parsed answer
Read text in a picture | App developers | Recognized text, with line breaks between lines
How to set it up:
pip install -U huggingface_hub
hf download microsoft/Florence-2-large
How to use it: You choose a task prompt, pass it with an image to the processor, and call generate. Then post_process_generation turns the raw text into a parsed answer for that task. The card's own example uses the object detection prompt.
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", torch_dtype=torch_dtype, trust_remote_code=True).to(device)
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
prompt = "<OD>"
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device, torch_dtype)
generated_ids = model.generate(
input_ids=inputs["input_ids"],
pixel_values=inputs["pixel_values"],
max_new_tokens=4096,
num_beams=3,
do_sample=False
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))
print(parsed_answer)
Tool | What it does
AutoProcessor | Prepares the text prompt and the image for the model
AutoModelForCausalLM | Loads the model, with trust_remote_code set to True
generate | Produces the answer tokens for the prompt and image
post_process_generation | Turns the generated text into a parsed answer for the task
Example: You hand the model a picture and the prompt <OD>. The script decodes the generated text and prints the parsed answer, which holds the objects the model found in the picture. The image variable is a PIL image you load yourself.
For newcomers and experts: Think of it as one model that you steer with a short instruction. A good first try is to run the card's object detection code on a single picture and read what it prints.
If you know the field, note that it uses a sequence-to-sequence design and was trained on the FLD-5B dataset, which the card puts at 5.4 billion annotations over 126 million images. The card reports a COCO object detection AP of 39.8 for this version. This version had only 0.1B samples of continued pretraining.
Pick a task prompt
Processor packs prompt and image
Model generates answer tokens
Post-processing parses the answer
Good to know:
Download its files with Hugging Face's command line:
pip install -U huggingface_hub
hf download microsoft/Florence-2-large
Then follow the usage in its model card. Nothing in this kit runs by itself.
README.md 6 KB
Listed Hugging Face models in the same category that share the most tags with this one.
| Product | Downloads, last 30 days | Likes | Parameters | License | Last change |
|---|---|---|---|---|---|
| Florence-2-large This page | 403,113 | 1,889 | 777M | mit | |
| Florence-2-baseShares florence2 · vision · pytorch | 14,139,837 | 439 | 232M | mit | |
| elephant-1Shares vision · image-text-to-text · transformers | 7,426 | 115 | 9.4B | mit | |
| Agents-A1Shares vision · image-text-to-text · transformers | 7,232 | 669 | 35.1B | apache-2.0 | |
| mammoth-1Shares vision · image-text-to-text · transformers | 5,903 | 97 | 27.4B | mit | |
| Qwen3.8-27B-piShares vision · image-text-to-text · transformers | 1,857 | 87 | 27.8B | apache-2.0 |
Posts and comments that name this project on Hacker News, Bluesky, X, Reddit, Facebook and YouTube, found by a weekly search and on Trendshift. Mindket doesn’t write or check them. Open one to read it where it was posted.
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
alirezarezvani · Skill
Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…
block · Kit
Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…
backnotprop · Kit
Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.