From eb42c1e331c4cdd03adf1db9269297cac0a4a316 Mon Sep 17 00:00:00 2001 From: Abhinau Kumar Date: Mon, 30 Oct 2023 21:05:59 -0500 Subject: [PATCH] Back to main code from test version --- examples/feature_extractors/ssim_fex.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/feature_extractors/ssim_fex.py b/examples/feature_extractors/ssim_fex.py index 690287a..70fe4b9 100644 --- a/examples/feature_extractors/ssim_fex.py +++ b/examples/feature_extractors/ssim_fex.py @@ -26,15 +26,14 @@ def _run_on_asset(self, asset_dict: Dict[str, Any]) -> Result: standard=asset_dict['dis_standard'], width=asset_dict['width'], height=asset_dict['height'] ) as v_dis: - # for i, (frame_ref, frame_dis) in enumerate(zip(v_ref, v_dis)): - # if i % sample_interval: - # continue - # lum_val, cs_val, ssim_val = ssim(frame_ref, frame_dis, full=True) - # feats_dict['lum'].append(lum_val) - # feats_dict['cs'].append(cs_val) - # feats_dict['ssim'].append(ssim_val) - feats = np.random.randn(v_ref.num_frames, 3) + for i, (frame_ref, frame_dis) in enumerate(zip(v_ref, v_dis)): + if i % sample_interval: + continue + lum_val, cs_val, ssim_val = ssim(frame_ref, frame_dis, full=True) + feats_dict['lum'].append(lum_val) + feats_dict['cs'].append(cs_val) + feats_dict['ssim'].append(ssim_val) - # feats = np.array(list(feats_dict.values())).T + feats = np.array(list(feats_dict.values())).T print(f'Processed {asset_dict["dis_path"]}') return self._to_result(asset_dict, feats, list(feats_dict.keys()))