cmdbug/TNN_Demo

很好的工作,请问自己的训练的模型怎么修改呢?

henbucuoshanghai opened this issue · 11 comments

你好我 根据安卓demo的cpp代码,只扣出调用tnn,测试图片的代码,在本机运行成功。

我自己训练一个模型,只修改为一类,别的默认官方的,请问为何提示无法调用。模型输出不对吗?

E/tnn: GetOutputMat [File /home/TNN-master/source/tnn/core/instance.cc][Line 250] instance dont have the output with name: 413
0
E/tnn: GetOutputMat [File /home/TNN-master/source/tnn/core/instance.cc][Line 250] instance dont have the output with name: 431
0
Segmentation fault (core dumped)

onnx的输出是1252006 因为1类+5=6 故这是对的 请问tnn的输出难道不是如此吗?
layers是做什么的?我网络结构什么的统统没改,请问怎么修改layers? 他 是做什么的?
多谢多谢!!

1252006

你好 按照操作修改,无法export出模型 报错维度对不上。。

Fusing layers...
Model Summary: 224 layers, 7053910 parameters, 0 gradients
Traceback (most recent call last):
File "export.py", line 190, in
main(opt)
File "export.py", line 185, in main
run(**vars(opt))
File "export.py", line 147, in run
y = model(img) # dry runs
File "/anaconda3/envs/lili/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "yolov5/models/yolo.py", line 125, in forward
return self.forward_once(x, profile, visualize) # single-scale inference, train
File "/yolov5/models/yolo.py", line 156, in forward_once
x = m(x) # run
File "/anaconda3/envs/lili/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/models/yolo.py", line 70, in forward
y = torch.cat((xy, wh, y[..., 4:]), -1)
RuntimeError: torch.cat(): Sizes of tensors must match except in dimension 4. Got 1 and 3 in dimension 1 (The offending index is 1)

使用v3版本试,最新版本未测试。

感谢 但是v5训练的模型 v3能行吗?结构 某些层什么的改变了吗?

yolov5的v3版本,就是转换说明使用的版本。v5能不能用v3的就不知道了,只用过v3版本。

Namespace(batch_size=1, img_size=[640, 640], weights='./last.pt')
Traceback (most recent call last):
File "export.py", line 29, in
model = torch.load(opt.weights, map_location=torch.device('cpu'))['model'].float()
File "anaconda3/envs/lili/lib/python3.8/site-packages/torch/serialization.py", line 607, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/anaconda3/envs/lili/lib/python3.8/site-packages/torch/serialization.py", line 882, in _load
result = unpickler.load()
File "anaconda3/envs/lili/lib/python3.8/site-packages/torch/serialization.py", line 875, in find_class
return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'models'

load model error.