for direct in tqdm(directories_inp):
        fname_inp = path_inp + direct + '/' + name
        fname_out = path + direct + '_face/' + name

        smap = mpimg.imread(fname_inp)

        if np.size(smap.shape) == 3:
            smap = rgb2gray(smap)
        if np.shape(smap) is not (369, 492):
            smap = cv2.resize(smap, (492, 369), interpolation=cv2.INTER_AREA)
        # normalize saliecies
        smap = normalize_saliency_map(smap)
        smap_face = normalize_saliency_map(smap_face)

        smap_final_03 = normalize_saliency_map(smap * 0.7 + smap_face * 0.3)
        smap_final_05 = normalize_saliency_map(smap * 0.5 + smap_face * 0.5)
        smap_final_07 = normalize_saliency_map(smap * 0.3 + smap_face * 0.7)
        smap_final = normalize_saliency_map(smap)

        save_plot_without_frames(smap_final,
                                 path + 'no_face/' + direct + '/' + name)
        save_plot_without_frames(smap_final_03,
                                 path + 'face_03/' + direct + '/' + name)
        save_plot_without_frames(smap_final_05,
                                 path + 'face_05/' + direct + '/' + name)
        save_plot_without_frames(smap_final_07,
                                 path + 'face_07/' + direct + '/' + name)

    shutil.move(fname, './data/redo/done/')
Example #2
0
    img = mpimg.imread(fname)

    pbar = tqdm(total=40)

    # run basic models
    smap_face, _ = IK.run(img, keys=[], faces=True)
    pbar.update(10)

    # run pysaliency models
    smap_aim = aim.saliency_map(img)
    pbar.update(10)

    # normalize saliecies
    smap_face = normalize_saliency_map(smap_face)
    smap_aim = normalize_saliency_map(smap_aim)
    pbar.update(10)

    # add face to other (non-deep learnig) saliencies
    smap_aim_face = normalize_saliency_map(smap_aim + smap_face)

    # save plots
    print('Saving plots')
    save_plot_without_frames(smap_face, path + 'faces/' + name + '.jpg')
    save_plot_without_frames(smap_aim, path + 'aim/' + name + '.jpg')
    save_plot_without_frames(smap_aim_face, path + 'aim_face/' + name + '.jpg')
    pbar.update(10)

    shutil.move(fname, 'data/done')

    pbar.close()
Example #3
0
IK = IttiKoch(verbose=False)

location = 'test_models'
location_cache = 'model_caches'

for fname in tqdm(fnames):
    print(fname)
    name = fname[10:-4]  # get just the name of the picture
    img = mpimg.imread(fname)

    pbar = tqdm(total=40)

    # run basic models
    smap_ik, _ = IK.run(img)
    pbar.update(10)
    smap_face, _ = IK.run(img, keys=[], faces=True)
    pbar.update(10)

    # run deep gaze models
    # smap_dg, log_density_prediction = run_deep_gaze(img)
    # pbar.update(10)
    # smap_icf, log_density_prediction_icf = run_deep_gaze(img, model='ICF')
    # pbar.update(10)

    save_plot_without_frames(smap_ik, path + 'IK/' + name + '.jpg')
    save_plot_without_frames(smap_face, path + 'faces/' + name + '.jpg')
    # save_plot_without_frames(smap_dg, path + 'dg/' + name + '.jpg')
    # save_plot_without_frames(smap_icf, path + 'icf/' + name + '.jpg')

    pbar.close()
Example #4
0
    smap_gbvs = normalize_saliency_map(smap_gbvs)
    smap_dg = normalize_saliency_map(smap_dg)
    smap_icf = normalize_saliency_map(smap_icf)

    # add face to other (non-deep learnig) saliencies
    smap_ik_face = normalize_saliency_map(smap_ik + smap_face)
    smap_aim_face = normalize_saliency_map(smap_aim + smap_face)
    smap_sun_face = normalize_saliency_map(smap_sun + smap_face)
    smap_cas_face = normalize_saliency_map(smap_cas + smap_face)
    smap_covsal_face = normalize_saliency_map(smap_covsal + smap_face)
    smap_gbvs_face = normalize_saliency_map(smap_gbvs + smap_face)
    smap_icf_face = normalize_saliency_map(smap_icf + smap_face)

    # save plots
    print('Saving plots')
    save_plot_without_frames(smap_ik, path + 'IK/' + name + '.jpg')
    save_plot_without_frames(smap_face, path + 'faces/' + name + '.jpg')
    save_plot_without_frames(smap_aim, path + 'aim/' + name + '.jpg')
    save_plot_without_frames(smap_sun, path + 'sun/' + name + '.jpg')
    save_plot_without_frames(smap_cas, path + 'cas/' + name + '.jpg')
    save_plot_without_frames(smap_covsal, path + 'covsal/' + name + '.jpg')
    save_plot_without_frames(smap_gbvs, path + 'gbvs/' + name + '.jpg')
    save_plot_without_frames(smap_dg, path + 'dg/' + name + '.jpg')
    save_plot_without_frames(smap_icf, path + 'icf/' + name + '.jpg')

    save_plot_without_frames(smap_ik_face, path + 'ik_face/' + name + '.jpg')
    save_plot_without_frames(smap_aim_face, path + 'aim_face/' + name + '.jpg')
    save_plot_without_frames(smap_sun_face, path + 'sun_face/' + name + '.jpg')
    save_plot_without_frames(smap_cas_face, path + 'cas_face/' + name + '.jpg')
    save_plot_without_frames(smap_covsal_face,
                             path + 'covsal_face/' + name + '.jpg')
Example #5
0
print(fnames)
# take care of directories
directories = ['dg', 'icf']

if not os.path.exists(path):
    os.makedirs(path)

for direct in directories:
    if not os.path.exists(path + direct):
        print('creating directory ' + direct)
        os.makedirs(path + direct)

for fname in tqdm(fnames):
    print(fname)
    name = fname[12:-4]  # get just the name of the picture
    img = mpimg.imread(fname)

    pbar = tqdm(total=20)

    # run deep gaze models
    smap_dg, log_density_prediction = run_deep_gaze(img)
    pbar.update(10)
    smap_icf, log_density_prediction_icf = run_deep_gaze(img, model='ICF')
    pbar.update(10)

    save_plot_without_frames(smap_dg, path + 'dg/' + name + '.jpg')
    save_plot_without_frames(smap_icf, path + 'icf/' + name + '.jpg')
    shutil.move(fname, './data/dldl/done')

    pbar.close()
Example #6
0
    os.makedirs(path)

if not os.path.exists('./data/test/done'):
    os.makedirs('./data/test/done')

for direct in directories:
    if not os.path.exists(path + direct):
        print('creating directory ' + direct)
        os.makedirs(path + direct)

# initiate our model
IK = IttiKoch(verbose=False)

for fname in tqdm(fnames):
    name = fname[12:-4]  # get just the name of the picture
    print(name)
    img = mpimg.imread(fname)

    # run basic models
    smap_ik, _ = IK.run(img, faces=False)

    # normalize saliecies
    smap_ik = normalize_saliency_map(smap_ik)

    # save plots
    print('Saving plots')
    print(path + 'ik/' + name + '.jpg')
    save_plot_without_frames(smap_ik, path + 'ik/' + name + '.jpg')

    shutil.move(fname, 'data/test/done')