// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Yolo2CoCoSettings yolo2CoCoSettings = Configuration.GetSection("Yolo2CocoSettings").Get <Yolo2CoCoSettings>(); services.AddControllers(); services.AddTransient <IYoloInferenceService>(x => new YoloInferenceService(yolo2CoCoSettings)); }
/// <summary> /// Default Constructor /// </summary> /// <param name="modelPath">Relative path to the onnx model file</param> public YoloInferenceService(Yolo2CoCoSettings yolo2CoCoSettings) { _yolo2CoCoSettings = yolo2CoCoSettings; _inferenceSession = new InferenceSession(_yolo2CoCoSettings.Model, new SessionOptions()); }