我没有做骨骼检测研究,但你的问题似乎很普遍。
(1) 我认为其他人不应该从一开始就教你如何加载数据和运行他们的代码。
(2) 运行其他人的代码,只需修改他们提供的测试脚本,例如
https://github.com/leoxiaobin/deep-high-resolution-net.pytorch/blob/master/tools/test.py
他们已经帮助您加载模型
model = eval('models.'+cfg.MODEL.NAME+'.get_pose_net')(
cfg, is_train=False
)
if cfg.TEST.MODEL_FILE:
logger.info('=> loading model from {}'.format(cfg.TEST.MODEL_FILE))
model.load_state_dict(torch.load(cfg.TEST.MODEL_FILE), strict=False)
else:
model_state_file = os.path.join(
final_output_dir, 'final_state.pth'
)
logger.info('=> loading model from {}'.format(model_state_file))
model.load_state_dict(torch.load(model_state_file))
model = torch.nn.DataParallel(model, device_ids=cfg.GPUS).cuda()
打电话就行了
# evaluate on Variable x with testing data
y = model(x)
# access Variable's tensor, copy back to CPU, convert to numpy
arr = y.data.cpu().numpy()
# write CSV
np.savetxt('output.csv', arr)
你应该可以用excel打开它
(3) “将它们转换为我需要的 .json 注释”。
这是没人能解决的问题。我们不知道您想要什么格式。对于他们的格式,可以通过他们的论文获得。或者通过
查看他们的训练数据
X, y = torch.load('some_training_set_with_labels.pt')
通过关联 x 和 y。那你应该有一个不错的主意。