Я обучил свою модель с помощью google ml engine со следующей конфигурацией.
JOB_NAME=object_detection"_$(date +%m_%d_%Y_%H_%M_%S)"
echo $JOB_NAME
gcloud ml-engine jobs submit training $JOB_NAME \
--job-dir=gs://$1/train \
--scale-tier BASIC_GPU \
--runtime-version 1.12 \
--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz,/tmp/pycocotools/pycocotools-2.0.tar.gz \
--module-name object_detection.model_main \
--region europe-west1 \
-- \
--model_dir=gs://$1/train \
--pipeline_config_path=gs://$1/data/fast_rcnn_resnet101_coco.config
После обучения я загрузил последнюю контрольную точку из GCP и экспортировал модель, используя следующую команду:
python export_inference_graph.py --input_type encoded_image_string_tensor --pipeline_config_path training/fast_rcnn_resnet101_coco.config --trained_checkpoint_prefix training/model.ckpt-11127 --output_directory exported_graphs
Моя конфигурация модели выглядит следующим образом:
The given SavedModel SignatureDef contains the following input(s):
inputs['inputs'] tensor_info:
dtype: DT_UINT8
shape: (-1, -1, -1, 3)
name: image_tensor:0
The given SavedModel SignatureDef contains the following output(s):
outputs['detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 4)
name: detection_boxes:0
outputs['detection_classes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300)
name: detection_classes:0
outputs['detection_features'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, -1, -1, -1)
name: detection_features:0
outputs['detection_multiclass_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 2)
name: detection_multiclass_scores:0
outputs['detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300)
name: detection_scores:0
outputs['num_detections'] tensor_info:
dtype: DT_FLOAT
shape: (-1)
name: num_detections:0
outputs['raw_detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 4)
name: raw_detection_boxes:0
outputs['raw_detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 300, 2)
name: raw_detection_scores:0
Method name is: tensorflow/serving/predict
После этого я развертываю эту модель на ml-engine со следующей конфигурацией:
Python version 2.7
Framework TensorFlow
Framework version 1.12.3
Runtime version 1.12
Machine type Single core CPU
Я получаю следующую ошибку:
Ошибка
Ошибка создания версии. Обнаружена плохая модель с ошибкой: «Не удалось загрузить модель: загрузка работоспособной: {имя: версия по умолчанию: 1} не выполнена: не найдено: тип операции не зарегистрирован« FusedBatchNormV3 »в двоичном файле, работающем на localhost. Убедитесь, что операционная система и ядро зарегистрированы вдвоичный файл, запущенный в этом процессе. Обратите внимание, что если вы загружаете сохраненный граф, который использовал ops из tf.contrib, доступ к (например) tf.contrib.resampler
должен быть выполнен перед импортом графа, так как contrib-операции лениво регистрируются, когда модуль первыйдоступ. \ n \ n (код ошибки: 0) "