예제 #1
0
    def test_run_vmaf_runner_with_notyuv(self):
        print 'test on running VMAF runner...'
        ref_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_30_480_1050.mp4")
        dis_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_10_288_375.mp4")
        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={
                          'yuv_type': 'notyuv',
                          'quality_width': 360,
                          'quality_height': 240,
                      })
        self.runner = VmafQualityRunner([asset],
                                        None,
                                        fifo_mode=True,
                                        delete_workdir=True,
                                        result_store=None)
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'],
                               77.635307276411766,
                               places=4)
예제 #2
0
    def test_run_vmaf_runner_with_notyuv_jpg(self):

        ref_path = VmafConfig.test_resource_path("test_images", "bikes.jpg")
        dis_path = VmafConfig.test_resource_path("test_images", "bikes_dis.jpg")
        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={'yuv_type': 'notyuv',
                                  'quality_width': 512, 'quality_height': 384,
                                  'workfile_yuv_type': 'yuv444p',
                                  })
        self.runner = VmafQualityRunner(
            [asset],
            None, fifo_mode=True,
            delete_workdir=True,
            result_store=None,
            optional_dict={
                'model_filepath': VmafConfig.model_path("vmaf_float_v0.6.1.json"),
            },
        )
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'], 63.255016130209064, places=4)
예제 #3
0
    def test_run_vmaf_runner_with_notyuv_jpg(self):
        print 'test on running VMAF runner on jpg...'
        ref_path = VmafConfig.test_resource_path("test_images", "bikes.jpg")
        dis_path = VmafConfig.test_resource_path("test_images",
                                                 "bikes_dis.jpg")
        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={
                          'yuv_type': 'notyuv',
                          'quality_width': 512,
                          'quality_height': 384,
                          'workfile_yuv_type': 'yuv444p',
                      })
        self.runner = VmafQualityRunner([asset],
                                        None,
                                        fifo_mode=True,
                                        delete_workdir=True,
                                        result_store=None)
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'],
                               63.27798081002585,
                               places=4)
예제 #4
0
    def test_run_vmaf_runner_with_yuv_lutyuv(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=0,
                      workdir_root=VmafConfig.workdir_path(),
                      ref_path=ref_path,
                      dis_path=dis_path,
                      asset_dict={
                          'width': 576,
                          'height': 324,
                          'quality_width': 360,
                          'quality_height': 240,
                          'lutyuv_cmd': 'y=2*val',
                      })
        self.runner = VmafQualityRunner([asset],
                                        None,
                                        fifo_mode=False,
                                        delete_workdir=True,
                                        result_store=None)
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'],
                               77.18873019841408,
                               places=4)
예제 #5
0
    def setUp(self):

        ref_path = VmafConfig.test_resource_path(
            "yuv", "checkerboard_1920_1080_10_3_0_0.yuv")
        dis_path = VmafConfig.test_resource_path(
            "yuv", "checkerboard_1920_1080_10_3_1_0.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': 1920,
                          'height': 1080
                      })

        self.runner = VmafQualityRunner(
            [asset],
            None,
            fifo_mode=True,
            delete_workdir=True,
            result_store=FileSystemResultStore(),
        )
        self.runner.run()

        self.result = self.runner.results[0]

        Nframes = len(self.result.result_dict['VMAF_scores'])
        self.result.result_dict['VMAF_array_scores'] = self.result.result_dict[
            'VMAF_scores'].reshape(Nframes, 1)
        self.result.result_dict['VMAF_two_models_array_scores'] = np.vstack(
            (self.result.result_dict['VMAF_scores'].reshape(1, Nframes),
             self.result.result_dict['VMAF_scores'].reshape(1, Nframes)))
        self.result.result_dict['VMAF_3D_array_scores'] = np.zeros((1, 1, 1))
