label_processing.label_rotation

Label Rotation Module (TensorFlow)

Predicts and corrects the orientation of label images using a trained TensorFlow classification model that outputs one of four angle classes (0°, 90°, 180°, 270°). Used by the traditional pipeline; the Gemini pipeline determines rotation angles via the Gemini API instead.

Functions

debug_save_by_angle(image_paths, ...)

Copy images into angle-named subdirectories for visual debugging.

get_image_paths(input_image_dir)

Get a list of image paths in the input directory.

get_predicted_angles(model, images)

Predict angles for a list of images using a trained model.

load_image(image_path)

Load an image from a file path.

load_images(image_paths)

Load images from a list of image paths.

predict_angles(input_image_dir, ...[, debug])

Load a trained model, predict angles for input images, and rotate images accordingly.

rotate_image(image, angle)

Rotate an image based on a given angle.

rotate_image_pil(image_path, angle_deg, ...)

Rotate an image using PIL and save the result.

rotate_images(image_paths, predicted_angles, ...)

Rotate images based on their predicted angles and save them to the output directory.

rotate_single_image(image_path, angle, ...)

Rotate a single image based on a given angle and save the rotated image.

save_image(image, output_path)

Save an image to a file path.