You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
7.0 KiB

6 years ago
  1. syntax = "proto2";
  2. package object_detection.protos;
  3. import "object_detection/protos/hyperparams.proto";
  4. // Configuration proto for box predictor. See core/box_predictor.py for details.
  5. message BoxPredictor {
  6. oneof box_predictor_oneof {
  7. ConvolutionalBoxPredictor convolutional_box_predictor = 1;
  8. MaskRCNNBoxPredictor mask_rcnn_box_predictor = 2;
  9. RfcnBoxPredictor rfcn_box_predictor = 3;
  10. WeightSharedConvolutionalBoxPredictor
  11. weight_shared_convolutional_box_predictor = 4;
  12. }
  13. }
  14. // Configuration proto for Convolutional box predictor.
  15. // Next id: 13
  16. message ConvolutionalBoxPredictor {
  17. // Hyperparameters for convolution ops used in the box predictor.
  18. optional Hyperparams conv_hyperparams = 1;
  19. // Minimum feature depth prior to predicting box encodings and class
  20. // predictions.
  21. optional int32 min_depth = 2 [default = 0];
  22. // Maximum feature depth prior to predicting box encodings and class
  23. // predictions. If max_depth is set to 0, no additional feature map will be
  24. // inserted before location and class predictions.
  25. optional int32 max_depth = 3 [default = 0];
  26. // Number of the additional conv layers before the predictor.
  27. optional int32 num_layers_before_predictor = 4 [default = 0];
  28. // Whether to use dropout for class prediction.
  29. optional bool use_dropout = 5 [default = true];
  30. // Keep probability for dropout
  31. optional float dropout_keep_probability = 6 [default = 0.8];
  32. // Size of final convolution kernel. If the spatial resolution of the feature
  33. // map is smaller than the kernel size, then the kernel size is set to
  34. // min(feature_width, feature_height).
  35. optional int32 kernel_size = 7 [default = 1];
  36. // Size of the encoding for boxes.
  37. optional int32 box_code_size = 8 [default = 4];
  38. // Whether to apply sigmoid to the output of class predictions.
  39. // TODO(jonathanhuang): Do we need this since we have a post processing
  40. // module.?
  41. optional bool apply_sigmoid_to_scores = 9 [default = false];
  42. optional float class_prediction_bias_init = 10 [default = 0.0];
  43. // Whether to use depthwise separable convolution for box predictor layers.
  44. optional bool use_depthwise = 11 [default = false];
  45. }
  46. // Configuration proto for weight shared convolutional box predictor.
  47. // Next id: 18
  48. message WeightSharedConvolutionalBoxPredictor {
  49. // Hyperparameters for convolution ops used in the box predictor.
  50. optional Hyperparams conv_hyperparams = 1;
  51. // Number of the additional conv layers before the predictor.
  52. optional int32 num_layers_before_predictor = 4 [default = 0];
  53. // Output depth for the convolution ops prior to predicting box encodings
  54. // and class predictions.
  55. optional int32 depth = 2 [default = 0];
  56. // Size of final convolution kernel. If the spatial resolution of the feature
  57. // map is smaller than the kernel size, then the kernel size is set to
  58. // min(feature_width, feature_height).
  59. optional int32 kernel_size = 7 [default = 3];
  60. // Size of the encoding for boxes.
  61. optional int32 box_code_size = 8 [default = 4];
  62. // Bias initialization for class prediction. It has been show to stabilize
  63. // training where there are large number of negative boxes. See
  64. // https://arxiv.org/abs/1708.02002 for details.
  65. optional float class_prediction_bias_init = 10 [default = 0.0];
  66. // Whether to use dropout for class prediction.
  67. optional bool use_dropout = 11 [default = false];
  68. // Keep probability for dropout.
  69. optional float dropout_keep_probability = 12 [default = 0.8];
  70. // Whether to share the multi-layer tower between box prediction and class
  71. // prediction heads.
  72. optional bool share_prediction_tower = 13 [default = false];
  73. // Whether to use depthwise separable convolution for box predictor layers.
  74. optional bool use_depthwise = 14 [default = false];
  75. // Enum to specify how to convert the detection scores at inference time.
  76. enum ScoreConverter {
  77. // Input scores equals output scores.
  78. IDENTITY = 0;
  79. // Applies a sigmoid on input scores.
  80. SIGMOID = 1;
  81. }
  82. // Callable elementwise score converter at inference time.
  83. optional ScoreConverter score_converter = 16 [default = IDENTITY];
  84. // If specified, apply clipping to box encodings.
  85. message BoxEncodingsClipRange {
  86. optional float min = 1;
  87. optional float max = 2;
  88. }
  89. optional BoxEncodingsClipRange box_encodings_clip_range = 17;
  90. }
  91. // TODO(alirezafathi): Refactor the proto file to be able to configure mask rcnn
  92. // head easily.
  93. // Next id: 15
  94. message MaskRCNNBoxPredictor {
  95. // Hyperparameters for fully connected ops used in the box predictor.
  96. optional Hyperparams fc_hyperparams = 1;
  97. // Whether to use dropout op prior to the both box and class predictions.
  98. optional bool use_dropout = 2 [default = false];
  99. // Keep probability for dropout. This is only used if use_dropout is true.
  100. optional float dropout_keep_probability = 3 [default = 0.5];
  101. // Size of the encoding for the boxes.
  102. optional int32 box_code_size = 4 [default = 4];
  103. // Hyperparameters for convolution ops used in the box predictor.
  104. optional Hyperparams conv_hyperparams = 5;
  105. // Whether to predict instance masks inside detection boxes.
  106. optional bool predict_instance_masks = 6 [default = false];
  107. // The depth for the first conv2d_transpose op applied to the
  108. // image_features in the mask prediction branch. If set to 0, the value
  109. // will be set automatically based on the number of channels in the image
  110. // features and the number of classes.
  111. optional int32 mask_prediction_conv_depth = 7 [default = 256];
  112. // Whether to predict keypoints inside detection boxes.
  113. optional bool predict_keypoints = 8 [default = false];
  114. // The height and the width of the predicted mask.
  115. optional int32 mask_height = 9 [default = 15];
  116. optional int32 mask_width = 10 [default = 15];
  117. // The number of convolutions applied to image_features in the mask prediction
  118. // branch.
  119. optional int32 mask_prediction_num_conv_layers = 11 [default = 2];
  120. optional bool masks_are_class_agnostic = 12 [default = false];
  121. // Whether to use one box for all classes rather than a different box for each
  122. // class.
  123. optional bool share_box_across_classes = 13 [default = false];
  124. // Whether to apply convolutions on mask features before upsampling using
  125. // nearest neighbor resizing.
  126. // By default, mask features are resized to [`mask_height`, `mask_width`]
  127. // before applying convolutions and predicting masks.
  128. optional bool convolve_then_upsample_masks = 14 [default = false];
  129. }
  130. message RfcnBoxPredictor {
  131. // Hyperparameters for convolution ops used in the box predictor.
  132. optional Hyperparams conv_hyperparams = 1;
  133. // Bin sizes for RFCN crops.
  134. optional int32 num_spatial_bins_height = 2 [default = 3];
  135. optional int32 num_spatial_bins_width = 3 [default = 3];
  136. // Target depth to reduce the input image features to.
  137. optional int32 depth = 4 [default = 1024];
  138. // Size of the encoding for the boxes.
  139. optional int32 box_code_size = 5 [default = 4];
  140. // Size to resize the rfcn crops to.
  141. optional int32 crop_height = 6 [default = 12];
  142. optional int32 crop_width = 7 [default = 12];
  143. }