coo1m / srmaster Goto Github PK
View Code? Open in Web Editor NEW基于Real-ESRGAN的图片AI超分辨率安卓APP
基于Real-ESRGAN的图片AI超分辨率安卓APP
观察到pytorch mobile 使用的是.pt
文件的模型格式。
请问,模型转换的地方是如何操作的呢?
我使用的代码如下:
import torch
import torch.utils.data.distributed
# pytorch环境中
model_pth = 'realesr-general-x4v3.pth' # 模型的参数文件
mobile_pt = 'realesr-general-x4v3.pt' # 将模型保存为Android可以调用的文件
model = torch.load(model_pth, map_location=torch.device('cpu'))
model.eval() # 模型设为评估模式
device = torch.device('cpu')
model.to(device)
# 1张3通道224*224的图片
input_tensor = torch.rand(1, 3, 224, 224) # 设定输入数据格式
mobile = torch.jit.trace(model, input_tensor) # 模型转化
mobile.save(mobile_pt) # 保存文件
但是始终报错:AttributeError: 'dict' object has no attribute 'eval'
大佬,有联系方式没?
real-esrgan转换成onnx之后,替换app里面的模型,提示Unknown input name input, expected one of [input.1],使用https://github.com/xinntao/Real-ESRGAN/blob/master/scripts/pytorch2onnx.py
把pth转成的onnx
改成功了,直接改的代码,修改的输入参数
作者你好,
能帮忙提供一下pytorch的pth模型转为onnx的代码么,感觉你不是用的这个:
https://github.com/xinntao/Real-ESRGAN/blob/master/scripts/pytorch2onnx.py
非常感谢!
Hello,
Thank you for your effort to create sample app to this super resolution model.
Could you provide a TFlite version for it model.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.