public void MergeFrom(DetectionModel other) { if (other == null) { return; } switch (other.ModelCase) { case ModelOneofCase.FasterRcnn: if (FasterRcnn == null) { FasterRcnn = new global::Tensorflow.Models.ObjectDetection.Protos.FasterRcnn(); } FasterRcnn.MergeFrom(other.FasterRcnn); break; case ModelOneofCase.Ssd: if (Ssd == null) { Ssd = new global::Tensorflow.Models.ObjectDetection.Protos.Ssd(); } Ssd.MergeFrom(other.Ssd); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public override int GetHashCode() { int hash = 1; if (modelCase_ == ModelOneofCase.FasterRcnn) { hash ^= FasterRcnn.GetHashCode(); } if (modelCase_ == ModelOneofCase.Ssd) { hash ^= Ssd.GetHashCode(); } hash ^= (int)modelCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Builds a Faster R-CNN or R-FCN detection model based on the model config. /// </summary> /// <param name="frcnn_config"></param> /// <param name="is_training"></param> /// <param name="add_summaries"></param> /// <returns>FasterRCNNMetaArch based on the config.</returns> private FasterRCNNMetaArch _build_faster_rcnn_model(FasterRcnn frcnn_config, bool is_training, bool add_summaries) { var num_classes = frcnn_config.NumClasses; var image_resizer_fn = _image_resizer_builder.build(frcnn_config.ImageResizer); var feature_extractor = _build_faster_rcnn_feature_extractor(frcnn_config.FeatureExtractor, is_training, inplace_batchnorm_update: frcnn_config.InplaceBatchnormUpdate); var number_of_stages = frcnn_config.NumberOfStages; var first_stage_anchor_generator = anchor_generator_builder.build(frcnn_config.FirstStageAnchorGenerator); var first_stage_atrous_rate = frcnn_config.FirstStageAtrousRate; return(new FasterRCNNMetaArch(new FasterRCNNInitArgs { is_training = is_training, num_classes = num_classes, image_resizer_fn = image_resizer_fn, feature_extractor = _feature_extractor, number_of_stage = number_of_stages, first_stage_anchor_generator = null, first_stage_atrous_rate = first_stage_atrous_rate })); }