代码拉取完成,页面将自动刷新
import numpy as np
import torch
import torch.nn as nn
import MDN
from visual_module.visual_features import FeatureFusion, VGG
from IORROILstm import IORROILstm
from fixation_duration import FixationDuration
from utils import Sampler2D, ROIGenerator, OculomotorBias
first_fix_sampler = Sampler2D(np.load('./data/first_fix_dist.npy'))
ob = OculomotorBias('./data/ob.mat', 12)
roi_gen = ROIGenerator(400, 300, 30)
device = torch.cuda.current_device() if torch.cuda.is_available() else torch.device('cpu')
feature_extractor = VGG(model='vgg19', fine_tune=False).to(device)
fuser = FeatureFusion(3001).to(device)
iorroi_lstm = IORROILstm(512, 512).to(device)
mdn = nn.Sequential(
nn.Linear(450, 512),
nn.Tanh(),
MDN.MDN(512, 2, 10)
).to(device)
fix_duration = FixationDuration(512, 128).to(device)
feature_extractor.load_state_dict(torch.load('./data/weights/vgg19.pth'))
fuser.load_state_dict(torch.load('./data/weights/fuser.pth'))
iorroi_lstm.load_state_dict(torch.load('./data/weights/iorroi.pth'))
mdn.load_state_dict(torch.load('./data/weights/mdn.pth'))
fix_duration.load_state_dict(torch.load('./data/weights/fix_duration.pth'))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。