예제 #6
0
    def test_run_vmaf_runner_with_notyuv_gblur(self):

        ref_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_30_480_1050.mp4")
        dis_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_10_288_375.mp4")
        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={
                          'yuv_type': 'notyuv',
                          'quality_width': 360,
                          'quality_height': 240,
                          'dis_gblur_cmd': 'sigma=0.01:steps=1',
                      })
        self.runner = VmafQualityRunner([asset],
                                        None,
                                        fifo_mode=True,
                                        delete_workdir=True,
                                        result_store=None)
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'],
                               77.28938600125885,
                               places=4)
예제 #7
0
    def test_run_vmaf_runner_with_notyuv(self):

        ref_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_30_480_1050.mp4")
        dis_path = VmafConfig.test_resource_path("mp4",
                                                 "Seeking_10_288_375.mp4")
        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={
                          'yuv_type': 'notyuv',
                          'quality_width': 360,
                          'quality_height': 240,
                      })
        self.runner = VmafQualityRunner(
            [asset],
            None,
            fifo_mode=True,
            delete_workdir=True,
            result_store=None,
            optional_dict={
                'model_filepath':
                VmafConfig.model_path("vmaf_float_v0.6.1.json"),
            },
        )
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'],
                               77.61273448644646,
                               places=4)
예제 #8
0
파일: graph.py 프로젝트: Kagami/av1-bench
def main():
    title = sys.argv[1]
    assets, dis_info = get_assets()
    runner = VmafQualityRunner(assets, logger=None)
    runner.run()
    fig = draw_graph(runner.results, dis_info, title)
    gpath = get_graph_path()
    fig.savefig(gpath)
    print 'Saved graph to ' + gpath
예제 #9
0
    def test_from_xml_from_json_and_aggregation(self):

        ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing(
        )

        asset_list = [asset, asset_original]

        self.runner = VmafQualityRunner(
            asset_list,
            None,
            fifo_mode=True,
            delete_workdir=True,
            result_store=None,
            optional_dict={
                'model_filepath':
                VmafConfig.model_path("vmaf_float_v0.6.1.pkl"),
            },
            optional_dict2=None,
        )
        self.runner.run()

        results = self.runner.results

        xml_string_expected = results[0].to_xml()
        xml_string_recon = Result.from_xml(xml_string_expected).to_xml()

        json_string_expected = results[0].to_json()
        json_string_recon = Result.from_json(json_string_expected).to_json()

        assert xml_string_expected == xml_string_recon, "XML files do not match"
        assert json_string_expected == json_string_recon, "JSON files do not match"

        combined_result = Result.combine_result([results[0], results[1]])

        # check that all keys are there
        combined_result_keys = [key for key in combined_result.result_dict]
        keys_0 = [key for key in results[0].result_dict]
        keys_1 = [key for key in results[1].result_dict]
        assert set(keys_0) == set(keys_1) == set(combined_result_keys)

        # check that the dictionaries have been copied as expected
        for key in combined_result_keys:
            assert len(combined_result.result_dict[key]) == len(
                results[0].result_dict[key]) + len(results[1].result_dict[key])
            assert combined_result.result_dict[key][0] == results[
                0].result_dict[key][0]
            assert combined_result.result_dict[key][
                len(results[0].result_dict[key]) -
                1] == results[0].result_dict[key][
                    len(results[0].result_dict[key]) - 1]
            assert combined_result.result_dict[key][len(
                results[0].result_dict[key])] == results[1].result_dict[key][0]
            assert combined_result.result_dict[key][
                len(combined_result.result_dict[key]) -
                1] == results[1].result_dict[key][
                    len(results[1].result_dict[key]) - 1]
