Rapternmn / PyTorch-Onnx-Tensorrt

A set of tool which would make your life easier with Tensorrt and Onnxruntime. This Repo is designed for YoloV3
80 stars 18 forks source link

ERROR: Network must have at least one output #7

Open ghost opened 4 years ago

ghost commented 4 years ago

Got the following error: [TensorRT] ERROR: (Unnamed Layer* 32) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis (0), but dimensions mismatched at input 1 at index 1. Input 0 shape: [128,1216,1216], Input 1 shape: [256,608,608] [TensorRT] ERROR: Network must have at least one output Engine: None Traceback (most recent call last): File "create_trt_engine.py", line 51, in <module> main() File "create_trt_engine.py", line 48, in main save_engine(engine, trt_file) File "create_trt_engine.py", line 31, in save_engine buf = engine.serialize() AttributeError: 'NoneType' object has no attribute 'serialize'

My cfg;

`[net]

Testing

batch=1

subdivisions=1

Training

batch=64 subdivisions=16 width=608 height=608 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1

learning_rate=0.001 burn_in=1000 max_batches = 12000 policy=steps steps=7200,9600 scales=.1,.1

[convolutional] batch_normalize=1 filters=16 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=1

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=18 activation=linear

[yolo] mask = 3,4,5 anchors = 9,18, 13,27, 21,39, 29,59, 44,101, 70,146 classes=1 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1

[route] layers = -4

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[upsample] stride=2

[route] layers = -1, 8

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=18 activation=linear

[yolo] mask = 0,1,2 anchors = 9,18, 13,27, 21,39, 29,59, 44,101, 70,146 classes=1 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1

`

QZ-cmd commented 4 years ago

Hello,can you save this problem?i have same error

Rapternmn commented 4 years ago

Can you try with Batch = 1

Rapternmn commented 4 years ago

I have mentioned in README to first try with : batch=1 width=416 height=416

wavesCHJ commented 4 years ago

I have the same errors. this helps me. https://github.com/NVIDIA/TensorRT/issues/183#issuecomment-657673563 the solution is change

with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.OnnxParser(network, TRT_LOGGER) as parser:

to

explicit_batch = 1 << (int)(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
with trt.Builder(TRT_LOGGER) as builder, builder.create_network(explicit_batch) as network, trt.OnnxParser(network, TRT_LOGGER) as parser: