public Task <Xtruct> testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) { logger.Invoke("testMultiException({0}, {1})", arg0, arg1); if (arg0 == "Xception") { var x = new Xception { ErrorCode = 1001, Message = "This is an Xception" }; throw x; } if (arg0 == "Xception2") { var x = new Xception2 { ErrorCode = 2002, Struct_thing = new Xtruct { String_thing = "This is an Xception2" } }; throw x; } var result = new Xtruct { String_thing = arg1 }; return(Task.FromResult(result)); }
public void testException(string arg) { Console.WriteLine("testException(" + arg + ")"); if (arg == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = "This is an Xception"; throw x; } return; }
/** * Print 'testException(%s)' with arg as '%s' * @param string arg - a string indication what type of exception to throw * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg * elsen if arg == "TException" throw TException * else do not throw anything */ public void testException(string arg) { testLogDelegate.Invoke("testException({0})", arg); if (arg == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = arg; throw x; } if (arg == "TException") { throw new Thrift.TException(); } return; }
/** * Print 'testException(%s)' with arg as '%s' * @param string arg - a string indication what type of exception to throw * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg * elsen if arg == "TException" throw TException * else do not throw anything */ public void testException(string arg) { Console.WriteLine("testException(" + arg + ")"); if (arg == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = arg; throw x; } if (arg == "TException") { throw new Thrift.TException(); } return; }
public static void Run() { var model = new Xception(weights: "imagenet"); string img_path = "./img/elephant.jpg"; var img = ImageUtil.LoadImg(img_path, target_size: (299, 299)); var x = ImageUtil.ImageToArray(img); x = np.expand_dims(x, axis: 0); x = model.PreprocessInput(x); var preds = model.Predict(x); var predictions = model.DecodePredictions(preds, top: 2); foreach (ImageNetPrediction item in predictions) { Console.WriteLine("Name: {0}, Acc: {1}", item.Word, item.PredictedValue); } }
public Task testExceptionAsync(string arg, CancellationToken cancellationToken) { logger.Invoke("testException({0})", arg); if (arg == "Xception") { var x = new Xception { ErrorCode = 1001, Message = arg }; throw x; } if (arg == "TException") { throw new TException(); } return(Task.CompletedTask); }
public Xtruct testMultiException(string arg0, string arg1) { Console.WriteLine("testMultiException(" + arg0 + ", " + arg1 + ")"); if (arg0 == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = "This is an Xception"; throw x; } else if (arg0 == "Xception2") { Xception2 x = new Xception2(); x.ErrorCode = 2002; x.Struct_thing = new Xtruct(); x.Struct_thing.String_thing = "This is an Xception2"; throw x; } Xtruct result = new Xtruct(); result.String_thing = arg1; return(result); }
public Xtruct testMultiException(string arg0, string arg1) { testLogDelegate.Invoke("testMultiException({0}, {1})", arg0, arg1); if (arg0 == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = "This is an Xception"; throw x; } else if (arg0 == "Xception2") { Xception2 x = new Xception2(); x.ErrorCode = 2002; x.Struct_thing = new Xtruct(); x.Struct_thing.String_thing = "This is an Xception2"; throw x; } Xtruct result = new Xtruct(); result.String_thing = arg1; return(result); }
static void Main(string[] args) { //ResNet50 { Console.WriteLine("ResNet50..."); var net = new ResNet50("ResNet50.dat"); float[,,] img = NetUtils.PrepareImageResNet("test_dog.png"); Stopwatch time_measure = new Stopwatch(); time_measure.Start(); float[] prediction = net.Process(img); time_measure.Stop(); Console.WriteLine("Time: " + (time_measure.ElapsedMilliseconds / 1000.0).ToString("0.000") + " s"); Console.WriteLine("Top 3 results: " + string.Join(", ", NetUtils.DecodeImageNetResult(prediction, 3))); Console.WriteLine("--------------\n"); } //InceptionV3 { Console.WriteLine("InceptionV3..."); var net = new InceptionV3("InceptionV3.dat"); float[,,] img = NetUtils.PrepareImageInceptionV3("test_dog.png"); Stopwatch time_measure = new Stopwatch(); time_measure.Start(); float[] prediction = net.Process(img); time_measure.Stop(); Console.WriteLine("Time: " + (time_measure.ElapsedMilliseconds / 1000.0).ToString("0.000") + " s"); Console.WriteLine("Top 3 results: " + string.Join(", ", NetUtils.DecodeImageNetResult(prediction, 3))); Console.WriteLine("--------------\n"); } //MobileNet { Console.WriteLine("MobileNet..."); var net = new MobileNet("MobileNet.dat"); float[,,] img = NetUtils.PrepareImageMobileNet("test_dog.png"); Stopwatch time_measure = new Stopwatch(); time_measure.Start(); float[] prediction = net.Process(img); time_measure.Stop(); Console.WriteLine("Time: " + (time_measure.ElapsedMilliseconds / 1000.0).ToString("0.000") + " s"); Console.WriteLine("Top 3 results: " + string.Join(", ", NetUtils.DecodeImageNetResult(prediction, 3))); Console.WriteLine("--------------\n"); } // Xception { Console.WriteLine("Xception..."); var net = new Xception("Xception.dat"); float[,,] img = NetUtils.PrepareImageInceptionV3("test_dog.png"); Stopwatch time_measure = new Stopwatch(); time_measure.Start(); float[] prediction = net.Process(img); time_measure.Stop(); Console.WriteLine("Time: " + (time_measure.ElapsedMilliseconds / 1000.0).ToString("0.000") + " s"); Console.WriteLine("Top 3 results: " + string.Join(", ", NetUtils.DecodeImageNetResult(prediction, 3))); Console.WriteLine("--------------\n"); } Console.WriteLine("Press a key"); Console.ReadKey(); }
public Xtruct testMultiException(string arg0, string arg1) { testLogDelegate.Invoke("testMultiException({0}, {1})", arg0,arg1); if (arg0 == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = "This is an Xception"; throw x; } else if (arg0 == "Xception2") { Xception2 x = new Xception2(); x.ErrorCode = 2002; x.Struct_thing = new Xtruct(); x.Struct_thing.String_thing = "This is an Xception2"; throw x; } Xtruct result = new Xtruct(); result.String_thing = arg1; return result; }
public Task<Xtruct> testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken) { logger.Invoke("testMultiException({0}, {1})", arg0, arg1); if (arg0 == "Xception") { var x = new Xception { ErrorCode = 1001, Message = "This is an Xception" }; throw x; } if (arg0 == "Xception2") { var x = new Xception2 { ErrorCode = 2002, Struct_thing = new Xtruct { String_thing = "This is an Xception2" } }; throw x; } var result = new Xtruct { String_thing = arg1 }; return Task.FromResult(result); }
public Task testExceptionAsync(string arg, CancellationToken cancellationToken) { logger.Invoke("testException({0})", arg); if (arg == "Xception") { var x = new Xception { ErrorCode = 1001, Message = arg }; throw x; } if (arg == "TException") { throw new TException(); } return Task.CompletedTask; }
public Xtruct testMultiException(string arg0, string arg1) { Console.WriteLine("testMultiException(" + arg0 + ", " + arg1 + ")"); if (arg0 == "Xception") { Xception x = new Xception(); x.ErrorCode = 1001; x.Message = "This is an Xception"; throw x; } else if (arg0 == "Xception2") { Xception2 x = new Xception2(); x.ErrorCode = 2002; x.Struct_thing = new Xtruct(); x.Struct_thing.String_thing = "This is an Xception2"; throw x; } Xtruct result = new Xtruct(); result.String_thing = arg1; return result; }