Skip to content
Snippets Groups Projects
Commit 11cf5a0c authored by Maria Kleppestø Mcculloch's avatar Maria Kleppestø Mcculloch
Browse files

Some changes

parent 804f5220
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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])
'''
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment