|
| 1 | +# Faster R-CNN with NASNet-A featurization |
| 2 | +# Configured for MSCOCO Dataset. |
| 3 | +# Users should configure the fine_tune_checkpoint field in the train config as |
| 4 | +# well as the label_map_path and input_path fields in the train_input_reader and |
| 5 | +# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that |
| 6 | +# should be configured. |
| 7 | +model { |
| 8 | + faster_rcnn { |
| 9 | + num_classes: 90 |
| 10 | + image_resizer { |
| 11 | + # TODO: Only fixed_shape_resizer is currently supported for NASNet |
| 12 | + # featurization. The reason for this is that nasnet.py only supports |
| 13 | + # inputs with fully known shapes. We need to update nasnet.py to handle |
| 14 | + # shapes not known at compile time. |
| 15 | + fixed_shape_resizer { |
| 16 | + height: 1200 |
| 17 | + width: 1200 |
| 18 | + } |
| 19 | + } |
| 20 | + feature_extractor { |
| 21 | + type: 'faster_rcnn_nas' |
| 22 | + } |
| 23 | + first_stage_anchor_generator { |
| 24 | + grid_anchor_generator { |
| 25 | + scales: [0.25, 0.5, 1.0, 2.0] |
| 26 | + aspect_ratios: [0.5, 1.0, 2.0] |
| 27 | + height_stride: 16 |
| 28 | + width_stride: 16 |
| 29 | + } |
| 30 | + } |
| 31 | + first_stage_box_predictor_conv_hyperparams { |
| 32 | + op: CONV |
| 33 | + regularizer { |
| 34 | + l2_regularizer { |
| 35 | + weight: 0.0 |
| 36 | + } |
| 37 | + } |
| 38 | + initializer { |
| 39 | + truncated_normal_initializer { |
| 40 | + stddev: 0.01 |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | + first_stage_nms_score_threshold: 0.0 |
| 45 | + first_stage_nms_iou_threshold: 0.7 |
| 46 | + first_stage_max_proposals: 50 |
| 47 | + first_stage_localization_loss_weight: 2.0 |
| 48 | + first_stage_objectness_loss_weight: 1.0 |
| 49 | + initial_crop_size: 17 |
| 50 | + maxpool_kernel_size: 1 |
| 51 | + maxpool_stride: 1 |
| 52 | + second_stage_box_predictor { |
| 53 | + mask_rcnn_box_predictor { |
| 54 | + use_dropout: false |
| 55 | + dropout_keep_probability: 1.0 |
| 56 | + fc_hyperparams { |
| 57 | + op: FC |
| 58 | + regularizer { |
| 59 | + l2_regularizer { |
| 60 | + weight: 0.0 |
| 61 | + } |
| 62 | + } |
| 63 | + initializer { |
| 64 | + variance_scaling_initializer { |
| 65 | + factor: 1.0 |
| 66 | + uniform: true |
| 67 | + mode: FAN_AVG |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + second_stage_post_processing { |
| 74 | + batch_non_max_suppression { |
| 75 | + score_threshold: 0.0 |
| 76 | + iou_threshold: 0.6 |
| 77 | + max_detections_per_class: 100 |
| 78 | + max_total_detections: 100 |
| 79 | + } |
| 80 | + score_converter: SOFTMAX |
| 81 | + } |
| 82 | + second_stage_localization_loss_weight: 2.0 |
| 83 | + second_stage_classification_loss_weight: 1.0 |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +train_config: { |
| 88 | + batch_size: 1 |
| 89 | + optimizer { |
| 90 | + momentum_optimizer: { |
| 91 | + learning_rate: { |
| 92 | + manual_step_learning_rate { |
| 93 | + initial_learning_rate: 0.0003 |
| 94 | + schedule { |
| 95 | + step: 0 |
| 96 | + learning_rate: .0003 |
| 97 | + } |
| 98 | + schedule { |
| 99 | + step: 900000 |
| 100 | + learning_rate: .00003 |
| 101 | + } |
| 102 | + schedule { |
| 103 | + step: 1200000 |
| 104 | + learning_rate: .000003 |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + momentum_optimizer_value: 0.9 |
| 109 | + } |
| 110 | + use_moving_average: false |
| 111 | + } |
| 112 | + gradient_clipping_by_norm: 10.0 |
| 113 | + fine_tune_checkpoint: "PATH_TO_BE_CONFIGURED/model.ckpt" |
| 114 | + from_detection_checkpoint: true |
| 115 | + # Note: The below line limits the training process to 200K steps, which we |
| 116 | + # empirically found to be sufficient enough to train the pets dataset. This |
| 117 | + # effectively bypasses the learning rate schedule (the learning rate will |
| 118 | + # never decay). Remove the below line to train indefinitely. |
| 119 | + num_steps: 200000 |
| 120 | + data_augmentation_options { |
| 121 | + random_horizontal_flip { |
| 122 | + } |
| 123 | + } |
| 124 | +} |
| 125 | + |
| 126 | +train_input_reader: { |
| 127 | + tf_record_input_reader { |
| 128 | + input_path: "PATH_TO_BE_CONFIGURED/mscoco_train.record" |
| 129 | + } |
| 130 | + label_map_path: "PATH_TO_BE_CONFIGURED/mscoco_label_map.pbtxt" |
| 131 | +} |
| 132 | + |
| 133 | +eval_config: { |
| 134 | + metrics_set: "pascal_voc_metrics" |
| 135 | + num_examples: 8000 |
| 136 | + # Note: The below line limits the evaluation process to 10 evaluations. |
| 137 | + # Remove the below line to evaluate indefinitely. |
| 138 | + max_evals: 10} |
| 139 | + |
| 140 | +eval_input_reader: { |
| 141 | + tf_record_input_reader { |
| 142 | + input_path: "PATH_TO_BE_CONFIGURED/mscoco_val.record" |
| 143 | + } |
| 144 | + label_map_path: "PATH_TO_BE_CONFIGURED/mscoco_label_map.pbtxt" |
| 145 | + shuffle: false |
| 146 | + num_readers: 1 |
| 147 | + num_epochs: 1 |
| 148 | +} |
0 commit comments