Laurentiu Diaconu commited on
Commit
a9918fb
1 Parent(s): e8cf24b

updated coreml conversion to do pixel scaling between 0.0 and 1.0

Browse files
Files changed (1) hide show
  1. models/export.py +2 -1
models/export.py CHANGED
@@ -61,7 +61,8 @@ if __name__ == '__main__':
61
  import coremltools as ct
62
 
63
  print('\nStarting CoreML export with coremltools %s...' % ct.__version__)
64
- model = ct.convert(ts, inputs=[ct.ImageType(name='images', shape=img.shape)]) # convert
 
65
  f = opt.weights.replace('.pt', '.mlmodel') # filename
66
  model.save(f)
67
  print('CoreML export success, saved as %s' % f)
 
61
  import coremltools as ct
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)