Skip to content

Commit 3bad356

Browse files
committed
Update time cost calculation
1 parent eba01d8 commit 3bad356

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

examples/official/comparison_tool/sdk_comparison.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ def process_single_image(self, image_path: str, sdk_version: SDKVersion) -> Proc
14871487
LICENSE_KEY = "DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="
14881488
14891489
def process_image(image_path):
1490-
start_time = time.time()
1490+
14911491
14921492
# Initialize license
14931493
error_code, error_message = LicenseManager.init_license(LICENSE_KEY)
@@ -1496,8 +1496,12 @@ def process_image(image_path):
14961496
14971497
# Process image
14981498
cvr = CaptureVisionRouter()
1499+
cvr.capture(image_path, EnumPresetTemplate.PT_READ_BARCODES.value) # Trigger model loading the first time
1500+
1501+
start_time = time.time()
14991502
result = cvr.capture(image_path, EnumPresetTemplate.PT_READ_BARCODES.value)
1500-
1503+
processing_time = time.time() - start_time
1504+
15011505
if result.get_error_code() != EnumErrorCode.EC_OK:
15021506
return {{"success": False, "error": f"Capture error: {{result.get_error_code()}}"}}
15031507
@@ -1531,7 +1535,7 @@ def process_image(image_path):
15311535
15321536
return {{
15331537
"success": True,
1534-
"processing_time": time.time() - start_time,
1538+
"processing_time": processing_time,
15351539
"barcodes": barcodes
15361540
}}
15371541

0 commit comments

Comments
 (0)