pytorch android

网友投稿 757 2022-05-30

官方文档:

https://pytorch.org/mobile/Android/

转换模型:

import torch

import torchvision

from torch.utils.mobile_optimizer import optimize_for_mobile

model = torchvision.models.mobilenet_v2(pretrained=True)

model.eval()

example = torch.rand(1, 3, 224, 224)

traced_script_module = torch.jit.trace(model, example)

traced_script_module_optimized = optimize_for_mobile(traced_script_module)

pytorch android

traced_script_module_optimized._save_for_lite_interpreter("app/src/main/assets/model.ptl")

有demo,有yolov5:

https://github.com/pytorch/android-demo-app

D2go

D2Go demonstrates a Python script that creates the much lighter and much faster Facebook

Android pytorch

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Py之Xlrd:Python库之Xlrd简介、安装、使用方法之详细攻略
下一篇:DLI向DWS推送数据报错:Zero bytes may not occur in string parameters
相关文章