예제 #10
0
    def test_train_test_on_dataset_with_dis1st_thr_with_feature_optional_dict_good(self):
        from vmaf.routine import train_test_vmaf_on_dataset
        train_dataset = import_python_file(
            VmafConfig.test_resource_path('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_with_optional_dict_good.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], 90.753010402770798, places=3)
        self.assertAlmostEqual(test_stats['ys_label_pred'][0], 90.753010402770798, places=3)

        runner = VmafQualityRunner(
            train_assets,
            None, fifo_mode=True,
            delete_workdir=True,
            result_store=None,
            optional_dict={'model_filepath': self.output_model_filepath}
        )
        runner.run(parallelize=True)
        results = runner.results

        self.assertAlmostEqual(results[0]['VMAF_score'], 89.55494473011981, places=4)
        self.assertAlmostEqual(results[1]['VMAF_score'], 61.01289549048653, places=4)
        self.assertAlmostEqual(results[2]['VMAF_score'], 90.75301241304798, places=4)
        self.assertAlmostEqual(results[3]['VMAF_score'], 89.27013895870179, places=4)
예제 #11
0
    def test_run_vmaf_runner_with_notyuv(self):
        print 'test on running VMAF runner...'
        ref_path = config.ROOT + "/python/test/resource/mp4/Seeking_30_480_1050.mp4"
        dis_path = config.ROOT + "/python/test/resource/mp4/Seeking_10_288_375.mp4"
        asset = Asset(dataset="test", content_id=0, asset_id=0,
                      workdir_root=config.ROOT + "/workspace/workdir",
                      ref_path=ref_path,
                      dis_path=dis_path,
                      asset_dict={'yuv_type': 'notyuv',
                                  'quality_width': 360, 'quality_height': 240,
                                  })
        self.runner = VmafQualityRunner(
            [asset],
            None, fifo_mode=True,
            delete_workdir=True,
            result_store=None
        )
        self.runner.run()

        results = self.runner.results
        self.assertAlmostEqual(results[0]['VMAF_score'], 79.052553444706504, places=4)
예제 #12
0
    def test_run_vmaf_runner_eq_cmd_gamma1d5(self):

        ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing(
        )

        asset.asset_dict['eq_cmd'] = 'gamma=1.5'
        asset_original.asset_dict['eq_cmd'] = 'gamma=1.5'

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

        results = self.runner.results

        self.assertAlmostEqual(
            results[0]['VMAF_integer_feature_vif_scale0_score'],
            0.34796083546749507,
            places=4)
        self.assertAlmostEqual(
            results[0]['VMAF_integer_feature_vif_scale1_score'],
            0.7430727630647906,
            places=4)
        self.assertAlmostEqual(
            results[0]['VMAF_integer_feature_vif_scale2_score'],
            0.8432128968501337,
            places=4)
        self.assertAlmostEqual(
            results[0]['VMAF_integer_feature_vif_scale3_score'],
            0.9003110626539442,
            places=4)
        self.assertAlmostEqual(
            results[0]['VMAF_integer_feature_motion2_score'],
            3.951617145833333,
            places=4)
        self.assertAlmostEqual(results[0]['VMAF_integer_feature_adm2_score'],
                               0.9239987660077826,
                               places=4)

        self.assertAlmostEqual(
            results[1]['VMAF_integer_feature_vif_scale0_score'],
            1.00000001415,
            places=4)
        self.assertAlmostEqual(
            results[1]['VMAF_integer_feature_vif_scale1_score'],
            0.99999972612,
            places=4)
        self.assertAlmostEqual(
            results[1]['VMAF_integer_feature_vif_scale2_score'],
            0.999999465724,
            places=4)
        self.assertAlmostEqual(
            results[1]['VMAF_integer_feature_vif_scale3_score'],
            0.999999399683,
            places=4)
        self.assertAlmostEqual(
            results[1]['VMAF_integer_feature_motion2_score'],
            3.951617145833333,
            places=4)
        self.assertAlmostEqual(results[1]['VMAF_integer_feature_adm2_score'],
                               1.0,
                               places=4)

        with self.assertRaises(KeyError):
            self.assertAlmostEqual(
                results[1]['VMAF_integer_feature_vif_score'], 1.0, places=4)

        with self.assertRaises(KeyError):
            self.assertAlmostEqual(
                results[1]['VMAF_integer_feature_ansnr_score'], 1.0, places=4)

        with self.assertRaises(KeyError):
            self.assertAlmostEqual(
                results[1]['VMAF_integer_feature_motion_score'], 1.0, places=4)

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