Hello ,
I have trained object detection model using tensorflow object detection api 1. I have exported the model in .pb format . I want to use it in the ios so i tried converting it to .mlmodel . But i am getting some errors like 'Input max_boxes must be const at compile time'. I have given details below.
I am using SSD-MobileNetV1 model
Converting Frontend ==> MIL Ops: 0%| | 0/30 [00:00<?, ? ops/s]WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 30/30 [00:00<00:00, 1523.76 ops/s]
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 9/9 [00:00<00:00, 6113.16 ops/s]
Converting Frontend ==> MIL Ops: 0%| | 0/30 [00:00<?, ? ops/s]WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 30/30 [00:00<00:00, 1438.46 ops/s]
Converting Frontend ==> MIL Ops: 93%|ββββββββββ| 666/719 [00:01<00:00, 294.71 ops/s]
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 9/9 [00:00<00:00, 1378.75 ops/s]
in ()
2 model = "inference_graph/frozen_inference_graph.pb"
3 outputs=['detection_classes:0','detection_scores:0','detection_boxes:0','num_detections:0']
----> 4 coremltools.convert(model,outputs=outputs)
22 frames
/usr/local/lib/python3.7/dist-packages/coremltools/converters/mil/mil/input_type.py in validate_inputs(self, op_name, op_type, candidate_kvs)
112 msg = msg_prefix + \
113 'Input {} must be const at compile time'
--> 114 raise ValueError(msg.format(name), name, var.name)
115
116 if not isinstance(var, InternalVar) and \
ValueError: ('Op "non_maximum_suppression_8" (op_type: non_maximum_suppression) Input max_boxes must be const at compile time', 'max_boxes', 'Postprocessor/BatchMultiClassNonMaxSuppression/map/while/MultiClassNonMaxSuppression/Minimum')
## To Reproduce
import coremltools
model = "inference_graph/frozen_inference_graph.pb"
outputs=['detection_classes:0','detection_scores:0','detection_boxes:0','num_detections:0']
coremltools.convert(model,outputs=outputs)
# Paste code snippet here
```
- If applicable, please attach the source model
please find source model below :
[https://drive.google.com/file/d/114dq7RPQrDi-PX2qzREuPPj9ilblm4z3/view?usp=sharing](url)
## System environment (please complete the following information):
- coremltools version (e.g., 3.0b5): ](url) 4.1
- OS (e.g., MacOS, Linux): Windows
- macOS version (if applicable): NA
- XCode version (if applicable): NA
- How you install python (anaconda, virtualenv, system):sytem
- python version (e.g. 3.7): 3.7
- any other relevant information: tensorflow version 1.15
πDescribe the bug
Hello , I have trained object detection model using tensorflow object detection api 1. I have exported the model in .pb format . I want to use it in the ios so i tried converting it to .mlmodel . But i am getting some errors like 'Input max_boxes must be const at compile time'. I have given details below. I am using SSD-MobileNetV1 model
Trace
Running TensorFlow Graph Passes: 100%|ββββββββββ| 7/7 [00:01<00:00, 4.36 passes/s] Converting Frontend ==> MIL Ops: 45%|βββββ | 323/719 [00:00<00:00, 3226.29 ops/s] Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 9/9 [00:00<00:00, 4198.97 ops/s]
Converting Frontend ==> MIL Ops: 0%| | 0/30 [00:00<?, ? ops/s]WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 30/30 [00:00<00:00, 1523.76 ops/s]
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 9/9 [00:00<00:00, 6113.16 ops/s]
Converting Frontend ==> MIL Ops: 0%| | 0/30 [00:00<?, ? ops/s]WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
WARNING:root:Input ls elem type unknown. Override with <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'>
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 30/30 [00:00<00:00, 1438.46 ops/s]
Converting Frontend ==> MIL Ops: 93%|ββββββββββ| 666/719 [00:01<00:00, 294.71 ops/s]
Converting Frontend ==> MIL Ops: 100%|ββββββββββ| 9/9 [00:00<00:00, 1378.75 ops/s]
Converting Frontend ==> MIL Ops: 0%| | 0/381 [00:00<?, ? ops/s] Converting Frontend ==> MIL Ops: 28%|βββ | 108/381 [00:00<00:00, 1076.34 ops/s] Converting Frontend ==> MIL Ops: 47%|βββββ | 178/381 [00:00<00:00, 507.98 ops/s] Converting Frontend ==> MIL Ops: 93%|ββββββββββ| 666/719 [00:01<00:00, 351.75 ops/s]
ValueError Traceback (most recent call last)