def setUp(self): self._paths = [ root_path('examples', 'i04_14_1.bmp'), root_path('examples', 'bl_image.jpg') ] # These feature are extracted from the original Matlab code of the # distorted image above ( # https://github.com/dsoellinger/blind_image_quality_toolbox/tree/master/%2Bbrisque) self._brisque_feats = [ np.array([ 2.187000, 0.305119, 0.731000, 0.046159, 0.078954, 0.124348, 0.735000, 0.032419, 0.086307, 0.118338, 0.733000, -0.020298, 0.112611, 0.092477, 0.730000, -0.022557, 0.114732, 0.092231, 2.103000, 0.360946, 0.731000, -0.055774, 0.183185, 0.116578, 0.734000, -0.046589, 0.179101, 0.123198, 0.730000, -0.037948, 0.168773, 0.123828, 0.725000, -0.033253, 0.165621, 0.126170 ]), np.array([ 0.4610000, 0.1652788, 0.3410000, -0.1192659, 0.2319912, 0.0417499, 0.3370000, -0.1010206, 0.2127568, 0.0502738, 0.3410000, -0.1070136, 0.1971343, 0.0380880, 0.3390000, -0.0978340, 0.1865236, 0.0413579, 0.4860000, 0.1888571, 0.3480000, -0.0518405, 0.1354198, 0.0621431, 0.3500000, -0.0487347, 0.1329318, 0.0642503, 0.3420000, -0.0046308, 0.0917469, 0.0853537, 0.3410000, -0.0035089, 0.0918414, 0.0869626 ]) ] self._scaled_feats = [ np.array([ -0.617264, -0.270555, -0.295875, 0.0406103, -0.778699, -0.474667, -0.297065, 0.0308621, -0.757414, -0.500593, -0.258806, -0.0243801, -0.671236, -0.656588, -0.275518, -0.00898751, -0.665791, -0.658926, 0.168636, 0.00856362, 0.23913, -0.72301, -0.171255, -0.433049, 0.24878, -0.502953, -0.193939, -0.392484, 0.308192, -0.264632, -0.365476, -0.333965, 0.304462, -0.19329, -0.375196, -0.322727 ]), np.array([ -0.974539, -0.624845, -0.85064, -0.971739, -0.348906, -0.826796, -0.866858, -0.850893, -0.401369, -0.790221, -0.859112, -0.757568, -0.424093, -0.860575, -0.875672, -0.62628, -0.456337, -0.848885, -0.989259, -0.489984, -0.68599, -0.695149, -0.387366, -0.700702, -0.687805, -0.518371, -0.401745, -0.686448, -0.70091, 0.0445592, -0.655117, -0.542798, -0.703412, 0.0757798, -0.653578, -0.535069 ]), ] # The expected score from Matlab self._expected_score = [52.521, 123.74] # Our score self._score = [50.2686, 122.8447]
def __init__(self): self._model = svmutil.svm_load_model(root_path('brisque', 'allmodel')) self._scaler = np.array([ [-1, 1], [0.338, 10], [0.017204, 0.806612], [0.236, 1.642], [-0.123884, 0.20293],[0.000155, 0.712298], [0.001122, 0.470257], [0.244, 1.641], [-0.123586, 0.179083], [0.000152, 0.710456], [0.000975, 0.470984], [0.249, 1.555], [-0.135687, 0.100858], [0.000174, 0.684173], [0.000913, 0.534174], [0.258, 1.561], [-0.143408, 0.100486], [0.000179, 0.685696], [0.000888, 0.536508], [0.471, 3.264], [0.012809, 0.703171], [0.218, 1.046], [-0.094876, 0.187459], [1.5e-005, 0.442057], [0.001272, 0.40803], [0.222, 1.042], [-0.115772, 0.162604], [1.6e-005, 0.444362], [0.001374, 0.40243], [0.227, 0.996], [-0.117188, 0.09832299999999999], [3e-005, 0.531903], [0.001122, 0.369589], [0.228, 0.99], [-0.12243, 0.098658], [2.8e-005, 0.530092], [0.001118, 0.370399]])