问题描述
我正在使用Tensorflow对象检测API重新训练ssd_mobilenet_v2_coco_2018_03_29,并且在Windows和Ubuntu环境中都遇到此特定错误。 我下面的环境是Windows 10,带有python 3.6.9,cuda 9.0和tensorflow 1.15,我使用了protobuf 3.13.0。 我做了安装测试,没关系,所以现在我尝试使用自己的数据集,并得到以下错误
google.protobuf.text_format.ParseError: 141:3 : Message type "object_detection.protos.TrainConfig" has no field named "fine_tune_checkpoint_version".
我使用的配置文件
# SSD with Mobilenet v2 FPN-lite (go/fpn-lite) feature extractor,shared Box
# predictor and focal loss (a mobile version of Retinanet).
# Retinanet: see Lin et al,https://arxiv.org/abs/1708.02002
# Trained on COCO,initialized from Imagenet classification checkpoint
# Train on TPU-8
#
# Achieves 28.2 mAP on COCO17 Val
model {
ssd {
inplace_batchnorm_update: true
freeze_batchnorm: false
num_classes: 3
Box_coder {
faster_rcnn_Box_coder {
y_scale: 10.0
x_scale: 10.0
height_scale: 5.0
width_scale: 5.0
}
}
matcher {
argmax_matcher {
matched_threshold: 0.5
unmatched_threshold: 0.5
ignore_thresholds: false
negatives_lower_than_unmatched: true
force_match_for_each_row: true
use_matmul_gather: true
}
}
similarity_calculator {
IoU_similarity {
}
}
encode_background_as_zeros: true
anchor_generator {
multiscale_anchor_generator {
min_level: 3
max_level: 7
anchor_scale: 4.0
aspect_ratios: [1.0,2.0,0.5]
scales_per_octave: 2
}
}
image_resizer {
fixed_shape_resizer {
height: 640
width: 640
}
}
Box_predictor {
weight_shared_convolutional_Box_predictor {
depth: 128
class_prediction_bias_init: -4.6
conv_hyperparams {
activation: RELU_6,regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
random_normal_initializer {
stddev: 0.01
mean: 0.0
}
}
batch_norm {
scale: true,decay: 0.997,epsilon: 0.001,}
}
num_layers_before_predictor: 4
share_prediction_tower: true
use_depthwise: true
kernel_size: 3
}
}
feature_extractor {
type: 'ssd_mobilenet_v2_fpn_keras'
use_depthwise: true
fpn {
min_level: 3
max_level: 7
additional_layer_depth: 128
}
min_depth: 16
depth_multiplier: 1.0
conv_hyperparams {
activation: RELU_6,regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
random_normal_initializer {
stddev: 0.01
mean: 0.0
}
}
batch_norm {
scale: true,}
}
override_base_feature_extractor_hyperparams: true
}
loss {
classification_loss {
weighted_sigmoid_focal {
alpha: 0.25
gamma: 2.0
}
}
localization_loss {
weighted_smooth_l1 {
}
}
classification_weight: 1.0
localization_weight: 1.0
}
normalize_loss_by_num_matches: true
normalize_loc_loss_by_codesize: true
post_processing {
batch_non_max_suppression {
score_threshold: 1e-8
IoU_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 100
}
score_converter: SIGMOID
}
}
}
train_config: {
fine_tune_checkpoint_version: V2
fine_tune_checkpoint: "D:/me1eye/New folder/29082020/models/research/object_detection/ssd_mobilenet_v2_coco_2018_03_29/mobilenet_v2.ckpt-1"
fine_tune_checkpoint_type: "classification"
batch_size: 128
sync_replicas: true
startup_delay_steps: 0
replicas_to_aggregate: 8
num_steps: 50000
data_augmentation_options {
random_horizontal_flip {
}
}
data_augmentation_options {
random_crop_image {
min_object_covered: 0.0
min_aspect_ratio: 0.75
max_aspect_ratio: 3.0
min_area: 0.75
max_area: 1.0
overlap_thresh: 0.0
}
}
optimizer {
momentum_optimizer: {
learning_rate: {
cosine_decay_learning_rate {
learning_rate_base: .08
total_steps: 50000
warmup_learning_rate: .026666
warmup_steps: 1000
}
}
momentum_optimizer_value: 0.9
}
use_moving_average: false
}
max_number_of_Boxes: 100
unpad_groundtruth_tensors: false
}
train_input_reader: {
label_map_path: "D:/me1eye/New folder/29082020/models/research/object_detection/labelmap.pbtxt"
tf_record_input_reader {
input_path: "D:/me1eye/New folder/29082020/models/research/object_detection/train.record"
}
}
eval_config: {
metrics_set: "coco_detection_metrics"
use_moving_averages: false
}
eval_input_reader: {
label_map_path: "D:/me1eye/New folder/29082020/models/research/object_detection/labelmap.pbtxt"
shuffle: false
num_epochs: 1
tf_record_input_reader {
input_path: "D:/me1eye/New folder/29082020/models/research/object_detection/test.record"
}
}
已安装软件包的列表:
Package Version
------------------------------- -------------------
absl-py 0.10.0
argon2-cffi 20.1.0
astor 0.8.1
astunparse 1.6.3
attrs 20.1.0
backcall 0.2.0
bleach 3.1.5
cachetools 4.1.1
certifi 2020.6.20
cffi 1.14.2
chardet 3.0.4
colorama 0.4.3
contextlib2 0.6.0.post1
cycler 0.10.0
Cython 0.29.21
dataclasses 0.7
decorator 4.4.2
defusedxml 0.6.0
dill 0.3.2
dm-tree 0.1.5
docutils 0.16
entrypoints 0.3
future 0.18.2
gast 0.2.2
gin-config 0.3.0
google-api-core 1.22.1
google-api-python-client 1.11.0
google-auth 1.21.0
google-auth-httplib2 0.0.4
google-auth-oauthlib 0.4.1
google-cloud-bigquery 1.27.2
google-cloud-core 1.4.1
google-crc32c 1.0.0
google-pasta 0.2.0
google-resumable-media 1.0.0
googleapis-common-protos 1.52.0
grpcio 1.31.0
h5py 2.10.0
httplib2 0.18.1
idna 2.10
importlib-Metadata 1.7.0
ipykernel 5.3.4
ipython 7.16.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.17.2
Jinja2 2.11.2
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 6.1.7
jupyter-console 6.2.0
jupyter-core 4.6.3
kaggle 1.5.6
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.2
keyring 21.3.1
kiwisolver 1.2.0
lxml 4.5.2
Markdown 3.2.2
MarkupSafe 1.1.1
matplotlib 3.3.1
mistune 0.8.4
nbconvert 5.6.1
nbformat 5.0.7
notebook 6.1.3
numpy 1.18.5
oauthlib 3.1.0
opencv-python-headless 4.4.0.42
opt-einsum 3.3.0
packaging 20.4
pandas 1.1.1
pandocfilters 1.4.2
parso 0.7.1
pickleshare 0.7.5
Pillow 7.2.0
pip 20.2.2
pkginfo 1.5.0.1
prometheus-client 0.8.0
promise 2.3
prompt-toolkit 3.0.6
protobuf 3.13.0
psutil 5.7.2
py-cpuinfo 7.0.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycocotools-windows 2.0.0.2
pycparser 2.20
Pygments 2.6.1
pyparsing 2.4.7
pyrsistent 0.16.0
python-dateutil 2.8.1
python-slugify 4.0.1
pytz 2020.1
pywin32 228
pywin32-ctypes 0.2.0
pywinpty 0.5.7
PyYAML 5.3.1
pyzmq 19.0.2
qtconsole 4.7.6
qtpy 1.9.0
readme-renderer 26.0
requests 2.24.0
requests-oauthlib 1.3.0
requests-toolbelt 0.9.1
rfc3986 1.4.0
rsa 4.6
scipy 1.4.1
Send2Trash 1.5.0
sentencepiece 0.1.91
setuptools 49.6.0.post20200814
six 1.15.0
tensorboard 1.15.0
tensorboard-plugin-wit 1.7.0
tensorflow 1.15.0
tensorflow-addons 0.11.2
tensorflow-datasets 3.2.1
tensorflow-estimator 1.15.1
tensorflow-hub 0.9.0
tensorflow-Metadata 0.23.0
tensorflow-model-optimization 0.4.1
tensorflow-object-detection-api 0.1.1
termcolor 1.1.0
terminado 0.8.3
testpath 0.4.4
text-unidecode 1.3
tf-models-official 2.3.0
tf-slim 1.1.0
tornado 6.0.4
tqdm 4.48.2
traitlets 4.3.3
twine 3.2.0
typeguard 2.9.1
uritemplate 3.0.1
urllib3 1.24.3
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 1.0.1
wheel 0.35.1
widgetsnbextension 3.5.1
wincertstore 0.2
wrapt 1.12.1
zipp 3.1.0
Traceback (most recent call last):
File "train.py",line 184,in <module>
tf.app.run()
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\tensorflow_core\python\platform\app.py",line 40,in run
_run(main=main,argv=argv,flags_parser=_parse_flags_tolerate_undef)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\absl\app.py",line 300,in run
_run_main(main,args)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\absl\app.py",line 251,in _run_main
sys.exit(main(argv))
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\tensorflow_core\python\util\deprecation.py",line 324,in new_func
return func(*args,**kwargs)
File "train.py",line 93,in main
FLAGS.pipeline_config_path)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\object_detection\utils\config_util.py",line 98,in get_configs_from_pipeline_file
text_format.Merge(proto_str,pipeline_config)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\google\protobuf\text_format.py",line 734,in Merge
allow_unkNown_field=allow_unkNown_field)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\google\protobuf\text_format.py",line 802,in MergeLines
return parser.MergeLines(lines,message)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\google\protobuf\text_format.py",line 827,in MergeLines
self._ParSEOrMerge(lines,line 849,in _ParSEOrMerge
self._MergeField(tokenizer,line 974,in _MergeField
merger(tokenizer,message,field)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\google\protobuf\text_format.py",line 1048,in _MergeMessageField
self._MergeField(tokenizer,sub_message)
File "D:\me1eye\New folder\Anaconda3\envs\29082020\lib\site-packages\google\protobuf\text_format.py",line 941,in _MergeField
(message_descriptor.full_name,name))
google.protobuf.text_format.ParseError: 141:3 : Message type "object_detection.protos.TrainConfig" has no field named "fine_tune_checkpoint_version".
解决方法
删除配置文件中的“fine_tune_checkpoint_version: V2”。