Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Working hard

Emanuel Vecchio rnrneverdies

👋
Working hard
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am rnrneverdies on github.
  • I am rnrneverdies (https://keybase.io/rnrneverdies) on keybase.
  • I have a public key ASCgICVJRQezbFR_GvvOQLQfODGf_GFIOgR7Z4T4v7cQzQo

To claim this, I am signing this object:

@rnrneverdies
rnrneverdies / TestRecognizer.cs
Last active Mar 13, 2018
Test method for the Windows Machine Learning, EmotionRecognition sample.
View TestRecognizer.cs
// Load the model
var recognizer = new EmotionRecognizer();
await recognizer.LoadModelAsync());
// Trigger file picker to select an image file
var fileOpenPicker = new FileOpenPicker();
fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
fileOpenPicker.FileTypeFilter.Add(".jpg");
fileOpenPicker.FileTypeFilter.Add(".png");
fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;
@rnrneverdies
rnrneverdies / EmotionRecognizer.part3.cs
Last active Mar 14, 2018
EvaluateAsync method for the Windows Machine Learning, EmotionRecognition sample.
View EmotionRecognizer.part3.cs
public class EmotionRecognizer
{
// ....
public async Task<Results> EvaluateAsync(VideoFrame inputFrame)
{
if (model != null) {
// Create bindings for the input and output buffer
var binding = new LearningModelBindingPreview(model as LearningModelPreview);
var outputVariableList = new List<float>();
@rnrneverdies
rnrneverdies / EmotionRecognizer.part2.cs
Last active Mar 14, 2018
LoadModelAsync method for the Windows Machine Learning, EmotionRecognition sample.
View EmotionRecognizer.part2.cs
public class EmotionRecognizer
{
// ....
public async Task LoadModelAsync()
{
try
{
// Load Model
var modelFile = await StorageFile.GetFileFromApplicationUriAsync(
@rnrneverdies
rnrneverdies / EmotionRecognizer.part1.cs
Last active Mar 14, 2018
Results structure and gobal variable declarations for the Windows Machine Learning, EmotionRecognition sample.
View EmotionRecognizer.part1.cs
public class EmotionRecognizer
{
public class Results
{
public float Neutral { get; set; }
public float Happiness { get; set; }
public float Surprise { get; set; }
public float Sadness { get; set; }
public float Anger { get; set; }
public float Disgust { get; set; }
@rnrneverdies
rnrneverdies / MainPage.xaml.cs
Created Mar 12, 2018
Loaded event handler for the Windows Machine Learning, EmotionRecognition sample.
View MainPage.xaml.cs
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
// Load onnx model
await LoadModelAsync();
}
@rnrneverdies
rnrneverdies / MainPage.xaml
Created Mar 12, 2018
Page element update for the Windows Machine Learning, EmotionRecognition sample.
View MainPage.xaml
<Page
x:Class="EmotionRecognition.MainPage"
...
Loaded="Page_Loaded">
@rnrneverdies
rnrneverdies / record.sh
Last active Mar 2, 2018
Script to record 3 LifeCam cameras
View record.sh
#!/usr/bin/env bash
ffmpeg -y -rtbufsize 102M -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 \
-video_device_number 0 -i video="Microsoft® LifeCam Studio(TM)" -t 60 -c:v copy -crf 0 \
camera0.mkv &
ffmpeg -y -rtbufsize 102M -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 \
-video_device_number 1 -i video="Microsoft® LifeCam Studio(TM)" -t 60 -c:v copy -crf 0 \
camera1.mkv &
ffmpeg -y -rtbufsize 102M -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 \
-video_device_number 2 -i video="Microsoft® LifeCam Studio(TM)" -t 60 -c:v copy -crf 0 \