简体   繁体   English

训练时 Tensorflow 不兼容的形状错误

[英]Tensorflow Incompatible shapes error while training

I have been training an object detector, was able to do this successfully with 1 class, now I have added 2 classes and a few more images to the dataset, I have regenerated xml to csv and tf records by deleting old ones, pbtxt file is correct and also deleted old checkpoints inside the training directory but when I run the training job like this:我一直在训练一个对象检测器,能够用 1 个类成功地做到这一点,现在我已经向数据集中添加了 2 个类和更多的图像,我通过删除旧记录将 xml 重新生成为 csv 和 tf 记录,pbtxt 文件是正确并删除了训练目录中的旧检查点,但是当我像这样运行训练作业时:

python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

following this tutorial .遵循本教程 I get the following error:我收到以下错误:

InvalidArgumentError (see above for traceback): Incompatible shapes: [2,1917] vs. [4,1]
 [[Node: Loss/Match/cond/mul_4 = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Loss/Match/cond/one_hot, Loss/Match/cond/Cast_2)]]

If you are training Mobilenet SSD following the Obstacle Detection API tutorial you could try commenting out the "ssd_random_crop" augmentation in your config file.如果您正在按照障碍检测 API 教程训练 Mobilenet SSD,您可以尝试在配置文件中注释掉“ssd_random_crop”增强。 This worked for me.这对我有用。 Was initially pointed out by rky0930 here .最初是由 rky0930在这里指出的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM