基于Tensorflow2.x Object Detection API构建自定义物体检测器(二)
这是机器未来的第1篇文章,由机器未来原创
写在前面:
- 博客简介:专注AIoT领域,追逐未来时代的脉搏,记录路途中的技术成长!
- 专栏简介:记录博主从0到1掌握物体检测工作流的过程,具备自定义物体检测器的能力
- 面向人群:具备深度学习理论基础的学生或初级开发者
- 专栏计划:接下来会逐步发布跨入人工智能的系列博文,敬请期待
- Python零基础快速入门系列
- 快速入门Python数据科学系列
- 人工智能开发环境搭建系列
- 机器学习系列
- 物体检测快速入门系列
- 自动驾驶物体检测系列
- …
接上文《基于Tensorflow2.x Object Detection API构建自定义物体检测器》
6. 配置训练流水线
6.1 下载预训练模型
使用wget命令行下载预训练detection模型
wget -c http://download.tensorflow.org/models/object_detection/tf2/20200711/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8.tar.gz
如果提示找不到wget命令,使用apt工具安装
apt install wget
特别注意:此处下载的模型为detection模型,pipline.config中的fine_tune_checkpoint_type:配置为"detection"才有效,否则会报错
-
• TF2 Detection zoo:传送门
-
• TF2 Classification Zoo:传送门
6.2 解压缩预训练模型
使用tar命令tar zxvf ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8.tar.gz
解压预训练模型
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo/pre_trained_models# tar zxvf ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8.tar.gz
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint/
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint/ckpt-0.data-00000-of-00001
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint/checkpoint
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint/ckpt-0.index
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/pipeline.config
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/saved_model.pb
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/assets/
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/variables/
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/variables/variables.data-00000-of-00001
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/saved_model/variables/variables.index
解压后预训练模型在training_demo/pre_trained_models目录下:
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo/pre_trained_models# ls
ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8
预训练模型的目录结构如下
training_demo/
├─ ...
├─ pre_trained_models/
│ └─ ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/
│ ├─ checkpoint/
│ ├─ saved_model/
│ └─ pipeline.config
└─ ...
6.3 配置预训练模型
-
• 拷贝流水线文件到指定目录 在
training_demo/models
目录下创建my_ssd_resnet50_v1_fpn
目录,将流水线配置文件training_demo/pre_trained_models/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/pipeline.config
拷贝到该目录下,拷贝后的目录结构如下training_demo/ ├─ ... ├─ models/ │ └─ my_ssd_resnet50_v1_fpn/ │ └─ pipeline.config └─ ...
-
• 配置pipline.config 相关的配置项及描述如下代码所示:
model {
ssd {
num_classes: 2 # num_classes为自定义对象检测器所检测的物体分类总数,此处为2
image_resizer {
fixed_shape_resizer {
height: 640
width: 640
}
}
......
train_config {
batch_size: 8 # batch_size依赖可用的内存,可根据需要添加或减少,且至少保证大于样本数
data_augmentation_options {
random_horizontal_flip {
}
}
......
# fine_tune_checkpoint为预训练模型的文件路径配置
fine_tune_checkpoint: "pre_trained_models/ssd_mobilenet_v2_fpnlite_640x640_coco17_tpu-8/checkpoint/ckpt-0"
num_steps: 2000 # num_steps为训练的epochs的数量
startup_delay_steps: 0.0
replicas_to_aggregate: 8
max_number_of_boxes: 100
unpad_groundtruth_tensors: false
fine_tune_checkpoint_type: "detection" # 因为要训练完整的检测模型,这里填写detection,而不是classification
use_bfloat16: false # 使用TPU训练时置为true
fine_tune_checkpoint_version: V2
}
train_input_reader {
label_map_path: "annotations/label_map.pbtxt" # 配置标签映射文件
tf_record_input_reader {
input_path: "annotations/train.record" # 配置待训练的训练集TFRecord 文件
}
}
......
eval_input_reader {
label_map_path: "annotations/label_map.pbtxt" # 配置标签映射文件
shuffle: false
num_epochs: 1
tf_record_input_reader {
input_path: "annotations/test.record" # 配置待训练的测试集TFRecord 文件
}
}
7. 训练模型
7.1 拷贝脚本到工程目录
拷贝models/research/object_detection/model_main_tf2.py
到training_demo
目录
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# cp ../../models/research/object_detection/model_main_tf2.py .
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# ls
README.md annotations exported-models images model_main_tf2.py models pre_trained_models
7.2 训练模型
python model_main_tf2.py --model_dir=models/ssd_mobilenet_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config
训练输出如下所示:
2022-03-18 16:31:18.185503: W tensorflow/core/common_runtime/bfc_allocator.cc:275] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.05GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
INFO:tensorflow:Step 100 per-step time 0.690s
I0318 16:31:54.968108 140508069689152 model_lib_v2.py:705] Step 100 per-step time 0.690s
INFO:tensorflow:{'Loss/classification_loss': 0.5467333,
'Loss/localization_loss': 0.62460774,
'Loss/regularization_loss': 0.37178832,
'Loss/total_loss': 1.5431294,
'learning_rate': 0.014666351}
I0318 16:31:54.968450 140508069689152 model_lib_v2.py:708] {'Loss/classification_loss': 0.5467333,
'Loss/localization_loss': 0.62460774,
'Loss/regularization_loss': 0.37178832,
'Loss/total_loss': 1.5431294,
'learning_rate': 0.014666351}
7.2.1 训练模型过程中遇到的问题:
6.2.1.1 ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
-
• 解决办法:
-
• 查看numpy、pycocotools版本
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# python -c "import numpy as np;print(np.__version__)"
1.21.5
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# python -m pip show pycocotools
Name: pycocotools
Version: 2.0.5
Summary: Official APIs for the MS-COCO dataset
Home-page: None
Author: None
Author-email: None
License: UNKNOWN
Location: /usr/local/lib/python3.8/dist-packages
Requires: cython, matplotlib, setuptools
Required-by: tf-models-official, object-detection
numpy的版本为1.21.5,pycocotools 的版本为2.0.5,将pycocotools 的版本降为2.0.1可以解决问题
pip install --upgrade pycocotools==2.0.1
7.2.1.2 模型输入输出访问错误: Input/output error [Op:SaveV2]
I0320 12:47:20.331673 139707635332928 model_lib_v2.py:705] Step 1000 per-step time 0.433s
INFO:tensorflow:{‘Loss/classification_loss’: 0.26997942,
‘Loss/localization_loss’: 0.30341092,
‘Loss/regularization_loss’: 2.2776012,
‘Loss/total_loss’: 2.8509917,
‘learning_rate’: 0.0266665}
I0320 12:47:20.331962 139707635332928 model_lib_v2.py:708] {‘Loss/classification_loss’: 0.26997942,
‘Loss/localization_loss’: 0.30341092,
‘Loss/regularization_loss’: 2.2776012,
‘Loss/total_loss’: 2.8509917,
‘learning_rate’: 0.0266665}
2022-03-20 12:47:23.322429: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at save_restore_v2_ops.cc:138 : UNKNOWN: models/my_ssd_resnet50_v1_fpn/ckpt-3_temp/part-00000-of-00001.data-00000-of-00001.tempstate1791880307736640246; Input/output error
Traceback (most recent call last):
File “model_main_tf2.py”, line 115, in <module>
tf.compat.v1.app.run()
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/platform/app.py”, line 36, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File “/usr/local/lib/python3.8/dist-packages/absl/app.py”, line 312, in run
_run_main(main, args)
File “/usr/local/lib/python3.8/dist-packages/absl/app.py”, line 258, in _run_main
sys.exit(main(argv))
File “model_main_tf2.py”, line 106, in main
model_lib_v2.train_loop(
File “/usr/local/lib/python3.8/dist-packages/object_detection/model_lib_v2.py”, line 713, in train_loop
manager.save()
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/checkpoint_management.py”, line 813, in save
save_path = self._checkpoint.write(prefix)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/tracking/util.py”, line 2105, in write
output = self._saver.save(file_prefix=file_prefix, options=options)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/tracking/util.py”, line 1262, in save
save_path, new_feed_additions = self._save_cached_when_graph_building(
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/tracking/util.py”, line 1206, in _save_cached_when_graph_building
save_op = saver.save(file_prefix, options=options)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/saving/functional_saver.py”, line 371, in save
return save_fn()
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/saving/functional_saver.py”, line 345, in save_fn
sharded_saves.append(saver.save(shard_prefix, options))
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/saving/functional_saver.py”, line 80, in save
return io_ops.save_v2(file_prefix, tensor_names, tensor_slices, tensors)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_io_ops.py”, line 1707, in save_v2
return save_v2_eager_fallback(
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/ops/gen_io_ops.py”, line 1728, in save_v2_eager_fallback
_result = _execute.execute(b"SaveV2", 0, inputs=_inputs_flat, attrs=_attrs,
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py”, line 54, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.UnknownError: models/my_ssd_resnet50_v1_fpn/ckpt-3_temp/part-00000-of-00001.data-00000-of-00001.tempstate1791880307736640246; Input/output error [Op:SaveV2]
- 解决办法:
- 重启电脑后解决。
7.3 tensorboard查看训练过程曲线
执行命令tensorboard --logdir=training_demo/models/ssd_mobilenet_v1_fpn/train
查看tensorboard面板
root@cc58e655b170:/home/zhou/tensorflow/workspace# tensorboard --logdir=training_demo/models/my_ssd_resnet50_v1_fpn/train
2022-03-18 16:38:07.080715: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:922] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2022-03-18 16:38:07.100073: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:922] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2022-03-18 16:38:07.101614: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:922] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
NOTE: Using experimental fast data loading logic. To disable, pass
"--load_fast=false" and report issues on GitHub. More details:
https://github.com/tensorflow/tensorboard/issues/4784
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.8.0 at http://localhost:6006/ (Press CTRL+C to quit)
-
• 打开浏览器,输入
http://127.0.0.1:6006/#scalars
,浏览器效果如图0318-1
注意事项:
-
• tensorboard: error: invalid choice: ‘Recognizer\logs’ (choose from ‘serve’, ‘dev’)
-
• 命令的logdir的=号两侧不可以有空格
tensorboard --logdir=[train_path]
7.4 评估模型
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# python model_main_tf2.py --model_dir=models/ssd_mobilenet_v1_fpn --pipeline_config_path=models/ssd_mobilenet_v1_fpn/pipeline.config --checkpoint_dir=models/ssd_mobilenet_v1_fpn
......
2022-03-18 17:10:21.973191: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3951 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
INFO:tensorflow:Reading unweighted datasets: ['annotations/test.record']
I0318 17:10:22.271144 140242454390592 dataset_builder.py:163] Reading unweighted datasets: ['annotations/test.record']
INFO:tensorflow:Reading record datasets for input file: ['annotations/test.record']
I0318 17:10:22.272839 140242454390592 dataset_builder.py:80] Reading record datasets for input file: ['annotations/test.record']
INFO:tensorflow:Number of filenames to read: 1
I0318 17:10:22.273008 140242454390592 dataset_builder.py:81] Number of filenames to read: 1
WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards.
W0318 17:10:22.273125 140242454390592 dataset_builder.py:87] num_readers has been reduced to 1 to match input file shards.
......
INFO:tensorflow:Waiting for new checkpoint at models/my_ssd_resnet50_v1_fpn
I0318 17:10:32.268154 140242454390592 checkpoint_utils.py:136] Waiting for new checkpoint at models/my_ssd_resnet50_v1_fpn
INFO:tensorflow:Found new checkpoint at models/my_ssd_resnet50_v1_fpn/ckpt-6
I0318 17:10:32.275528 140242454390592 checkpoint_utils.py:145] Found new checkpoint at models/my_ssd_resnet50_v1_fpn/ckpt-6
/usr/local/lib/python3.8/dist-packages/keras/backend.py:450: UserWarning: `tf.keras.backend.set_learning_phase` is deprecated and will be removed after 2020-10-11. To update it, simply pass a True/False value to the `training` argument of the `__call__` method of your layer or model.
......
INFO:tensorflow:Performing evaluation on 2 images.
I0318 17:11:09.182368 140242454390592 coco_evaluation.py:293] Performing evaluation on 2 images.
creating index...
index created!
INFO:tensorflow:Loading and preparing annotation results...
I0318 17:11:09.182641 140242454390592 coco_tools.py:116] Loading and preparing annotation results...
INFO:tensorflow:DONE (t=0.00s)
I0318 17:11:09.182915 140242454390592 coco_tools.py:138] DONE (t=0.00s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=0.02s).
Accumulating evaluation results...
DONE (t=0.01s).
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.275
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.538
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.167
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.276
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.250
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.350
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.550
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.550
INFO:tensorflow:Eval metrics at step 1000
I0318 17:11:09.223372 140242454390592 model_lib_v2.py:1015] Eval metrics at step 1000
INFO:tensorflow: + DetectionBoxes_Precision/mAP: 0.275370
I0318 17:11:09.227210 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP: 0.275370
INFO:tensorflow: + DetectionBoxes_Precision/mAP@.50IOU: 0.538462
I0318 17:11:09.231014 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP@.50IOU: 0.538462
INFO:tensorflow: + DetectionBoxes_Precision/mAP@.75IOU: 0.166667
I0318 17:11:09.233924 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP@.75IOU: 0.166667
INFO:tensorflow: + DetectionBoxes_Precision/mAP (small): -1.000000
I0318 17:11:09.238049 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP (small): -1.000000
INFO:tensorflow: + DetectionBoxes_Precision/mAP (medium): -1.000000
I0318 17:11:09.241585 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP (medium): -1.000000
INFO:tensorflow: + DetectionBoxes_Precision/mAP (large): 0.275628
I0318 17:11:09.245546 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Precision/mAP (large): 0.275628
INFO:tensorflow: + DetectionBoxes_Recall/AR@1: 0.250000
I0318 17:11:09.250303 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@1: 0.250000
INFO:tensorflow: + DetectionBoxes_Recall/AR@10: 0.350000
I0318 17:11:09.255020 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@10: 0.350000
INFO:tensorflow: + DetectionBoxes_Recall/AR@100: 0.550000
I0318 17:11:09.266462 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@100: 0.550000
INFO:tensorflow: + DetectionBoxes_Recall/AR@100 (small): -1.000000
I0318 17:11:09.269966 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@100 (small): -1.000000
INFO:tensorflow: + DetectionBoxes_Recall/AR@100 (medium): -1.000000
I0318 17:11:09.272413 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@100 (medium): -1.000000
INFO:tensorflow: + DetectionBoxes_Recall/AR@100 (large): 0.550000
I0318 17:11:09.275286 140242454390592 model_lib_v2.py:1018] + DetectionBoxes_Recall/AR@100 (large): 0.550000
INFO:tensorflow: + Loss/localization_loss: 0.467712
I0318 17:11:09.278475 140242454390592 model_lib_v2.py:1018] + Loss/localization_loss: 0.467712
INFO:tensorflow: + Loss/classification_loss: 0.517050
I0318 17:11:09.281271 140242454390592 model_lib_v2.py:1018] + Loss/classification_loss: 0.517050
INFO:tensorflow: + Loss/regularization_loss: 0.373590
I0318 17:11:09.284374 140242454390592 model_lib_v2.py:1018] + Loss/regularization_loss: 0.373590
INFO:tensorflow: + Loss/total_loss: 1.358352
I0318 17:11:09.287869 140242454390592 model_lib_v2.py:1018] + Loss/total_loss: 1.358352
8. 导出模型
- • 拷贝models/research/object_detection/exporter_main_v2.py脚本到training_demo目录下
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# cp ../../models/research/object_detection/exporter_main_v2.py .
- • 执行导出
python exporter_main_v2.py \
--input_type image_tensor \
--pipeline_config_path models/ssd_mobilenet_v1_fpn/pipeline.config \
--trained_checkpoint_dir models/ssd_mobilenet_v1_fpn \
--output_directory "exported_models/my_model"
输出如下:
2022-03-18 17:31:40.560733: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3951 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
WARNING:tensorflow:From /usr/local/lib/python3.8/dist-packages/tensorflow/python/autograph/impl/api.py:458: calling map_fn_v2 (from tensorflow.python.ops.map_fn) with back_prop=False is deprecated and will be removed in a future version.
Instructions for updating:
back_prop=False is deprecated. Consider using tf.stop_gradient instead.
Instead of:
results = tf.map_fn(fn, elems, back_prop=False)
Use:
results = tf.nest.map_structure(tf.stop_gradient, tf.map_fn(fn, elems))
W0318 17:31:40.987179 139643789973312 deprecation.py:610] From /usr/local/lib/python3.8/dist-packages/tensorflow/python/autograph/impl/api.py:458: calling map_fn_v2 (from tensorflow.python.ops.map_fn) with back_prop=False is deprecated and will be removed in a future version.
Instructions for updating:
back_prop=False is deprecated. Consider using tf.stop_gradient instead.
Instead of:
results = tf.map_fn(fn, elems, back_prop=False)
Use:
results = tf.nest.map_structure(tf.stop_gradient, tf.map_fn(fn, elems))
2022-03-18 17:32:03.258760: W tensorflow/python/util/util.cc:368] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
WARNING:tensorflow:Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7f0064491a00>, because it is not built.
W0318 17:32:06.718129 139643789973312 save_impl.py:71] Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7f0064491a00>, because it is not built.
W0318 17:32:25.107337 139643789973312 save.py:260] Found untraced functions such as WeightSharedConvolutionalBoxPredictor_layer_call_fn, WeightSharedConvolutionalBoxPredictor_layer_call_and_return_conditional_losses, WeightSharedConvolutionalBoxHead_layer_call_fn, WeightSharedConvolutionalBoxHead_layer_call_and_return_conditional_losses, WeightSharedConvolutionalClassHead_layer_call_fn while saving (showing 5 of 208). These functions will not be directly callable after loading.
INFO:tensorflow:Assets written to: exported-models/my_model/saved_model/assets
I0318 17:32:32.900944 139643789973312 builder_impl.py:779] Assets written to: exported-models/my_model/saved_model/assets
INFO:tensorflow:Writing pipeline config file to exported-models/my_model/pipeline.config
I0318 17:32:33.612621 139643789973312 config_util.py:253] Writing pipeline config file to exported-models/my_model/pipeline.config
结构如下:
root@cc58e655b170:/home/zhou/tensorflow/workspace/training_demo# tree exported-models/my_model/
exported-models/my_model/
├── checkpoint
│ ├── checkpoint
│ ├── ckpt-0.data-00000-of-00001
│ └── ckpt-0.index
├── pipeline.config
└── saved_model
├── assets
├── saved_model.pb
└── variables
├── variables.data-00000-of-00001
└── variables.index
4 directories, 7 files
注意事项:
-
• 路径不能使用反斜杠,必须使用’/’
-
• 路径不可以有‘-’符号,有的话,需要使用双引号将路径引用起来,否则会报错
FATAL Flags parsing error: flag --output_directory=None: Flag --output_directory must have a value other than None.
推荐阅读:
- 点赞
- 收藏
- 关注作者
评论(0)