scripts.processing.gemini_classify
Gemini Classification + Rotation Script
Replaces the traditional pipeline steps (empty detection, identifier classification, handwritten/printed classification, rotation correction) with a single Gemini API call per specimen image.
For each specimen image: 1. Reads detection results (bounding boxes) from the detection CSV 2. Sends the full image + bounding boxes to Gemini 3. Gets per-label: category (empty/identifier/printed/handwritten/mixed) + rotation angle 4. Rotates labels locally using OpenCV 5. Saves classified images into category subdirectories and rotation metadata
- Usage:
python gemini_classify.py -i <input_dir> -o <output_dir> -d <detection_csv> python gemini_classify.py -i <input_dir> -o <output_dir> # SLI mode (no detection)
Functions
|
Load detection bounding boxes grouped by source filename. |
|
|
|
Parse command-line arguments. |
|
Process a single pre-cropped label image (SLI mode). |
|
Crop label region from the full image, rotate it, and save to category dir. |