daybreak-u / centernet_mobilenetv2_ncnn Goto Github PK
View Code? Open in Web Editor NEWcenternet_mobilenetv2 inference by ncnn
centernet_mobilenetv2 inference by ncnn
大神,论文里用maxpool2求极值计算目标中心点的,本项目的genIds函数里判断超过阈值的score输出“候选”目标,然后再NMS,有研究过这两者之间的差异吗?
def _nms(heat, kernel=3):
pad = (kernel - 1) // 2
hmax = nn.functional.max_pool2d( heat, (kernel, kernel), stride=1, padding=pad)
keep = (hmax == heat).float()
return heat * keep
大神,您好,非常感谢分享工程,这个工程对学习centernet部署非常有帮助。在pytorch 1.2.0环境霞用mobilenetv2_10骨干网训练模型运行成功后,尝试把模型转换成onnx格式,遇到错误。pytorch新手,期望得到您的指点!
`
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import torch.onnx as torch_onnx
import _init_paths
from detectors.detector_factory import detector_factory
from models.model import create_model, load_model
from opts import opts
heads = {'hm': 2, 'wh': 2, 'hps': 8, 'hm_hp': 4}
model = create_model('mobilenetv2_10', heads, 64)
model = load_model(model, '../model_best.pth')
torch.save(model, 'mobilnetv2_10.pth')
print(model)
input_shape = (3, 512, 384)
dump_input = Variable(torch.randn(1, *input_shape))
output = torch_onnx.export(model, dump_input, 'mobilnetv2_10.onnx', verbose=False)
print('Export of torch model completed!')
`
错误信息
Traceback (most recent call last): File "/train-data/CenterNet/src/tools/export_onnx.py", line 24, in <module> output = torch_onnx.export(model, dump_input, 'model.onnx', verbose=False) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/onnx/__init__.py", line 132, in export strip_doc_string, dynamic_axes) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/onnx/utils.py", line 64, in export example_outputs=example_outputs, strip_doc_string=strip_doc_string, dynamic_axes=dynamic_axes) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/onnx/utils.py", line 329, in _export _retain_param_name, do_constant_folding) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/onnx/utils.py", line 213, in _model_to_graph graph, torch_out = _trace_and_get_graph_from_model(model, args, training) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/onnx/utils.py", line 171, in _trace_and_get_graph_from_model trace, torch_out = torch.jit.get_trace_graph(model, args, _force_outplace=True) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/jit/__init__.py", line 256, in get_trace_graph return LegacyTracedModule(f, _force_outplace, return_inputs)(*args, **kwargs) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/link/.conda/envs/CenterNet/lib/python3.6/site-packages/torch/jit/__init__.py", line 324, in forward out_vars, _ = _flatten(out) RuntimeError: Only tuples, lists and Variables supported as JIT inputs, but got dict
A very good job, thanks to open source.
请问下作者是使用的哪个版本的centernet训练的呀?
https://github.com/xingyizhou/CenterNet 是这个吗?
您好,感谢分享此工程,请问下您是如何将pytorch模型转换为ncnn模型的呢?采用的是onnx还是其他什么框架呢?谢谢!
i want compile this code in arm,there is something wrong about this library
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.