本文整理汇总了Python中vmaf.config.VmafConfig类的典型用法代码示例。如果您正苦于以下问题:Python VmafConfig类的具体用法?Python VmafConfig怎么用?Python VmafConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VmafConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_vmaf_fextractor_with_resampling
def test_run_vmaf_fextractor_with_resampling(self):
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324,
'quality_width':160, 'quality_height':90})
asset_original = Asset(dataset="test", content_id=0, asset_id=2,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324,
'quality_width':160, 'quality_height':90})
self.fextractor = VmafFeatureExtractor(
[asset, asset_original], None, fifo_mode=False)
self.fextractor.run(parallelize=False)
results = self.fextractor.results
self.assertAlmostEqual(results[0]['VMAF_feature_vif_score'], 0.782546520833, places=4)
self.assertAlmostEqual(results[0]['VMAF_feature_motion_score'],1.3216766875, places=4)
self.assertAlmostEqual(results[0]['VMAF_feature_adm_score'], 0.98229347916666665, places=4)
self.assertAlmostEqual(results[0]['VMAF_feature_ansnr_score'], 28.0085990417, places=4)
self.assertAlmostEqual(results[1]['VMAF_feature_vif_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['VMAF_feature_motion_score'], 1.3216766875, places=4)
self.assertAlmostEqual(results[1]['VMAF_feature_adm_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['VMAF_feature_ansnr_score'], 31.811350125, places=4)
示例2: test_run_strred_fextractor
def test_run_strred_fextractor(self):
print 'test on running STRRED feature extractor...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
self.fextractor = StrredFeatureExtractor(
[asset, asset_original],
None, fifo_mode=True,
result_store=None
)
self.fextractor.run(parallelize=True)
results = self.fextractor.results
self.assertAlmostEqual(results[0]['STRRED_feature_srred_score'], 3.0114681041666671, places=4)
self.assertAlmostEqual(results[0]['STRRED_feature_trred_score'], 7.3039486249999994, places=4)
self.assertAlmostEqual(results[0]['STRRED_feature_strred_score'], 21.995608318659482, places=4)
self.assertAlmostEqual(results[1]['STRRED_feature_srred_score'], 0.0, places=4)
self.assertAlmostEqual(results[1]['STRRED_feature_trred_score'], 0.0, places=4)
self.assertAlmostEqual(results[1]['STRRED_feature_strred_score'], 0.0, places=4)
示例3: test_train_test_on_raw_dataset_with_dis1st_thr
def test_train_test_on_raw_dataset_with_dis1st_thr(self):
train_dataset = import_python_file(
VmafConfig.test_resource_path('raw_dataset_sample.py'))
model_param = import_python_file(
VmafConfig.test_resource_path('model_param_sample.py'))
feature_param = import_python_file(
VmafConfig.test_resource_path('feature_param_sample.py'))
train_fassembler, train_assets, train_stats, test_fassembler, test_assets, test_stats, _ = train_test_vmaf_on_dataset(
train_dataset=train_dataset,
test_dataset=train_dataset,
feature_param=feature_param,
model_param=model_param,
train_ax=None,
test_ax=None,
result_store=None,
parallelize=True,
logger=None,
fifo_mode=True,
output_model_filepath=self.output_model_filepath
)
self.train_fassembler = train_fassembler
self.assertTrue(os.path.exists(self.output_model_filepath))
self.assertAlmostEqual(train_stats['ys_label_pred'][0], 93.565459224020742, places=3)
self.assertAlmostEqual(test_stats['ys_label_pred'][0], 93.565459224020742, places=3)
示例4: test_flat_value10
def test_flat_value10(self):
print 'test on flat pattern of value 10...'
LOCAL_LOG_FILENAME = self.LOG_FILENAME + '_flat_value10'
ref_yuv = VmafConfig.test_resource_path("yuv", "flat_1920_1080_0.yuv")
dis_yuv = VmafConfig.test_resource_path("yuv", "flat_1920_1080_10.yuv")
yuv_fmt = "yuv420p"
yuv_width = 1920
yuv_height = 1080
cmd = self.CMD_TEMPLATE.format(vmaf=required(ExternalProgram.vmaf), fmt=yuv_fmt, ref=ref_yuv,
dis=dis_yuv, w=yuv_width, h=yuv_height,
log=LOCAL_LOG_FILENAME)
run_process(cmd, shell=True)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm")[0], 1.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "ansnr")[0], 21.899511, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "motion")[0], 0.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif")[0], 1.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num")[0], 149.780313, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den")[0], 149.780392, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num")[0], 2753999.99219, places=1)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den")[0], 2754000.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "anpsnr")[0], 29.045954, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale0")[0],2073600.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale0")[0], 2073600.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale3")[0], 32400.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale3")[0], 32400.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale0")[0], 65.573967, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale0")[0], 65.573967, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale3")[0], 16.667711, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale3")[0], 16.667747, places=3)
示例5: test_run_psnr
def test_run_psnr(self):
exe = VmafConfig.root_path('run_psnr')
line = 'yuv420p 576 324 {root}/python/test/resource/yuv/src01_hrc00_576x324.yuv ' \
'{root}/python/test/resource/yuv/src01_hrc01_576x324.yuv'.format(root=VmafConfig.root_path())
cmd = "{exe} {line} >/dev/null 2>&1".format(line=line, exe=exe)
ret = run_process(cmd, shell=True)
self.assertEquals(ret, 0)
示例6: test_explain_vmaf_results
def test_explain_vmaf_results(self):
print 'test on running VMAF runner with local explainer...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
self.runner = VmafQualityRunnerWithLocalExplainer(
[asset, asset_original],
None, fifo_mode=True,
delete_workdir=True,
result_store=None,
optional_dict2={'explainer': LocalExplainer(neighbor_samples=100)}
)
np.random.seed(0)
self.runner.run()
results = self.runner.results
self.assertAlmostEqual(results[0]['VMAF_score'], 76.699271272486044, places=4)
self.assertAlmostEqual(results[1]['VMAF_score'], 99.946416604585025, places=4)
expected_feature_names = ['VMAF_feature_adm2_score',
'VMAF_feature_motion2_score',
'VMAF_feature_vif_scale0_score',
'VMAF_feature_vif_scale1_score',
'VMAF_feature_vif_scale2_score',
'VMAF_feature_vif_scale3_score']
weights = np.mean(results[0]['VMAF_scores_exps']['feature_weights'], axis=0)
self.assertAlmostEqual(weights[0], 0.66021689480916868, places=4)
self.assertAlmostEqual(weights[1], 0.14691682562211777, places=4)
self.assertAlmostEqual(weights[2], -0.023682744847036086, places=4)
self.assertAlmostEqual(weights[3], -0.029779341850172818, places=4)
self.assertAlmostEqual(weights[4], 0.19149485210137338, places=4)
self.assertAlmostEqual(weights[5], 0.31890978778344126, places=4)
self.assertEqual(results[0]['VMAF_scores_exps']['feature_names'],
expected_feature_names)
weights = np.mean(results[1]['VMAF_scores_exps']['feature_weights'], axis=0)
self.assertAlmostEqual(weights[0], 0.69597961598838509, places=4)
self.assertAlmostEqual(weights[1], 0.18256016705513464, places=4)
self.assertAlmostEqual(weights[2], 0.0090048099912423147, places=4)
self.assertAlmostEqual(weights[3], 0.028671810808880094, places=4)
self.assertAlmostEqual(weights[4], 0.21935602577417926, places=4)
self.assertAlmostEqual(weights[5], 0.34190431429767715, places=4)
self.assertEqual(results[1]['VMAF_scores_exps']['feature_names'],
expected_feature_names)
示例7: test_run_psnr_fextractor
def test_run_psnr_fextractor(self):
print 'test on running PSNR feature extractor...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
self.fextractor = PsnrFeatureExtractor(
[asset, asset_original],
None, fifo_mode=True,
result_store=None
)
self.fextractor.run()
results = self.fextractor.results
self.assertAlmostEqual(results[0]['PSNR_feature_psnr_score'], 30.755063979166664, places=4)
self.assertAlmostEqual(results[1]['PSNR_feature_psnr_score'], 60.0, places=4)
示例8: test_checkerboard_identical
def test_checkerboard_identical(self):
print 'test on checkerboard pattern identical...'
LOCAL_LOG_FILENAME = self.LOG_FILENAME + '_checkerboardIdentical'
ref_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_0_0.yuv")
dis_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_0_0.yuv")
yuv_fmt = "yuv420p"
yuv_width = 1920
yuv_height = 1080
cmd = self.CMD_TEMPLATE.format(vmaf=required(ExternalProgram.vmaf), fmt=yuv_fmt, ref=ref_yuv,
dis=dis_yuv, w=yuv_width, h=yuv_height,
log=LOCAL_LOG_FILENAME)
run_process(cmd, shell=True)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm")[0], 1.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "ansnr")[0], 21.1138813333, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "motion")[0], 12.554836666666667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif")[0], 1.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num")[0], 2773.891225, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den")[0], 2773.891225, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num")[0], 33021350.5, places=-3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den")[0], 33021387.0625, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "anpsnr")[0], 29.8567246667, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale0")[0], 25757432.0, places=-3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale0")[0], 25757473.3333, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale3")[0], 259774.958333, places=1)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale3")[0], 259774.9375, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale0")[0], 277.120382, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale0")[0], 277.120382, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale3")[0], 924.193766, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale3")[0], 924.193766, places=3)
示例9: test_run_asset_extractor
def test_run_asset_extractor(self):
print 'test on running asset extractor...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324,
'quality_width':160, 'quality_height':90})
asset_original = Asset(dataset="test", content_id=0, asset_id=2,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324,
'quality_width':160, 'quality_height':90})
self.fextractor = AssetExtractor(
[asset, asset_original], None, fifo_mode=True)
self.fextractor.run()
results = self.fextractor.results
self.assertEqual(str(results[0]['asset']), 'test_0_1_src01_hrc00_576x324_576x324_vs_src01_hrc01_576x324_576x324_q_160x90')
self.assertEqual(str(results[1]['asset']), 'test_0_2_src01_hrc00_576x324_576x324_vs_src01_hrc00_576x324_576x324_q_160x90')
self.fextractor.run(parallelize=True)
results = self.fextractor.results
self.assertEqual(str(results[0]['asset']), 'test_0_1_src01_hrc00_576x324_576x324_vs_src01_hrc01_576x324_576x324_q_160x90')
self.assertEqual(str(results[1]['asset']), 'test_0_2_src01_hrc00_576x324_576x324_vs_src01_hrc00_576x324_576x324_q_160x90')
示例10: test_run_dis_yuv_raw_video_extractor_parallel
def test_run_dis_yuv_raw_video_extractor_parallel(self):
print 'test on running dis YUV raw video extractor...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=2,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
h5py_file = DisYUVRawVideoExtractor.open_h5py_file(self.h5py_filepath)
self.fextractor = DisYUVRawVideoExtractor(
[asset, asset_original], None, fifo_mode=False,
optional_dict={'channels': 'yu'},
optional_dict2={'h5py_file': h5py_file}
)
with self.assertRaises(AssertionError):
self.fextractor.run(parallelize=True)
DisYUVRawVideoExtractor.close_h5py_file(h5py_file)
示例11: test_checkerboard_opposite
def test_checkerboard_opposite(self):
print 'test on checkerboard pattern opposite...'
LOCAL_LOG_FILENAME = self.LOG_FILENAME + '_checkerboard_opposite'
ref_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_0_0.yuv")
dis_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_10_0.yuv")
yuv_fmt = "yuv420p"
yuv_width = 1920
yuv_height = 1080
cmd = self.CMD_TEMPLATE.format(vmaf=required(ExternalProgram.vmaf), fmt=yuv_fmt, ref=ref_yuv,
dis=dis_yuv, w=yuv_width, h=yuv_height,
log=LOCAL_LOG_FILENAME)
run_process(cmd, shell=True)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm")[0], 0.053996333333333334, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "ansnr")[0], -5.758091333333334, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "motion")[0], 12.554836666666667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif")[0], 0.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num")[0], 149.780313, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den")[0], 2773.891225, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num")[0], 6.66666666667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den")[0], 33021387.0625, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "anpsnr")[0], 2.984752, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale0")[0], 6.66666666667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale0")[0], 25757473.3333, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale3")[0], 0.0, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale3")[0], 259774.9375, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale0")[0], 65.573967, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale0")[0], 277.120382, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale3")[0], 16.667711, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale3")[0], 924.193766, places=3)
示例12: test_checkerboard_shifted_by_1
def test_checkerboard_shifted_by_1(self):
print 'test on checkerboard pattern shifted by 1...'
LOCAL_LOG_FILENAME = self.LOG_FILENAME + '_checkerboard_shifted_by_1'
ref_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_0_0.yuv")
dis_yuv = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_1_0.yuv")
yuv_fmt = "yuv420p"
yuv_width = 1920
yuv_height = 1080
cmd = self.CMD_TEMPLATE.format(vmaf=required(ExternalProgram.vmaf), fmt=yuv_fmt, ref=ref_yuv,
dis=dis_yuv, w=yuv_width, h=yuv_height,
log=LOCAL_LOG_FILENAME)
run_process(cmd, shell=True)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm")[0], 0.7853383333333334, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "ansnr")[0], 7.92623066667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "motion")[0], 12.5548366667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif")[0], 0.156834666667, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num")[0], 2178.5352886666665, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den")[0], 2773.891225, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num")[0], 5178894.51562, places=-1)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den")[0], 33021387.0625, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "anpsnr")[0], 16.669074, places=4)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale0")[0], 2908829.0, places=-1)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale0")[0], 25757473.3333, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_num_scale3")[0], 128957.796875, places=-2)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "vif_den_scale3")[0], 259774.9375, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale0")[0], 201.15329999999997, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale0")[0], 277.120382, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_num_scale3")[0], 765.1562903333333, places=3)
self.assertAlmostEquals(read_log(LOCAL_LOG_FILENAME, "adm_den_scale3")[0], 924.193766, places=3)
示例13: test_run_parallel_moment_noref_fextractor
def test_run_parallel_moment_noref_fextractor(self):
print 'test on running Moment noref feature extractor on NorefAssets in parallel...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = NorefAsset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = NorefAsset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
fextractor = MomentNorefFeatureExtractor(
[asset, asset_original],
None,
fifo_mode=True,
delete_workdir=True,
result_store=None,
)
self.fextractors = [fextractor]
fextractor.run(parallelize=True)
results = fextractor.results
self.assertAlmostEqual(results[0]['Moment_noref_feature_1st_score'], 61.332006624999984)
self.assertAlmostEqual(results[0]['Moment_noref_feature_2nd_score'], 4798.659574041666)
self.assertAlmostEqual(results[0]['Moment_noref_feature_var_score'], 1036.8371843488285)
self.assertAlmostEqual(results[1]['Moment_noref_feature_1st_score'], 59.788567297525134)
self.assertAlmostEqual(results[1]['Moment_noref_feature_2nd_score'], 4696.668388042271)
self.assertAlmostEqual(results[1]['Moment_noref_feature_var_score'], 1121.519917231207)
示例14: test_run_parallel_ssim_fextractor
def test_run_parallel_ssim_fextractor(self):
print 'test on running SSIM feature extractor in parallel...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
self.fextractor = SsimFeatureExtractor(
[asset, asset_original, asset],
None, fifo_mode=True,
result_store=None
)
self.fextractor.run(parallelize=True)
results = self.fextractor.results
self.assertAlmostEqual(results[0]['SSIM_feature_ssim_score'], 0.86322654166666657, places=4)
self.assertAlmostEqual(results[0]['SSIM_feature_ssim_l_score'], 0.9981474583333334, places=4)
self.assertAlmostEqual(results[0]['SSIM_feature_ssim_c_score'], 0.96126793750000006, places=4)
self.assertAlmostEqual(results[0]['SSIM_feature_ssim_s_score'], 0.89773633333333336, places=4)
self.assertAlmostEqual(results[1]['SSIM_feature_ssim_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['SSIM_feature_ssim_l_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['SSIM_feature_ssim_c_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['SSIM_feature_ssim_s_score'], 1.0, places=4)
self.assertAlmostEqual(results[2]['SSIM_feature_ssim_score'], 0.86322654166666657, places=4)
示例15: test_run_ms_ssim_fextractor
def test_run_ms_ssim_fextractor(self):
print 'test on running MS-SSIM feature extractor...'
ref_path = VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv")
dis_path = VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv")
asset = Asset(dataset="test", content_id=0, asset_id=0,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=dis_path,
asset_dict={'width':576, 'height':324})
asset_original = Asset(dataset="test", content_id=0, asset_id=1,
workdir_root=VmafConfig.workdir_path(),
ref_path=ref_path,
dis_path=ref_path,
asset_dict={'width':576, 'height':324})
self.fextractor = MsSsimFeatureExtractor(
[asset, asset_original],
None, fifo_mode=True,
result_store=None
)
self.fextractor.run()
results = self.fextractor.results
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_score'], 0.9632498125, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_l_scale0_score'], 0.9981474583333334, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_c_scale0_score'], 0.96126793750000006, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_s_scale0_score'], 0.89773633333333336, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_l_scale1_score'], 0.99899612500000001, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_c_scale1_score'], 0.9857694375, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_s_scale1_score'], 0.941185875, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_l_scale2_score'], 0.99923564583333324, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_c_scale2_score'], 0.997034020833, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_s_scale2_score'], 0.977992145833, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_l_scale3_score'], 0.99929210416666658, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_c_scale3_score'], 0.999588104167, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_s_scale3_score'], 0.99387125, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_l_scale4_score'], 0.99940356249999995, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_c_scale4_score'], 0.999907625, places=4)
self.assertAlmostEqual(results[0]['MS_SSIM_feature_ms_ssim_s_scale4_score'], 0.998222583333, places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_score'], 1.0, places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_l_scale0_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_c_scale0_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_s_scale0_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_l_scale1_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_c_scale1_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_s_scale1_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_l_scale2_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_c_scale2_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_s_scale2_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_l_scale3_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_c_scale3_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_s_scale3_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_l_scale4_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_c_scale4_score'], 1., places=4)
self.assertAlmostEqual(results[1]['MS_SSIM_feature_ms_ssim_s_scale4_score'], 1., places=4)