UXInteract / task_032 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
1.68 kB

Validate and annotate local OCR results

Use the supplied general_ocr_002.ppm and the upstream text-and-box metadata in expected_ocr.json. Run python3 solve.py in the project root. Work offline; text recognition itself is out of scope.

Validation and output

  • Decode the source image and validate the metadata before writing outputs. Each region must have nonempty text and finite in-bounds coordinates with positive area. For an invalid image or an invalid box, exit nonzero with a clear diagnostic and do not emit a successful annotation.
  • Write ocr_results.json as a list of text-region objects, or an object containing the list under texts. Use text and bbox for each region. The box is a flat numeric array: [x1, y1, x2, y2] for a rectangle or [x1, y1, x2, y2, x3, y3, x4, y4] for four polygon vertices. Preserve each supplied text and its region with no omissions or invented or duplicate entries. Leading and trailing whitespace may be trimmed.
  • Write annotated_ocr.png at the source dimensions. Draw a clearly visible four-sided rectangle around each region on the real image. Preserve source pixels outside the annotated boxes.
  • Write ocr_report.md explaining the upstream metadata source, handled image formats, invalid or low-quality input handling, and local save behavior.

Acceptance Checklist

  • Valid results reproduce every supplied text-region association and the source dimensions.
  • Annotations outline all four sides of each box and do not alter unrelated pixels.
  • Invalid image data or invalid box coordinates cause a clear failure without a valid-looking saved image. The report describes what the program actually does.