Skip to content

Commit

Permalink
[DO NOT MERGE] Only run QualityRunnerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nilfm99 committed Nov 2, 2023
1 parent 2603932 commit 598d0f3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 97 deletions.
96 changes: 0 additions & 96 deletions python/test/quality_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,101 +1925,5 @@ def test_run_vmaf_runner_with_param_neg_and_model_mfz(self):
self.assertAlmostEqual(results[1]['VMAF_score'], 97.42843609144575, places=4)


class QualityRunnerVersionTest(unittest.TestCase):

def test_vmaf_quality_runner_version(self):
self.assertEqual(VmafQualityRunner.VERSION, 'F0.2.7int-0.6.1')
self.assertEqual(VmafQualityRunner.ALGO_VERSION, 4)


class QualityRunnerResultStoreTest(unittest.TestCase):

def setUp(self):
super().setUp()
self.result_store = FileSystemResultStore()

def tearDown(self):
self.runner1.remove_results()
self.runner2.remove_results()
super().tearDown()

def test_quality_runner_with_different_models(self):
ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing()

self.runner1 = VmafQualityRunner(
[asset, asset_original],
None, fifo_mode=True,
delete_workdir=True,
result_store=self.result_store,
optional_dict={'model_filepath': VmafConfig.test_resource_path('model', 'vmaf_float_v0.6.1_rdh540.json')}
)
self.runner1.run(parallelize=True)
results1 = self.runner1.results

self.runner2 = VmafQualityRunner(
[asset, asset_original],
None, fifo_mode=True,
delete_workdir=True,
result_store=self.result_store,
optional_dict={'model_filepath': VmafConfig.test_resource_path('model', 'vmaf_float_v0.6.1_nvd6.json')}
)
self.runner2.run(parallelize=True)
results2 = self.runner2.results

self.assertAlmostEqual(results1[0]['VMAF_score'], 73.28968543912883, places=4)
self.assertAlmostEqual(results1[1]['VMAF_score'], 99.946416604585025, places=4)

self.assertAlmostEqual(results2[0]['VMAF_score'], 80.61670115719328, places=4)
self.assertAlmostEqual(results2[1]['VMAF_score'], 99.946416604585025, places=4)


class QualityRunnerSaveWorkfilesTest(MyTestCase):

def setUp(self):
super().setUp()
self.result_store = FileSystemResultStore()

def tearDown(self):
if hasattr(self, 'runner'):
self.runner.remove_results()
super().tearDown()

def test_run_vmaf_runner_flat_save_workfiles(self):

ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing()

self.runner = VmafQualityRunner(
[asset, asset_original],
None, fifo_mode=False,
delete_workdir=True,
result_store=self.result_store,
save_workfiles=True,
)
self.runner.run(parallelize=False)

results = self.runner.results

self.assertAlmostEqual(results[0]['VMAF_score'], 76.66890511746402, places=4)
self.assertAlmostEqual(results[1]['VMAF_score'], 99.94642662500576, places=4)

def test_run_psnr_runner_flat_save_workfiles(self):

ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing()

self.runner = PsnrQualityRunner(
[asset, asset_original],
None, fifo_mode=False,
delete_workdir=True,
result_store=self.result_store,
save_workfiles=True,
)
self.runner.run(parallelize=False)

results = self.runner.results

self.assertAlmostEqual(results[0]['PSNR_score'], 30.755063979166668, places=4)
self.assertAlmostEqual(results[1]['PSNR_score'], 60.0, places=4)


if __name__ == '__main__':
unittest.main(verbosity=2)
2 changes: 1 addition & 1 deletion python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ commands = python --version
# Configuration
[pytest]
cache_dir = .tox/.cache
python_files = *test.py
python_files = quality_runner_test.py
markers =
main: Main tests

Expand Down

0 comments on commit 598d0f3

Please sign in to comment.