88acd74a0b
* added new project for emotion recognition * emotion package Co-authored-by: Amrutha Srinivasan <amsrin@microsoft.com> |
||
---|---|---|
.github/workflows | ||
ImageClassifier | ||
IntelligentAPI_EmotionRecognizer | ||
IntelligentAPIsTester | ||
ObjectDetector | ||
.gitattributes | ||
.gitignore | ||
Directory.Build.props | ||
Directory.Build.targets | ||
IntelligentAPIs.sln | ||
License.md | ||
README.md | ||
ThirdPartyNotices.txt | ||
Windows.Toolkit.Common.props | ||
global.json | ||
nuget.png |
README.md
Intelligent APIs
What are Intelligent APIs?
Intelligent APIs aim to make machine learning tasks easier for developers to leverage in their applications without needing ML expertise or creating a new model. By just importing a nuget package and calling a function, we want developers to be able to build intelligent app experiences without needing to deal with the complexities of inferencing machine learning models on Windows.
Each of these APIs employs WinML (Windows Machine Learning) to use the models on Windows. WinML helps abstract a lot of the model-specific code away and performs hardware optimizations to improve performance significantly on Windows. Learn more about WinML here.
Pre-requisites
Visual Studio 2017 Version 15.7.4 or Newer
Windows 10 - Build 17763 (RS5) or Newer
Windows SDK - Build 17763 (RS5) or Newer
Getting started with the nuget packages
We have 2 nuget packages ready for you to test and play around with. These nuget packages enable you to perform classic machine learning tasks like image classification and object detection in 1-2 lines of code.
Steps to import the nuget package into your project:
- Add a new nuget source with the feed URL as
https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json
. If you have not done this before, follow the steps listed here to add a new nuget package source. Name the source as "WCT Labs" and set the URL ashttps://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json
. - Open a blank UWP app or an existing app and add one or both packages from the newly created source. Follow step 3 here to do so.
- There should be two nuget packages listed,
CommunityToolkit.Labs.Intelligent.ImageClassification
andCommunityToolkit.Labs.Intelligent.ObjectDetection
.
Using the packages
Image Classification
To perform image classification, import the CommunityToolkit.Labs.Intelligent.ImageClassification
nuget package. To classify an image, you will need to pass a StorageFile object which is the image file itself, and the number of top results that you want (optional). In the following example, we pass an image of a Rottweiler and we want the top 3 results.
using CommunityToolkit.Labs.Intelligent.ImageClassification;
...
List<ClassificationResult> imageClasses = await SqueezeNetImageClassifier.ClassifyImage(selectedStorageFile, 3);
This nuget package performs SqueezeNet model inferencing using WinML. SqueezeNet can detect 1000 different classes.
Object Detection
(Note: This currently only works with Windows 11. We are looking into this issue)
To perform object detection on your images/video, import the CommunityToolkit.Labs.Intelligent.ObjectDetection
nuget package. To detect objects in the image, you can either pass an image file as a StorageFile object, VideoFrame or SoftwareBitmap.
using CommunityToolkit.Labs.Intelligent.ObjectDetection;
...
List<DetectionResult> listOfObjects = await YOLOObjectDetector.DetectObjects(selectedStorageFile);
This nuget package performs object detection using YOLOv4 model inference on WinML and also return the co-ordinates of the bounding boxes around the detected objects. YOLOv4 can detect objects of 80 different classes.
🧪 This project is under Community Toolkit Labs. What does that mean?
Community Toolkit Labs is a place for rapidly prototyping ideas and gathering community feedback. It is an incubation space where the developer community can come together to work on new ideas before thinking about final quality gates and ship cycles. Developers can focus on the scenarios and usage of their features before finalizing docs, samples, and tests required to ship a complete idea within the Toolkit.
Steps to clone the repo
git clone
the repo- Open the .sln file in VS 2017 or newer
- Set
IntelligentLabsTest
as the startup project. - Build the project and run!
Note: If you have the Windows machine learning code generator or mlgen extension on VS, please disable it for this project since all the code is already generated for you.