mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
Merge pull request #321 from dlawrences/master
Update CoreML model conversion to do pixel scaling as well
This commit is contained in:
commit
cd6609297c
@ -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…
x
Reference in New Issue
Block a user