簡體   English   中英

TensorFlow對象檢測API訓練錯誤

[英]TensorFlow Object Detection API training error

嗨,我在Anaconda提示符下執行以下命令:(tensorflow) C:\\Users\\nicho\\Documents\\01_Machine_Learning\\00_Lynda.com\\Ex_Files_TensorFlow\\models\\research\\object_detection> python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

我在自定義標記“列”對象的自定義數據集上訓練模型。 為了確保我的所有步驟正確無誤,我已經反復閱讀了教程,但是我似乎仍然遇到以下錯誤,對於如何解決的任何提示,將不勝感激嗎?:

WARNING:tensorflow:From C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\trainer.py:210: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
Traceback (most recent call last):
  File "train.py", line 163, in <module>
    tf.app.run()
  File "C:\Users\nicho\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
    _sys.exit(main(argv))
  File "train.py", line 159, in main
    worker_job_name, is_chief, FLAGS.train_dir)
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\trainer.py", line 228, in train
    clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue])
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\slim\deployment\model_deploy.py", line 193, in create_clones
    outputs = model_fn(*args, **kwargs)
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\trainer.py", line 167, in _create_losses
    losses_dict = detection_model.loss(prediction_dict)
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\meta_architectures\ssd_meta_arch.py", line 474, in loss
    location_losses, cls_losses, prediction_dict, match_list)
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\meta_architectures\ssd_meta_arch.py", line 640, in _apply_hard_mining
    match_list=match_list)
  File "C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection\core\losses.py", line 515, in __call__
    location_losses = tf.unstack(location_losses)
  File "C:\Users\nicho\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1054, in unstack
    (axis, -value_shape.ndims, value_shape.ndims))
ValueError: axis = 0 not in [0, 0)

(tensorflow) C:\Users\nicho\Documents\01_Machine_Learning\00_Lynda.com\Ex_Files_TensorFlow\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.confi

G

您使用哪種型號? 您可以嘗試使用其他網絡進行培訓。 使用ssd_mobilenet_v1_coco和ssd_mobilenet_v1_coco.config時,我遇到了同樣的問題。 切換到ssd_mobilenet_v1_pets.config,它具有附加參數anchorwise_output,並且開始訓練。

問題解決了。 在您的pipeline.config中

loss {
classification_loss {
weighted_sigmoid {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
hard_example_miner {
num_hard_examples: 3000
iou_threshold: 0.99
loss_type: CLASSIFICATION
max_negatives_per_positive: 3
min_negatives_per_image: 0
}
classification_weight: 1.0
localization_weight: 1.0
}

loss {
classification_loss {
weighted_sigmoid {
anchorwise_output: true #add this
}
}
localization_loss {
weighted_smooth_l1 {
anchorwise_output: true #add this
}
}
hard_example_miner {
num_hard_examples: 3000
iou_threshold: 0.99
loss_type: CLASSIFICATION
max_negatives_per_positive: 3
min_negatives_per_image: 0
}
classification_weight: 1.0
localization_weight: 1.0
}

請享用...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM