From 11cf5a0c7b5e37e4580d0105cc7ce2dfef01d292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Kleppest=C3=B8=20McCulloch?= <mariakmc@stud.ntnu.no> Date: Fri, 3 Jun 2022 18:45:51 +0200 Subject: [PATCH] Some changes --- README.md | 4 ++-- main.py | 40 +++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index db9c4ce..4911dee 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ One can use the code present in main.py to compute the baseline. In order to com ### 2. Compute quality metrics -This can be run as long as there are some baselines (.npy file) in data/ . One does not need to have run ``computeBaselines()`` in the same run. In order to compute metrics, one needs to init a ``QualityEvaluator`` object, and run ``Detection_Arcface_init`` in order to init ArcFace. Then, one needs to call ``ComputeMetric("name", subjectnr, samplenr)``. If the metric is suported, it will be computed. Then, one needs to call the ``SaveMetric()`` if one wants the metric to be read to file. This cane be done using main by doing the following: +This can be run as long as there are some baselines (.npy file) in data/ . One does not need to have run ``computeBaselines()`` in the same run. In order to compute metrics, one needs to init a ``QualityEvaluator`` object, and run ``Detection_Arcface_init()`` in order to init ArcFace. Then, one needs to call ``ComputeMetric("name", subjectnr, samplenr)``. If the metric is suported, it will be computed. Then, one needs to call the ``SaveMetric()`` if one wants the metric to be read to file. This cane be done using main by doing the following: #### i. Uncomment the following lines in main.py: @@ -79,7 +79,7 @@ This can be run as long as there are some baselines (.npy file) in data/ . One d ### 3. Plot quality metrics -This can be run as long as there are some baselines (.npy file in data/), and some quality scores for the specified metric (.npy file in data/ or .csv file in data/brisque/ ). In order to plot metrics, one needs to init a ``QualityEvaluator`` object. Then, one needs to call ``PlotMetric("Method", "Metric", subnr=[subnr], samnr=[sampnr])``. If the metric is suported, it will be plotted. In order to do this in main, do the following: +This can be run as long as there are some baselines (.npy file in data/), and some quality scores for the specified metric (.npy file in data/ or .csv file in data/brisque/ ). In order to plot metrics, one needs to init a ``QualityEvaluator`` object and run ``Detection_Arcface_init()`` . Then, one needs to call ``PlotMetric("Method", "Metric", subnr=[subnr], samnr=[sampnr])``. If the metric is suported, it will be plotted. In order to do this in main, do the following: #### i. Uncomment the following lines in main.py: diff --git a/main.py b/main.py index 0418680..7d019e1 100644 --- a/main.py +++ b/main.py @@ -27,12 +27,11 @@ imgsdir = 'img/CasiaV2/CasiaSelection/' ## STEP 1: COMPUTE BASELINES ## ############################### - # Init Evaulator print("--* Initing Evaulator") - # "subjectnr/samplenr" = 000001/001.jpg -#QualEval = QualityEvaluator("ArcFaceCasiaV2", projectpath, imgsdir, "subjectnr/samplenr") +QualEval = QualityEvaluator("ArcFaceCasiaV2", projectpath, imgsdir, "subjectnr/samplenr") + print("-- * Initing Arcface") #QualEval.ArcFace_init() @@ -55,42 +54,41 @@ print("--* Saving Baselines") ## STEP 2: COMPUTE METRICS ## ###################################### -## NB! REMEMBER TO UNCOMMOENT the QualEval initiation ON LINE 35 +## NB! REMEMBER TO UNCOMMENT the QualEval initiation ON LINE 35 -''' # Compute metrics print("--* Detecting Init") -QualEval.Detection_Arcface_init() +#QualEval.Detection_Arcface_init() print("--* Computing metrics") -QualEval.ComputeMetric("sharpness", params[0], params[1]) -QualEval.ComputeMetric("focus", params[0], params[1]) +#QualEval.ComputeMetric("sharpness", params[0], params[1]) +#QualEval.ComputeMetric("focus", params[0], params[1]) print("--* Save metric") -QualEval.SaveMetric("sharpness") -QualEval.SaveMetric("focus") +#QualEval.SaveMetric("sharpness") +#QualEval.SaveMetric("focus") + + -''' ########################## ## STEP 3: PLOT METRICS ## ########################## -## NB! REMEMBER TO UNCOMMOENT the QualEval initiation ON LINE 35 AND QualEval.Detection_Arcface_init() ON LINE 63 +## NB! REMEMBER TO UNCOMMOENT the QualEval initiation ON LINE 35 and QualEval.Detection_Arcface_init() ON LINE 63 -''' print("--* Plotting Metrics") -QualEval.PlotMetric("EDC", "focus",subnr=params[0], sampnr=params[1]) -QualEval.PlotMetric("EDC", "sharpness",subnr=params[0], sampnr=params[1]) -QualEval.PlotMetric("EDC", "brisque",subnr=params[0], sampnr=params[1], metric_name="data/brisque/quality_values_aug") +#QualEval.PlotMetric("EDC", "focus",subnr=params[0], sampnr=params[1]) +#QualEval.PlotMetric("EDC", "sharpness",subnr=params[0], sampnr=params[1]) +#QualEval.PlotMetric("EDC", "brisque",subnr=params[0], sampnr=params[1], metric_name="data/brisque/quality_values_aug") print("DET; Focus") -QualEval.PlotMetric("DET", "focus",subnr=params[0], sampnr=params[1]) +#QualEval.PlotMetric("DET", "focus",subnr=params[0], sampnr=params[1]) print("DET; Sharpness") -QualEval.PlotMetric("DET", "sharpness",subnr=params[0], sampnr=params[1]) +#QualEval.PlotMetric("DET", "sharpness",subnr=params[0], sampnr=params[1]) print("DET; Brisque") -QualEval.PlotMetric("DET", "brisque",subnr=params[0], sampnr=params[1], metric_name="data/brisque/quality_values_aug") +#QualEval.PlotMetric("DET", "brisque",subnr=params[0], sampnr=params[1], metric_name="data/brisque/quality_values_aug") + +#QualEval.PlotDETCurve(params[0],params[1]) -QualEval.PlotDETCurve(params[0],params[1]) -''' -- GitLab