glenn-jocher commited on
Commit
9006b85
1 Parent(s): 41bb70b

update export.py torchscript file extension

Browse files
Files changed (1) hide show
  1. models/export.py +2 -2
models/export.py CHANGED
@@ -31,7 +31,7 @@ if __name__ == '__main__':
31
  # TorchScript export
32
  try:
33
  print('\nStarting TorchScript export with torch %s...' % torch.__version__)
34
- f = opt.weights.replace('.pt', '.torchscript') # filename
35
  ts = torch.jit.trace(model, img)
36
  ts.save(f)
37
  print('TorchScript export success, saved as %s' % f)
@@ -62,7 +62,7 @@ if __name__ == '__main__':
62
 
63
  print('\nStarting CoreML export with coremltools %s...' % ct.__version__)
64
  # convert model from torchscript and apply pixel scaling as per detect.py
65
- model = ct.convert(ts, inputs=[ct.ImageType(name='images', shape=img.shape, scale=1/255.0, bias=[0, 0, 0])])
66
  f = opt.weights.replace('.pt', '.mlmodel') # filename
67
  model.save(f)
68
  print('CoreML export success, saved as %s' % f)
 
31
  # TorchScript export
32
  try:
33
  print('\nStarting TorchScript export with torch %s...' % torch.__version__)
34
+ f = opt.weights.replace('.pt', '.torchscript.pt') # filename
35
  ts = torch.jit.trace(model, img)
36
  ts.save(f)
37
  print('TorchScript export success, saved as %s' % f)
 
62
 
63
  print('\nStarting CoreML export with coremltools %s...' % ct.__version__)
64
  # convert model from torchscript and apply pixel scaling as per detect.py
65
+ model = ct.convert(ts, inputs=[ct.ImageType(name='images', shape=img.shape, scale=1 / 255.0, bias=[0, 0, 0])])
66
  f = opt.weights.replace('.pt', '.mlmodel') # filename
67
  model.save(f)
68
  print('CoreML export success, saved as %s' % f)