PROGrand/yolo-coreml

Question: No module named 'coremltools.libmilstoragepython'

Closed this issue · 1 comments

Dear PROGrand

I am now trying to convert model using the coremltools 5.1.

but I encountered the following error message.


(coremltools-env) $ python convert_v4.py -n coco.names -c yolov4_temp.cfg -w yolov4.weights -m yolov4.mlmodel -l RGB
Using TensorFlow backend.
names: coco.names
config: yolov4_temp.cfg
weights: yolov4.weights
mlpackage: yolov4.mlmodel
names: {"0": "person", "1": "bicycle", "2": "car", "3": "motorbike", "4": "aeroplane", "5":
< >
"scissors", "77": "teddy bear", "78": "hair drier", "79": "toothbrush"}
Model: "yolov4_temp"


Layer (type) Output Shape Param #

convolutional_0 (ConvolutionalLayer) (None, 608, 608, 32) 992
____________________________________________________________________________<>
convolutional_109 (ConvolutionalLayer) (None, 19, 19, 255) 261375


yolo_2 (YoloLayer) multiple 0

Total params: 64,429,405
Trainable params: 64,363,101
Non-trainable params: 66,304


Running TensorFlow Graph Passes: 100%|██████████████████████| 5/5 [00:16<00:00, 3.20s/ passes]
Converting Frontend ==> MIL Ops: 100%|
<>
██████████████████████| 9/9 [25:07<00:00, 167.55s/ passes]
traceback (most recent call last):
File "convert_v4.py", line 79, in
_main(parser.parse_args())
File "convert_v4.py", line 62, in _main
debug=False
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/_converters_entry.py", line 337, in convert
debug=debug,
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 182, in mil_convert
return _mil_convert(model, convert_from, convert_to, ConverterRegistry, MLModel, compute_units, **kwargs)
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 214, in _mil_convert
**kwargs
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 320, in mil_convert_to_proto
out = backend_converter(prog, **kwargs)
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/converter.py", line 123, in call
from .backend.mil import load as backend_load
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/backend/mil/init.py", line 6, in
from .load import load
File "/Users/###/opt/miniconda3/envs/coremltools-env/lib/python3.7/site-packages/coremltools/converters/mil/backend/mil/load.py", line 36, in
from coremltools.libmilstoragepython import _BlobStorageWriter as BlobWriter
ModuleNotFoundError: No module named 'coremltools.libmilstoragepython'


load.py", line 36 said
36: from coremltools.libmilstoragepython import _BlobStorageWriter as BlobWriter
and
BlobWriter is used as
252: blob_writer = BlobWriter(weight_path)

My environment is
conda create -n coremltools-env python=3.7
conda activate coremltools-env
pip install yolov4==3.2.0
pip install opencv-python==4.5.4.60
pip install h5py==3.1.0 (not 1.5.2 but automatically installed by tf 2.5.0)
pip install coremltools==5.1.0
pip install keras==2.2.4
pip install tensorflow==2.5.0
on MacOS version 10.13.6
Could you provide any suggestion to solve this error?
It seems to be coremltools5.1's bug for me.

Exact version of packages do not throws such issues.