Explorar el Código

export.py update

5.0
Glenn Jocher hace 4 años
padre
commit
a9d20eba3e
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. +5
    -2
      models/export.py

+ 5
- 2
models/export.py Ver fichero

@@ -30,7 +30,7 @@ if __name__ == '__main__':

# TorchScript export
try:
print('\nStarting TorchScript export with torch %s...' % torch.__version)
print('\nStarting TorchScript export with torch %s...' % torch.__version__)
f = opt.weights.replace('.pt', '.torchscript') # filename
ts = torch.jit.trace(model, img)
ts.save(f)
@@ -52,6 +52,9 @@ if __name__ == '__main__':
onnx_model = onnx.load(f) # load onnx model
onnx.checker.check_model(onnx_model) # check onnx model
print(onnx.helper.printable_graph(onnx_model.graph)) # print a human readable model
print('ONNX export success, saved as %s\nView with https://github.com/lutzroeder/netron' % f)
print('ONNX export success, saved as %s' % f)
except Exception as e:
print('ONNX export failed: %s' % e)

# Finish
print('\nExports complete. Visualize with https://github.com/lutzroeder/netron.')

Cargando…
Cancelar
Guardar