Upload QES.py
Browse files
other scripts for the dataset's construction/QES.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The input of QES should be a soft mask prediction instead of a binarized one.
|
| 2 |
+
|
| 3 |
+
import cv2
|
| 4 |
+
import argparse
|
| 5 |
+
import numpy as np
|
| 6 |
+
|
| 7 |
+
parser = argparse.ArgumentParser()
|
| 8 |
+
parser.add_argument("--mask", required=True, type=str, help="The path of the input mask.")
|
| 9 |
+
args = parser.parse_args()
|
| 10 |
+
|
| 11 |
+
t1 = (1 / 16)
|
| 12 |
+
t2 = (15 / 16)
|
| 13 |
+
|
| 14 |
+
mask = (cv2.imread(args.mask, 0).astype(np.float32)/255.0)
|
| 15 |
+
QES = ((mask>t2).sum()/((mask>t1).sum()+1e-8))
|
| 16 |
+
|
| 17 |
+
print('The Quality Evaluation Score is:', QES)
|
| 18 |
+
|
| 19 |
+
|