Detects form fields that applicants need to fill in Japanese documents.
This model is fine-tuned from Qwen3-VL-32B-Instruct using QLoRA to detect input fields in Japanese application forms, registration documents, and other official paperwork.
What This Model Does
Given an image of a Japanese document, this model identifies the bounding boxes of form fields that applicants/customers should fill in, while excluding fields meant for staff/officials.
Example Use Cases
Automating form digitization
Building PDF form generators
Creating accessibility tools for document processing
Despite being 4x larger than the 8B model, the 32B model achieved similar accuracy. The dataset (10 original samples) is the bottleneck, not model capacity.
Current Limitations
Small training dataset - 10 original samples, augmented to 90
Over-detection tendency - 458 predictions vs 177 ground truth (2.6x)
Location precision - Average IoU of 0.22 indicates room for improvement
1import torch
2from PIL import Image
3from transformers import AutoProcessor, AutoModelForImageTextToText
4from peft import PeftModel
56# Load model (32B)7base_model ="Qwen/Qwen3-VL-32B-Instruct"8model = AutoModelForImageTextToText.from_pretrained(9 base_model,10 torch_dtype=torch.bfloat16,11 device_map="auto",12 trust_remote_code=True,13)14model = PeftModel.from_pretrained(model,"takumi123xxx/pdfme-form-field-detector-lora-32b")15processor = AutoProcessor.from_pretrained(base_model, trust_remote_code=True)1617# Prepare prompt18system_prompt ="""You are an expert at analyzing Japanese documents.
19There are two types of input fields:
201. Fields for applicants/customers to fill → Target for detection
212. Fields for staff/officials to fill → Exclude from detection"""2223user_prompt ="""Detect all input fields that applicants should fill in this image.
24Exclude fields for staff.
25Return JSON with bbox coordinates (0-1000 normalized)."""2627# Load image28image = Image.open("your_document.png").convert("RGB")2930messages =[31{"role":"system","content": system_prompt},32{"role":"user","content":[33{"type":"image","image": image},34{"type":"text","text": user_prompt},35]},36]3738text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)39inputs = processor(text=text, images=image, return_tensors="pt").to(model.device)4041output = model.generate(**inputs, max_new_tokens=2048)42result = processor.decode(output[0], skip_special_tokens=True)43print(result)