Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CVAT] Improve log messages in Recording Oracle #3040

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def update_honeypots(self) -> _HoneypotUpdateResult:
f"Validation for escrow_address={self.task.escrow_address}: "
f"Too many validation frames excluded in the task {cvat_task_id} "
f"(required: {Config.validation.min_available_gt_threshold * 100:.4f}%, "
f"left: {(len(task_available_gt_keys) / len(task_gt_keys)):.4f}%), "
f"left: {(len(task_available_gt_keys) / len(task_gt_keys) * 100):.4f}%), "
"stopping annotation"
)
return _HoneypotUpdateResult(
Expand Down Expand Up @@ -812,7 +812,7 @@ def process_intermediate_results( # noqa: PLR0912

db_service.update_gt_stats(session, task.id, gt_stats)

job_final_result_ids: dict[int, str] = {}
job_final_result_ids: dict[str, str] = {}

for job_meta in meta.jobs:
job = db_service.get_job_by_cvat_id(session, job_meta.job_id)
Expand Down Expand Up @@ -904,6 +904,14 @@ def process_intermediate_results( # noqa: PLR0912
],
)

# Include final results for all jobs
job_results: _JobResults = {
job.cvat_id: task_validation_results[
validation_result_id_to_meta_id[job_final_result_ids[job.id]]
].annotation_quality
for job in task_jobs
}

return ValidationSuccess(
job_results=job_results,
validation_meta=validation_meta,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _handle_validation_result(self, validation_result: ValidationResult):
if isinstance(validation_result, ValidationSuccess):
logger.info(
f"Validation for escrow_address={escrow_address}: successful, "
f"average annotation quality is {validation_result.average_quality:.2f}"
f"average annotation quality is {validation_result.average_quality * 100:.2f}%"
)

recor_merged_annotations_path = self._compose_validation_results_bucket_filename(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def patched_get_jobs_quality_reports(task_id: int):
GtKey(filename="frame_5.jpg", labels=["label_0_node_1"]): (0, 0, 1),
}

def test_can_complete_if_not_enough_gt_left_in_task(
def test_can_complete_if_not_enough_gt_left_in_task_with_several_jobs(
self, session: Session, caplog: pytest.LogCaptureFixture
):
escrow_address = ESCROW_ADDRESS
Expand Down Expand Up @@ -1059,7 +1059,7 @@ def patched_get_jobs_quality_reports(task_id: int):
mock.Mock(
cvat_api.models.IQualityReport,
job_id=task_id,
summary=mock.Mock(accuracy=1),
summary=mock.Mock(accuracy=1 / 3 if task_id == cvat_task_id1 else 1),
),
]

Expand Down Expand Up @@ -1100,7 +1100,7 @@ def patched_get_jobs_quality_reports(task_id: int):

mock_update_task_validation_layout.assert_not_called()

def test_can_complete_if_not_enough_gt_left_in_task(
def test_can_complete_if_not_enough_gt_left_in_task_with_one_job(
self, session: Session, caplog: pytest.LogCaptureFixture
):
escrow_address = ESCROW_ADDRESS
Expand Down
Loading