瀏覽代碼

Merge pull request #1 from dlawrences/dev/coreml_convert_pxscaling

Updated coreml conversion to do pixel scaling between 0.0 and 1.0
5.0
Laurentiu Diaconu GitHub 4 年之前
父節點
當前提交
7c4d3cf51b
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 2 行新增1 行删除
  1. +2
    -1
      models/export.py

+ 2
- 1
models/export.py 查看文件

@@ -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…
取消
儲存