Skip to content

Commit

Permalink
Merge pull request #1 from dlawrences/dev/coreml_convert_pxscaling
Browse files Browse the repository at this point in the history
Updated coreml conversion to do pixel scaling between 0.0 and 1.0
  • Loading branch information
dlawrences committed Jul 8, 2020
2 parents e8cf24b + a9918fb commit 7c4d3cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
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)
Expand Down

0 comments on commit 7c4d3cf

Please sign in to comment.