Browse Source

Check CoreML models.train() mode (#3262)

* Check CoreML models.train() mode

* Update export.py
modifyDataloader
Glenn Jocher GitHub 3 years ago
parent
commit
7b36e38cf8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      models/export.py

+ 1
- 0
models/export.py View File

import coremltools as ct import coremltools as ct


print(f'{prefix} starting export with coremltools {ct.__version__}...') print(f'{prefix} starting export with coremltools {ct.__version__}...')
assert opt.train, 'CoreML exports should be placed in model.train() mode with `python export.py --train`'
model = ct.convert(ts, inputs=[ct.ImageType('image', shape=img.shape, scale=1 / 255.0, bias=[0, 0, 0])]) model = ct.convert(ts, inputs=[ct.ImageType('image', shape=img.shape, scale=1 / 255.0, bias=[0, 0, 0])])
f = opt.weights.replace('.pt', '.mlmodel') # filename f = opt.weights.replace('.pt', '.mlmodel') # filename
model.save(f) model.save(f)

Loading…
Cancel
Save