Browse Source

updated coreml conversion to do pixel scaling between 0.0 and 1.0

5.0
Laurentiu Diaconu 4 years ago
parent
commit
a9918fbf2b
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      models/export.py

+ 2
- 1
models/export.py View File

@@ -61,7 +61,8 @@ if __name__ == '__main__':
import coremltools as ct

print('\nStarting CoreML export with coremltools %s...' % ct.__version__)
model = ct.convert(ts, inputs=[ct.ImageType(name='images', shape=img.shape)]) # convert
# convert model from torchscript and apply pixel scaling as per detect.py
model = ct.convert(ts, inputs=[ct.ImageType(name='images', shape=img.shape, scale=1/255.0, bias=[0, 0, 0])])
f = opt.weights.replace('.pt', '.mlmodel') # filename
model.save(f)
print('CoreML export success, saved as %s' % f)

Loading…
Cancel
Save