Initial clean commit

This commit is contained in:
Andre Neto
2025-04-12 03:19:13 +01:00
commit 62ff4d6c25
96 changed files with 104109 additions and 0 deletions
@@ -0,0 +1,11 @@
'''
Filename: __init__.py
Path: /home/netoa/Desktop/ISR/metrics/db
Created Date: Wednesday December 18th 2024
Author: Andre Neto
-----
Last Modified: Wed Dec 18 2024
Modified By: Andre Neto
-----
Copyright (c) 2024 Institute of Systems and Robotics
'''
@@ -0,0 +1,39 @@
"""
"""
from time import time as now
import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def compute_all(ref_path, dist_path):
"""
Computes the distribution between a reference and distorted image folders.
"""
output = {}
metrics = []
for name, func in metrics:
start_time = now()
output[name] = (func(), now() - start_time)
return output
if __name__ == "__main__":
# Paths to reference and distorted images
REF_IMG_PATH = "test_reference/001.jpg"
DIST_IMG_PATH = "test_distorted/001_CodeFace_1.4.jpg"
# Compute all metrics
results = compute_all(REF_IMG_PATH, DIST_IMG_PATH)
# Print results for each metric and the time taken to compute it
for metric, (value, duration) in results.items():
print(f"{metric}: {value:.8g} (computed in {duration:.6f} seconds)")