Human-in-the-Loop Module
Script for human review of the unmatched YOLO and GroundingDINO results.
- src.pipeline.human_intervention.export_versioned_results(project_id: str, output_dir: Path, version: str = None) dict [source]
Export human review results to a versioned file.
- Parameters:
project_id – Label Studio project identifier.
output_dir – Directory to save human review results.
version – Version string for the output file.
- Returns:
Human review results.
- src.pipeline.human_intervention.import_tasks_to_project(base_url: str, headers: Dict[str, str], project_id: int, tasks_file: Path) bool [source]
Import tasks from a JSON file into a Label Studio project.
Loads pre-annotated tasks into the given project for human review.
- Parameters:
base_url – Label Studio server URL.
headers – HTTP headers with the API token.
project_id – ID of the target project.
tasks_file – Path to the JSON file with tasks.
- Returns:
True if import succeeded, False otherwise.
- Return type:
bool
- src.pipeline.human_intervention.run_human_review(project_name: str = 'AutoML-Human-Intervention', export_results_flag: bool = None) dict [source]
Run the complete human review workflow.
This function processes JSON files from the pending directory, creates a Label Studio project, and handles the human review workflow.
- Parameters:
project_name – Name of the Label Studio project
export_results_flag – Whether to export results (None = ask user)
- Returns:
Dictionary containing the results of the human review process.
- Return type:
dict
- src.pipeline.human_intervention.setup_label_studio(project_name: str, output_dir: str) dict [source]
Setup a Label Studio project for human review.
- Parameters:
project_name – Name of the Label Studio project.
output_dir – Directory to store Label Studio data.
- Returns:
Dictionary with project configuration details.
- src.pipeline.human_intervention.transform_reviewed_results_to_labeled(export_results: list, labeled_dir: Path = None, image_dir: Path = None) int [source]
Transform reviewed Label Studio results to labeled directory. Removes original pending files and saves human-reviewed data.
- Parameters:
export_results (list) – List of results from Label Studio export
labeled_dir (Path) – Directory to save labeled files
image_dir (Path) – Directory containing images
- Returns:
Number of files transformed
- Return type:
int