在Colab笔记本中运行model_main.py脚本时出现以下错误。
I0615 10:47:44.585545 139791270102912 basic_session_run_hooks.py:262] loss = 36.265278, step = 0
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node __inference_Dataset_map_transform_and_pad_input_data_fn_1404}} assertion failed: [[0.3875]] [[0.375]]
[[{{node Assert/AssertGuard/else/_25/Assert}}]]
[[IteratorGetNext]]
有时模型训练最多进行1000步,而其他时候则立即失败。
我一直在尝试研究错误function_node __inference_Dataset_map_transform_and_pad_input_data_fn_1404
,但无济于事。
我曾尝试对 pipeline.config 进行各种更改,尽管之前的尝试是在另一种经过预先训练的模型上进行的,但之前的尝试已经成功地完成了几千步。
有什么想法吗?
这是管道
<code>
model {
ssd {
num_classes: 2
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
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: false
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
num_layers: 6
min_scale: 0.1
max_scale: 0.5
aspect_ratios: 0.3333
}
}
box_predictor {
convolutional_box_predictor {
min_depth: 0
max_depth: 0
num_layers_before_predictor: 0
use_dropout: false
dropout_keep_probability: 0.8
kernel_size: 3
box_code_size: 4
apply_sigmoid_to_scores: false
conv_hyperparams {
activation: RELU_6,
regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
truncated_normal_initializer {
stddev: 0.03
mean: 0.0
}
}
batch_norm {
decay: 0.999700009823
center: true
scale: true
epsilon: 0.0010000000475
train: true
}
}
min_depth: 0
max_depth: 0
num_layers_before_predictor: 0
use_dropout: false
kernel_size: 3
box_code_size: 4
apply_sigmoid_to_scores: false
}
}
feature_extractor {
type: 'ssd_mobilenet_v2'
min_depth: 16
depth_multiplier: 1.0
use_depthwise: true
conv_hyperparams {
activation: RELU_6,
regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
truncated_normal_initializer {
stddev: 0.03
mean: 0.0
}
}
batch_norm {
train: true,
scale: true,
center: true,
decay: 0.9997,
epsilon: 0.001,
}
}
override_base_feature_extractor_hyperparams: true
}
loss {
classification_loss {
weighted_sigmoid {
}
}
}
normalize_loss_by_num_matches: true
loss {
localization_loss {
weighted_smooth_l1 {
}
}
classification_loss {
weighted_sigmoid {
}
}
hard_example_miner {
num_hard_examples: 3000
iou_threshold: 0.990000009537
loss_type: CLASSIFICATION
max_negatives_per_positive: 3
min_negatives_per_image: 3
}
classification_weight: 1.0
localization_weight: 1.0
}
normalize_loss_by_num_matches: true
post_processing {
batch_non_max_suppression {
score_threshold: 1e-8
iou_threshold: 0.6
max_detections_per_class: 5
max_total_detections: 10
}
}
}
}
train_config {
batch_size: 8
data_augmentation_options {
random_horizontal_flip {
keypoint_flip_permutation: 1
keypoint_flip_permutation: 0
keypoint_flip_permutation: 2
keypoint_flip_permutation: 3
keypoint_flip_permutation: 5
keypoint_flip_permutation: 4
}
}
optimizer {
rms_prop_optimizer {
learning_rate {
exponential_decay_learning_rate {
initial_learning_rate: 0.00400000018999
decay_steps: 800720
decay_factor: 0.949999988079
}
}
momentum_optimizer_value: 0.899999976158
decay: 0.899999976158
epsilon: 1.0
}
}
fine_tune_checkpoint: "/content/models/facessd_mobilenet_v2_quantized_320x320_open_image_v4/model.ckpt"
fine_tune_checkpoint_type: "detection"
from_detection_checkpoint: true
num_steps: 50000
}
train_input_reader {
label_map_path: "/content/tensorflow/workspace/dataset/prepared/record/label_map.pbtxt"
tf_record_input_reader {
input_path: "/content/tensorflow/workspace/dataset/prepared/record/train.record"
}
}
eval_config {
metrics_set: "coco_detection_metrics"
use_moving_averages: false
num_examples: 185
max_evals: 10
}
eval_input_reader {
label_map_path: "/content/tensorflow/workspace/dataset/prepared/record/label_map.pbtxt"
shuffle: false
num_readers: 1
tf_record_input_reader {
input_path: "/content/tensorflow/workspace/dataset/prepared/record/test.record"
}
}
graph_rewriter {
quantization {
delay: 500000
weight_bits: 8
activation_bits: 8
}
}
答案 0 :(得分:0)
事实证明,训练数据的边界框中存在错误。我更正了这些错误,现在可以进行培训。始终检查您的数据!