Skip to content

Commit afba506

Browse files
Tejal csharp changes (#466)
* Updated scripts for Openvino C_Sharp_samples * Modified samples with changes in device_type and updated README instructions --------- Co-authored-by: TejalKhade28 <tejal.khade@intel.com>
1 parent 0a4a4dd commit afba506

File tree

7 files changed

+12
-14
lines changed

7 files changed

+12
-14
lines changed

c_cxx/OpenVINO_EP/Windows/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ option(OPENCL_INCLUDE "OpenCL header dir")
1717
if(NOT ONNXRUNTIME_ROOTDIR)
1818
set(ONNXRUNTIME_ROOTDIR "C:/Program Files/onnxruntime")
1919
endif()
20-
include_directories("${ONNXRUNTIME_ROOTDIR}/include" "${ONNXRUNTIME_ROOTDIR}/include/onnxruntime/core/session")
20+
include_directories("${ONNXRUNTIME_ROOTDIR}/include" "${ONNXRUNTIME_ROOTDIR}/include/onnxruntime/")
2121
link_directories("${ONNXRUNTIME_ROOTDIR}/lib")
2222

2323
if(OPENCV_ROOTDIR)

c_cxx/OpenVINO_EP/Windows/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set OPENCL_INCS=\path\to\openvino\folder\thirdparty\ocl\clhpp_headers\include
3232
```
3333

3434
```
35-
build.bat --config RelWithDebInfo --use_openvino CPU_FP32 --build_shared_lib --parallel --cmake_extra_defines CMAKE_INSTALL_PREFIX=c:\dev\ort_install --skip_tests
35+
build.bat --config RelWithDebInfo --use_openvino CPU --build_shared_lib --parallel --cmake_extra_defines CMAKE_INSTALL_PREFIX=c:\dev\ort_install --skip_tests
3636
```
3737

3838
By default products of the build on Windows go to build\Windows\config folder. In the case above it would be build\Windows\RelWithDebInfo.
@@ -79,7 +79,7 @@ msbuild onnxruntime_samples.sln /p:Configuration=Debug
7979

8080
To run the samples make sure you source openvino variables using setupvars.bat.
8181

82-
To run the samples download and install(extract) OpenCV from: [download OpenCV](https://github.com/opencv/opencv/releases/download/4.7.0/opencv-4.7.0-windows.exe). Also copy OpenCV dll (opencv_world470.dll which is located at: "path\to\opencv\build\x64\vc16\bin") to the location of the application exe file(Release dll for Release build and debug dll for debug build).
82+
To run the samples download and install(extract) OpenCV from: [download OpenCV](https://github.com/opencv/opencv/releases/download/4.7.0/opencv-4.7.0-windows.exe). Also copy OpenCV dll (opencv_world470.dll which is located at: "path\to\opencv\build\x64\vc16\bin") to the location of the application exe file(Release dll for release build) and (opencv_world470d.dll which is located at:"path\to\opencv\build\x64\vc16\bin") to the location of the application exe file (debug dll for debug build).
8383

8484
#### Run the sample
8585

c_cxx/OpenVINO_EP/Windows/model-explorer/model-explorer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
6565
#ifdef USE_OPENVINO
6666
// Using OPENVINO backend
6767
OrtOpenVINOProviderOptions options;
68-
options.device_type = "CPU_FP32"; //Other options are: GPU_FP32, GPU_FP16, MYRIAD_FP16
68+
options.device_type = "CPU";
6969
std::cout << "OpenVINO device type is set to: " << options.device_type << std::endl;
7070
session_options.AppendExecutionProvider_OpenVINO(options);
7171
#endif

c_cxx/OpenVINO_EP/Windows/squeezenet_classification/squeezenet_cpp_app.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ int main(int argc, char* argv[])
219219
if (useOPENVINO) {
220220
// Using OPENVINO backend
221221
OrtOpenVINOProviderOptions options;
222-
options.device_type = "CPU_FP32"; //Other options are: GPU_FP32, GPU_FP16, MYRIAD_FP16
222+
options.device_type = "CPU";
223223
std::cout << "OpenVINO device type is set to: " << options.device_type << std::endl;
224224
sessionOptions.AppendExecutionProvider_OpenVINO(options);
225225
}

c_cxx/OpenVINO_EP/Windows/squeezenet_classification_io_buffer/squeezenet_cpp_app_io_buffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int main(int argc, char* argv[])
248248
//Appending OpenVINO Execution Provider API
249249
// Using OPENVINO backend
250250
OrtOpenVINOProviderOptions options;
251-
options.device_type = "GPU_FP32"; //Another options are: GPU_FP16, GPU.1_FP32, GPU.1_FP16, GPU.0_FP32, GPU.0_FP16
251+
options.device_type = "GPU";
252252
options.context = (void *) ocl_instance->_context.get() ;
253253
std::cout << "OpenVINO device type is set to: " << options.device_type << std::endl;
254254
sessionOptions.AppendExecutionProvider_OpenVINO(options);

c_sharp/OpenVINO_EP/yolov3_object_detection/Program.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void Main(string[] args)
4646
// Session Options
4747
using SessionOptions options = new SessionOptions();
4848
options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_INFO;
49-
options.AppendExecutionProvider_OpenVINO(@"MYRIAD_FP16");
49+
options.AppendExecutionProvider_OpenVINO(@"CPU");
5050
options.AppendExecutionProvider_CPU(1);
5151

5252
// Load the model
@@ -190,15 +190,14 @@ static void Main(string[] args)
190190
count++;
191191
}
192192
}
193-
194-
// Put boxes, labels and confidence on image and save for viewing
193+
//put boxes, labels and confidence on image and save for viewing
195194
using var outputImage = File.OpenWrite(outImageFilePath);
196195
Font font = SystemFonts.CreateFont("Arial", 16);
197196
foreach (var p in predictions)
198197
{
199198
imageOrg.Mutate(x =>
200199
{
201-
x.DrawLines(Color.Red, 2f, new PointF[] {
200+
x.DrawPolygon(Color.Red, 2f, new PointF[] {
202201

203202
new PointF(p.Box.Xmin, p.Box.Ymin),
204203
new PointF(p.Box.Xmax, p.Box.Ymin),
@@ -216,7 +215,6 @@ static void Main(string[] args)
216215
});
217216
}
218217
imageOrg.Save(outputImage, new JpegEncoder());
219-
220218
}
221219
}
222220
}

c_sharp/OpenVINO_EP/yolov3_object_detection/yolov3_object_detection.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.16.0" />
12-
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.16.0" />
11+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.19.0" />
12+
<PackageReference Include="Microsoft.ML.OnnxRuntime.OpenVino" Version="1.19.0" />
1313
<PackageReference Include="SixLabors.Core" Version="1.0.0-beta0008" />
1414
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta19" />
1515
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.9" />

0 commit comments

Comments
 (0)