TensorFlow对象检测SSD MobileNet V1没有在张量板上可视化的地面真相注释

时间:2019-12-20 22:04:15

标签: tensorflow object detection mobilenet

在训练ssd mobilenet时,我在每个评估点都得到了这一点:

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000

Tensorboard不会像地面真实注释那样在右侧图像上显示检测(边界框)。即使创建了tf记录,我也可以确认注释已被解析。我修改了create_tf_record.py来记录边界框:

I1220 15:44:48.170442 139795475470144 create_coco_tf_record.py:222] Found groundtruth annotations. Building annotations index.
I1220 15:44:48.170788 139795475470144 create_coco_tf_record.py:236] 0 images are missing annotations.
I1220 15:44:48.170870 139795475470144 create_coco_tf_record.py:241] On image 0 of 60
I1220 15:44:48.172753 139795475470144 create_coco_tf_record.py:137] [0.043229 0.083333 0.963889 0.998148]
I1220 15:44:48.172867 139795475470144 create_coco_tf_record.py:137] [0.329167 0.363021 0.922222 0.963889]

...

I1220 15:44:48.342363 139795475470144 create_coco_tf_record.py:249] Finished writing, skipped 0 annotations.

我尝试过不同版本的tensorflow,1.12、1.14、1.13。我尝试了不同版本的ssd / mobilenet,甚至还屏蔽了rcnn。我已经验证了json文件,据我了解,它们已正确转换为记录。

这是我的管道:

model {
  ssd {
    num_classes: 6 
    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
      }
    }
    similarity_calculator {
      iou_similarity {
      }
    }
    anchor_generator {
      ssd_anchor_generator {
        num_layers: 6
        min_scale: 0.1
        max_scale: 0.3
        aspect_ratios: 1.0
        aspect_ratios: 2.0
        aspect_ratios: 0.5
        aspect_ratios: 3.0
        aspect_ratios: 0.3333
      }
    }
    image_resizer {
      fixed_shape_resizer {
        height: 300
        width: 300
      }
    }
    box_predictor {
      convolutional_box_predictor {
        min_depth: 0
        max_depth: 0
        num_layers_before_predictor: 0
        use_dropout: true 
        dropout_keep_probability: 0.5
        kernel_size: 1
        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 {
            train: true,
            scale: true,
            center: true,
            decay: 0.9997,
            epsilon: 0.001,
          }
        }
      }
    }
    feature_extractor {
      type: 'ssd_mobilenet_v1'
      min_depth: 16
      depth_multiplier: 1.0
      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,
        }
      }
    }
    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
    }
    normalize_loss_by_num_matches: true
    post_processing {
      batch_non_max_suppression {
        score_threshold: 1e-8
        iou_threshold: 0.6
        max_detections_per_class: 50 
        max_total_detections: 50 
      }
      score_converter: SIGMOID
    }
  }
}

train_config: {
  batch_size: 32 
  optimizer {
    rms_prop_optimizer: {
      learning_rate: {
        exponential_decay_learning_rate {
          initial_learning_rate: 0.004
          decay_steps: 800720
          decay_factor: 0.95
        }
      }
      momentum_optimizer_value: 0.9
      decay: 0.9
      epsilon: 1.0
    }
  }
  fine_tune_checkpoint: "/home/ssd/model.ckpt"
  from_detection_checkpoint: true
  load_all_detection_checkpoint_vars: true
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
  data_augmentation_options {
    ssd_random_crop {
    }
  }
}

train_input_reader: {
  tf_record_input_reader {
    input_path: "/home/ssd/coco_train.record-00000-of-00001"
  }
  label_map_path: "/home/ssd/label_map.pbtxt"
}

eval_config: {
  metrics_set: "coco_detection_metrics"
  num_examples: 1100
}

eval_input_reader: {
  tf_record_input_reader {
    input_path: "/home/ssd/coco_val.record-00000-of-00001"
  }
  label_map_path: "/home/ssd/label_map.pbtxt"
  shuffle: false
  num_readers: 1
}

起初,我认为问题出在我的注释上,但是我已经使用COCO_Viewer来测试注释,并且可以正确查看它们。我还使用了自己的脚本,可以解析json并将边界框覆盖在图像源上。

这是我train.json https://pastebin.com/ymHS00iN

的粘贴框

我在培训ssd / mobilenet时从未遇到过如此麻烦,并且想看看是否有人遇到了这个问题,因为我完全感到困惑。任何想法/评论都欢迎:)

Tensorboard example, not displaying bounding boxes on ground truth data (right-side)

0 个答案:

没有答案