我正在使用ssd_mobilenet_v1_coco.config和
在计划培训后添加13件事后,我将num_classes的值更改为20
python model_main.py --alsologtostderr --model_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config
我一直尝试学习该命令,但出现错误。增加num_classes我应该怎么做?我应该从头开始抓起num_classes = 100吗?我需要帮助。
model {
ssd {
num_classes: 20
box_coder {
faster_rcnn_box_coder {
y_scale: 10.0
x_scale: 10.0
height_scale: 5.0
width_scale: 5.0
}
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/training/saver.py", line 1326, in restore
err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Assign requires shapes of both tensors to match. lhs shape= [126] rhs shape= [84]
[[node save/Assign_56 (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]
我最近有一个类似的问题。为了解决我的问题,我必须执行以下操作:
python research/object_detection/model_main.py \
--model_dir=./model/finetune0 \
--pipeline_config_path=./model/pipeline.config \
--alsologtostderr
我的文件结构:
+ models
-+ model
--+ checkpoint
--+ model.ckpt.index
--+ model.ckpt.meta
--+ model.ckpt.data-00000-of-00001
--+ pipeline.config
--- finetune0 (will be autogenerated)
-- data (tfrecord dataset)
-- annotations (labels)
...
看起来当您在model_dir上已经有一个检查点时,脚本将尝试恢复对提供的模型的训练,但是pipeline.config上的新配置将与当前模型不匹配(num_class有所不同)。
如果你提供这个检查点的fine_tune_checkpoint和点model_dir到一个新的文件夹,将建立从检查点变量模型,调整以匹配新的配置,然后开始训练。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句