def test_export_model_overwrite(file_stimuli, tmpdir): model1 = pysaliency.GaussianSaliencyMapModel(width=0.1) model2 = pysaliency.GaussianSaliencyMapModel(width=0.8) filename = str(tmpdir.join('model.hdf5')) partial_stimuli = pysaliency.FileStimuli( filenames=file_stimuli.filenames[:5]) export_model_to_hdf5(model1, partial_stimuli, filename) export_model_to_hdf5(model2, file_stimuli, filename) model3 = pysaliency.HDF5SaliencyMapModel(file_stimuli, filename) for s in file_stimuli: np.testing.assert_allclose(model2.saliency_map(s), model3.saliency_map(s))
def probabilistic_model(saliency_model): blurred_model = pysaliency.BluringSaliencyMapModel(saliency_model, kernel_size=5.0) centerbias_model = pysaliency.saliency_map_models.LambdaSaliencyMapModel( [pysaliency.GaussianSaliencyMapModel(width=0.5)], fn=lambda smaps: 1.0 * smaps[0], ) model_with_centerbias = blurred_model * centerbias_model probabilistic_model = SaliencyMapNormalizingModel(model_with_centerbias) return probabilistic_model
def saliency_model(): return pysaliency.GaussianSaliencyMapModel(center_x=0.15, center_y=0.85, width=0.2)