import cv2, pickle, sys, os from tqdm import trange sys.path.append("../src/") from predictor import joint_predictor from predictor import anchor_predictor from data_loader import dataloader_pred from mesh_edit import fast_deform_dja from mesh_edit import fast_deform_dsa from renderer import SMPLRenderer from utility import sil_iou from utility import show_img_arr from utility import center_crop from utility import get_anchor_posi from utility import get_joint_posi pdt_j = joint_predictor("../demo/pretrained_model/pretrained_joint.pth") pdt_a = anchor_predictor("../demo/pretrained_model/pretrained_anchor.pth") dataset = dataloader_pred(dataset_path="./eval_data/wild_set/", train=False, shuffle=False) my_renderer = SMPLRenderer(face_path="../predef/smpl_faces.npy") sta_num = 2699 # make verts for joint deform with open('../predef/mesh_joint_list.pkl', 'rb') as fp: item_dic = pickle.load(fp) point_list = item_dic["point_list"] index_map = item_dic["index_map"]
# parse configures conf = configparser.ConfigParser() conf.read(u'../conf.ini', encoding='utf8') dataset_path = conf.get('DEMO', 'dataset_path') joint_model = conf.get('DEMO', 'joint_model') anchor_model = conf.get('DEMO', 'anchor_model') shading_model = conf.get('DEMO', 'shading_model') # ==============================initialize============================== print("initialize......", end='') # initialize renderer my_renderer = rd.SMPLRenderer() # initialize joint and anchor predictor pdt_j = joint_predictor(joint_model, gpu=opt.gpu) pdt_a = anchor_predictor(anchor_model, gpu=opt.gpu) # dataset = dataloader_demo(dataset_path) # make verts for joint deform with open('../predef/mesh_joint_list.pkl', 'rb') as fp: item_dic = pickle.load(fp) point_list = item_dic["point_list"] index_map = item_dic["index_map"] # make verts for anchor deform with open('../predef/dsa_achr.pkl', 'rb') as fp: dic_achr = pickle.load(fp) achr_id = dic_achr['achr_id']
from predictor import joint_predictor from predictor import anchor_predictor from data_loader import dataloader_pred from mesh_edit import fast_deform_dja from mesh_edit import fast_deform_dsa from renderer import SMPLRenderer from utility import sil_iou from utility import show_img_arr from utility import center_crop from utility import get_anchor_posi from utility import get_joint_posi # pdt_j = joint_predictor("../demo/pretrained_model/pretrained_joint.pth") # pdt_a = anchor_predictor("../demo/pretrained_model/pretrained_anchor.pth") pdt_j = joint_predictor( "/home/zhangtianyi/github/hmd/model/snapshots_j_2019-11-18-11:03:06/pretrained_joint.pth" ) pdt_a = anchor_predictor( "/home/zhangtianyi/github/hmd/model/snapshots_a_2019-11-18-17:46:53/anchor_epoch_0_0.pth" ) dataset = dataloader_pred(dataset_path="./eval_data/wild_set/", train=False, shuffle=False) my_renderer = SMPLRenderer(face_path="../predef/smpl_faces.npy") sta_num = 2699 # make verts for joint deform with open('../predef/mesh_joint_list.pkl', 'rb') as fp: item_dic = pickle.load(fp)