コード例 #1
0
ファイル: hand.py プロジェクト: eaoge/openpose_practice
 def __init__(self, model_path):
     self.model = handpose_model()
     if torch.cuda.is_available():
         self.model = self.model.cuda()
     model_dict = util.transfer(self.model, torch.load(model_path))
     self.model.load_state_dict(model_dict)
     self.model.eval()
コード例 #2
0
from model import handpose_model
import torch
from tqdm import tqdm
import json

model = handpose_model()

size = {}
for i in tqdm(range(10, 1000)):
    data = torch.randn(1, 3, i, i)
    if torch.cuda.is_available():
        data = data.cuda()
    size[i] = model(data).size(2)

with open('hand_model_output_size.json') as f:
    json.dump(size, f)