using System; using System.Collections.Generic; using System.Text; using Tensorflow.Models.ObjectDetection.MetaArchitectures; using Tensorflow.Models.ObjectDetection.Protos; using static Tensorflow.Models.ObjectDetection.Protos.DetectionModel; namespace Tensorflow.Models.ObjectDetection { public class ModelBuilder { ImageResizerBuilder image_resizer_builder; public ModelBuilder() { image_resizer_builder = new ImageResizerBuilder(); } /// /// Builds a DetectionModel based on the model config. /// /// A model.proto object containing the config for the desired DetectionModel. /// True if this model is being built for training purposes. /// Whether to add tensorflow summaries in the model graph. /// DetectionModel based on the config. public FasterRCNNMetaArch build(DetectionModel model_config, bool is_training, bool add_summaries = true) { var meta_architecture = model_config.ModelCase; if (meta_architecture == ModelOneofCase.Ssd) throw new NotImplementedException(""); else if (meta_architecture == ModelOneofCase.FasterRcnn) return _build_faster_rcnn_model(model_config.FasterRcnn, is_training, add_summaries); throw new ValueError($"Unknown meta architecture: {meta_architecture}"); } /// /// Builds a Faster R-CNN or R-FCN detection model based on the model config. /// /// /// /// /// FasterRCNNMetaArch based on the config. 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); throw new NotImplementedException(""); } public Action preprocess() { throw new NotImplementedException(""); } } }