- Increase padding from 10-15px to 20-30px for context - Emphasize ENTIRE item must be visible, not tight crop - Add examples of correct vs wrong crop detection - Address findings from debug panel testing: AI was cropping too tightly
8.5 KiB
Technical Inventory Hardware Extraction Protocol
Extract ALL relevant hardware items from the image with precise, standardized formatting.
Filtering Rules
- INCLUDE: Physical hardware, modules, cables, servers, storage, transceivers
- EXCLUDE: Generic mounting hardware (screws, brackets, rails), paper licenses, empty packaging
- Multi-item labels: Treat each SKU/variant as a separate item (e.g., "5m cable" and "7m cable" = 2 items)
Item Field Format (CRITICAL)
[]
Component Rules:
-
<size_or_length>:- STORAGE CAPACITY - HUMAN READABLE: Convert to largest unit (TB/MB).
- Examples: "1600GB" → "1.6TB", "256GB" → "256GB", "512MB" → "512MB"
- Rule: If ≥1000GB, use TB. If ≥1000MB, use GB. Otherwise use MB.
- CABLE/WIRE LENGTH: Meters only. Examples: "5m", "10m", "50m"
- RAM DIMM: Capacity in GB. Examples: "128GB", "32GB", "8GB"
- STORAGE CAPACITY - HUMAN READABLE: Convert to largest unit (TB/MB).
-
<part_number>: Part number ONLY if visible. If the item has an identifiable Part Number, search web for what item this is and extract needed informations or compare with what was already identified, and correct all fields. Omit serial numbers. -
<type>: Asset class. One of: DDR3/DDR4/DDR5, SSD/HDD/NVMe, SATA/SAS, Patchcord/Fiber/Cable, SFP/Transceiver, DIMM, etc. -
<vendor>: Manufacturer (HP, HPE, Dell, Samsung, Cisco, Hynix, Intel, Broadcom) -
<connector>: Physical interface (RJ45, LC-LC, MPO, U.3, SATA, SAS, ST, SC). Omit if N/A.
Item Examples (WITH HUMAN-READABLE SIZES):
1.6TB NVMe HPE U.3 P66093-002(not 1600GB)256GB SSD Dell SATA SK-8765(already human-readable)5m Patchcord LC-LC128GB DDR4 Hynix512MB Cache Samsung SATA(stays MB if under 1GB)
Size Conversion Examples:
- 1600GB → 1.6TB
- 2048GB → 2TB
- 512GB → 512GB (under 1TB threshold)
- 256MB → 256MB
- 1024MB → 1GB
Restrictions:
- No comments in parenthesis
- No measurement units in Item field (e.g., "1.6TB" not "1.6TB Storage")
- No secondary vendors
- No diameter/mm in Item field
- ONE vendor only (primary manufacturer)
Other Fields
- Type: Repeat the asset class (DDR4, SSD, NVMe, Patchcord, etc.)
- Description: Technical summary, max 5 words. Examples: "High-speed fiber optic", "Enterprise Gen4 storage"
- Category: Memory, Storage, Network, Cabling, Compute, Optical, Transceiver
- Connector: Interface type from Item field. Examples: "LC-LC", "RJ45", "U.3"
- Size: HUMAN-READABLE capacity or length. Examples: "1.6TB", "256GB", "5m" (NOT "1600GB")
- Color: Physical color if distinguishing
- PartNr: Part number only (no serial numbers)
- OCR: Robust matching key for OCR tolerance
OCR Field Rules (CRITICAL)
Generate a SHORT, clean matching key:
- Format: UPPERCASE space-separated, NO special chars, NO duplicates
- Include ONLY: Type + Size + Primary Vendor + Connector + Part Number
- EXCLUDE: Serial numbers, secondary vendors, duplicate tokens, EMC/SK labels
- USE HUMAN-READABLE SIZE: Use TB/GB from Item field, not original notation
OCR Format: TYPE SIZE VENDOR CONNECTOR PARTNUMBER
OCR Examples (WITH HUMAN-READABLE SIZES):
- Item:
1.6TB NVMe HPE U.3 P66093-002→ OCR:NVME 1.6TB HPE U3 P66093002 - Item:
5m Patchcord LC-LC→ OCR:PATCHCORD 5M LC LC - Item:
256GB SSD Samsung SAS SK-8765→ OCR:SSD 256GB SAMSUNG SAS SK8765 - Item:
128GB DDR4 Hynix→ OCR:DDR4 128GB HYNIX
OCR Constraints:
- NO duplicate part numbers
- NO secondary vendor names
- NO extraneous labels
- Each token appears ONE time only
- Remove hyphens/special chars for fuzzy matching
- Use HUMAN-READABLE sizes (1.6TB not 1600GB)
Image Processing Guidance (NEW)
Analyze the image layout and return crop/rotation metadata to optimize photo storage:
Crop Bounds Analysis
- Identify the PRIMARY ITEM in the image (main object, not background/clutter)
- Return bounding box:
{x, y, width, height}in pixel coordinates - Rules:
x, y: top-left corner of item (pixel offset from image top-left)width, height: dimensions of item bounding box — MUST include the ENTIRE visible item- Include adequate padding (20-30 pixels) around item edges for context
- Crop should show the complete item clearly with some breathing room, NOT tightly squeezed
- Ignore background clutter, other items, hands, reflections
- CRITICAL: If the item has text/labels on multiple sides, ensure the bounding box captures ALL of them, not just one section
Crop Examples:
- ✅ CORRECT: Entire hard drive visible with all text readable (top label, side labels, connectors)
- ✅ CORRECT: Full cable with both ends visible and part number readable on main label
- ❌ WRONG: Only the top corner cropped, missing the body and other labels
- ❌ WRONG: Tiny bounding box around just one line of text, ignoring rest of item
Rotation Analysis (CRITICAL - MAKE TEXT READABLE IN STANDARD ENGLISH)
IMPORTANT: Photos may be at ANY angle. Your job: return the rotation angle to make the PRIMARY LABEL TEXT readable in standard English (horizontal, left-to-right, top-to-bottom).
The image has EXIF orientation metadata stripped. Analyze it in its RAW/NATIVE state. Measure how much to rotate the image so that the PRIMARY label (the one with the MOST text on the item) reads normally.
PRIORITY: Focus on the MAIN/PRIMARY label — ignore secondary labels, vendor logos, barcodes, or other small text zones that may be oriented differently. If multiple text zones conflict, optimize for the largest one.
Algorithm:
- Identify the PRIMARY text/label — the one with the MOST content (part number, manufacturer, specs, technical details)
- Determine the CURRENT orientation of that text:
- Is it horizontal and readable left-to-right? → rotation needed:
0° - Is it rotated 90° (vertical, pointing up)? → rotation to horizontal:
-90°or+90°(depending on which way) - Is it rotated 180° (upside down)? → rotation to horizontal:
±180° - Is it tilted at an angle? → measure exact tilt needed to make it horizontal
- Is it horizontal and readable left-to-right? → rotation needed:
- Calculate rotation to STANDARD ENGLISH READING (horizontal, left-to-right):
- Positive value = counter-clockwise rotation needed
- Negative value = clockwise rotation needed
- Return any value in range -180° to +180° (full circle allowed)
Measurement examples (make PRIMARY label text readable left-to-right, top-to-bottom):
- Primary text already reads normally horizontally → 0°
- Primary text is vertical, pointing up (90° rotated) → -90° (rotate clockwise to make horizontal)
- Primary text is vertical, pointing down (270° rotated) → +90° (rotate counter-clockwise)
- Primary text is upside-down (180° rotated) → +180° or -180° (rotate half-circle)
- Primary text at 22° angle (tilted right) → -22° (rotate clockwise to level)
- Primary text at -35° angle (tilted left) → +35° (rotate counter-clockwise to level)
- Multiple labels/zones: Item has vendor logo at 90° AND main label at 0°. → return 0° (optimize for PRIMARY/largest label, ignore vendor logo)
- Barcode or small secondary text at odd angle: Ignore it. Rotate to make PRIMARY label readable.
- No angle limit: Photos may be taken at any angle. Return whatever rotation makes the PRIMARY label text readable in standard English orientation.
Confidence Score
- Return
confidence: 0.0-1.0 indicating reliability of crop/rotation analysis - 0.9+ = High confidence (clear item, readable text)
- 0.7-0.89 = Medium confidence (some ambiguity or text partially obscured)
- <0.7 = Low confidence (cluttered image, unclear item boundaries)
Output Format (Extended)
{
"items": [
{
"Item": "[size] type vendor connector partnumber",
"Type": "type",
"Description": "technical details (max 5 words)",
"Category": "category",
"Connector": "connector_type",
"Size": "human_readable_size",
"Color": "color",
"PartNr": "part_number",
"OCR": "TYPE SIZE VENDOR CONNECTOR PARTNUMBER",
"image_processing": {
"crop_bounds": {
"x": 50,
"y": 100,
"width": 300,
"height": 200
},
"rotation_degrees": 15,
"confidence": 0.92
}
}
]
}
Return ONLY JSON. No markdown. No text.