diff --git a/samples/c_cxx/fns_candy_style_transfer/fns_candy_style_transfer.c b/samples/c_cxx/fns_candy_style_transfer/fns_candy_style_transfer.c index 0e0acc96e4..07524e9eea 100644 --- a/samples/c_cxx/fns_candy_style_transfer/fns_candy_style_transfer.c +++ b/samples/c_cxx/fns_candy_style_transfer/fns_candy_style_transfer.c @@ -261,16 +261,16 @@ int main(int argc, char* argv[]) { if (execution_provider) { - if (tcscmp(execution_provider, ORT_TSTR("cpu"))) { + if (tcscmp(execution_provider, ORT_TSTR("cpu")) == 0) { // Nothing; this is the default - } else if (tcscmp(execution_provider, ORT_TSTR("cuda"))) { + } else if (tcscmp(execution_provider, ORT_TSTR("cuda")) == 0) { #ifdef USE_CUDA enable_cuda(session_options); #else puts("CUDA is not enabled in this build."); return -1; #endif - } else if (tcscmp(execution_provider, ORT_TSTR("dml"))) { + } else if (tcscmp(execution_provider, ORT_TSTR("dml")) == 0) { #ifdef USE_DML enable_dml(session_options); #else diff --git a/samples/c_cxx/imagenet/README.md b/samples/c_cxx/imagenet/README.md index ca494dc5ff..ab6a24365d 100644 --- a/samples/c_cxx/imagenet/README.md +++ b/samples/c_cxx/imagenet/README.md @@ -9,7 +9,7 @@ WARNING: If you want to train the model by yourself, you need at least 500GB dis # Install tensorflow Install Python 3.x from [python.org](https://www.python.org/), then execute ``` -pip install --upgrade tensorflow +pip install --upgrade tensorflow==1.14 ``` For more information, see [Install Tensorflow](https://www.tensorflow.org/install) @@ -36,10 +36,12 @@ tar -zxvf inception_v4_2016_09_09.tar.gz The [Inception V4] zip file only contains a single checkpoint file: inception_v4.ckpt. It can't be directly used for inferencing. You need to combine the network definition and the checkpoint. Please follow the steps below: -1. Export the graph -Create an new folder. At there, execute +1. Export the graph. ``` -git clone https://github.com/tensorflow/models . +git clone https://github.com/tensorflow/models +# Copy inception_v4.ckpt into models +cd models +# Ignore deprecation warnings python research\slim\export_inference_graph.py --model_name=inception_v4 --output_file=grpah.pb ``` @@ -56,6 +58,12 @@ pip install --upgrade tf2onnx python -m tf2onnx.convert --input inception_v4.pb --inputs input:0 --outputs InceptionV4/Logits/Predictions:0 --opset 10 --output inception_v4.onnx ``` +You should see messages like these: + +INFO - Successfully converted TensorFlow model inception_v4.pb to ONNX + +INFO - ONNX model is saved at inception_v4.onnx + # Run the inferencing In your build dir of onnxruntime_samples, search for "image_classifier.exe" and run ``` diff --git a/samples/c_cxx/imagenet/main.cc b/samples/c_cxx/imagenet/main.cc index cf3d54bcbc..e393ac89d1 100644 --- a/samples/c_cxx/imagenet/main.cc +++ b/samples/c_cxx/imagenet/main.cc @@ -124,11 +124,10 @@ class Validator : public OutputCollector { VerifyInputOutputCount(session_); Ort::AllocatorWithDefaultOptions ort_alloc; { - char* t; - session_.GetInputName(0, ort_alloc); + char* t = session_.GetInputName(0, ort_alloc); input_name_ = my_strdup(t); ort_alloc.Free(t); - session_.GetOutputName(0, ort_alloc); + t = session_.GetOutputName(0, ort_alloc); output_name_ = my_strdup(t); ort_alloc.Free(t); }