1 Star 0 Fork 1

geoff/PFLD_68points_Pytorch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pytorch2ncnn.py 786 Bytes
一键复制 编辑 原始数据 按行查看 历史
luffy 提交于 5年前 . First Update
# -*- coding: utf-8 -*-
import torch
from model2 import MobileNetV2, BlazeLandMark
coefficient = 0.25
print(coefficient)
num_of_channels = [int(64 * coefficient), int(128 * coefficient), int(16 * coefficient), int(32 * coefficient),
int(128 * coefficient)]
# model = MobileNetV2(num_of_channels=num_of_channels, nums_class=136)
model = BlazeLandMark(nums_class=136)
path = './model_37.pth'
dst = './pfld_37.onnx'
model = torch.load(path)
x = torch.rand(1, 3, 56, 56).cuda()
torch_out = torch.onnx._export(model, x, dst, export_params=True)
import onnx
print("==> Loading and checking exported model from '{}'".format(dst))
onnx_model = onnx.load(dst)
onnx.checker.check_model(onnx_model) # assuming throw on error
print("==> Passed")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/geoffzhang/PFLD_68points_Pytorch.git
git@gitee.com:geoffzhang/PFLD_68points_Pytorch.git
geoffzhang
PFLD_68points_Pytorch
PFLD_68points_Pytorch
master

搜索帮助