Skip to content

Commit 52eff6e

Browse files
author
Ori Levari
authored
update adapter selection readme to more clearly differentiate it from the squeezenet sample. Also remove a double print line in the sample code itself (#158)
1 parent f4d8519 commit 52eff6e

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

Samples/AdapterSelection/AdapterSelection/cpp/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# SqueezeNet Object Detection sample
1+
# Adapter Selection sample
22

3-
This is a desktop application that uses SqueezeNet, a pre-trained machine learning model, to detect the predominant object in an image selected by the user from a file.
4-
This application also allows the user to select a specific device adapter to run the model on.
3+
This is a desktop application that demonstrates how to enumerate and select device adapters to run onnx models on using Windows Machine Learning. This sample is set up to run a SqueezeNet image detection model on the selected device.
54

65
Note: SqueezeNet was trained to work with image sizes of 224x224, so you must provide an image of size 224X224.
76

@@ -22,7 +21,7 @@ Note: SqueezeNet was trained to work with image sizes of 224x224, so you must pr
2221

2322
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2423
2. Start Microsoft Visual Studio 2017 and select **File > Open > Project/Solution**.
25-
3. Starting in the folder where you unzipped the samples, go to the **Samples** subfolder, then the subfolder for this specific sample (**SqueezeNetObjectDetection\Desktop\cpp**). Double-click the Visual Studio solution file (.sln).
24+
3. Starting in the folder where you unzipped the samples, go to the **Samples** subfolder, then the subfolder for this specific sample (**AdapterSelection**). Double-click the Visual Studio solution file (.sln).
2625
4. Confirm that the project is pointed to the correct SDK that you installed (e.g. 17763). You can do this by right-clicking the project in the **Solution Explorer**, selecting **Properties**, and modifying the **Windows SDK Version**.
2726
5. Confirm that you are set for the right configuration and platform (for example: Debug, x64).
2827
6. Build the solution (**Ctrl+Shift+B**).
@@ -34,17 +33,16 @@ Note: SqueezeNet was trained to work with image sizes of 224x224, so you must pr
3433
3. Change the current folder to the folder containing the built EXE (`cd <path-to-exe>`).
3534
4. Run the executable as shown below. Make sure to replace the install location with what matches yours:
3635
```
37-
SqueezeNetObjectDetection.exe C:\Repos\Windows-Machine-Learning\SharedContent\models\SqueezeNet.onnx C:\Repos\Windows-Machine-Learning\SharedContent\media\kitten_224.png
36+
AdapterSelection.exe C:\Repos\Windows-Machine-Learning\SharedContent\models\SqueezeNet.onnx C:\Repos\Windows-Machine-Learning\SharedContent\media\kitten_224.png
3837
```
3938
5. You should get output similar to the following:
4039
```
4140
Index: 0, Description: AMD Radeon Pro WX 3100
42-
Index: 1, Description: Microsoft Basic Render Driver
4341
Please enter the index of the adapter you want to use...
4442
```
4543
Then type the index to select and press enter. Then you should get output similar to the following:
4644
```
47-
Selected adapter at index 1
45+
Selected adapter at index 0
4846
Loading modelfile 'C:\Repos\Windows-Machine-Learning\SharedContent\models\SqueezeNet.onnx' on the 'default' device
4947
model file loaded in 421 ticks
5048
Loading the image...
@@ -60,4 +58,4 @@ Note: SqueezeNet was trained to work with image sizes of 224x224, so you must pr
6058

6159
## License
6260

63-
MIT. See [LICENSE file](https://github.com/Microsoft/Windows-Machine-Learning/blob/master/LICENSE).
61+
MIT. See [LICENSE file](https://github.com/Microsoft/Windows-Machine-Learning/blob/master/LICENSE).

Samples/AdapterSelection/AdapterSelection/cpp/main.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ int main(int argc, char* argv[])
5151
// valid GPU adapter
5252
else {
5353
printf("Index: %d, Description: %ls\n", static_cast<int>(validAdapters.size()), pDesc.Description);
54-
wcout << pDesc.Description << endl;
5554
validAdapters.push_back(spAdapter);
5655
}
5756
}
@@ -61,13 +60,13 @@ int main(int argc, char* argv[])
6160
device = LearningModelDevice(LearningModelDeviceKind::Cpu);
6261
}
6362
else {
64-
// user selects adapter
63+
// user selects adapter
6564
printf("Please enter the index of the adapter you want to use...\n");
6665
int selectedIndex;
6766
while (!(cin >> selectedIndex) || selectedIndex < 0 || selectedIndex >= static_cast<int>(validAdapters.size())) {
6867
cin.clear();
6968
cin.ignore(numeric_limits<streamsize>::max(), '\n');
70-
printf("Invalid index, please try again.\n");
69+
printf("Invalid index, please try again.\n");
7170
}
7271
printf("Selected adapter at index %d\n", selectedIndex);
7372

@@ -235,7 +234,7 @@ void PrintResults(IVectorView<float> results)
235234
}
236235
}
237236

238-
int32_t WINRT_CALL WINRT_CoIncrementMTAUsage(void** cookie) noexcept
239-
{
240-
return CoIncrementMTAUsage((CO_MTA_USAGE_COOKIE*)cookie);
237+
int32_t WINRT_CALL WINRT_CoIncrementMTAUsage(void** cookie) noexcept
238+
{
239+
return CoIncrementMTAUsage((CO_MTA_USAGE_COOKIE*)cookie);
241240
}

0 commit comments

Comments
 (0)