Skip to content

Instantly share code, notes, and snippets.

View rnrneverdies's full-sized avatar
👋
Working hard

Emanuel Vecchio rnrneverdies

👋
Working hard
View GitHub Profile
@rnrneverdies
rnrneverdies / record.sh
Last active March 2, 2018 04:13
Script to record 3 LifeCam cameras
#!/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 \
@rnrneverdies
rnrneverdies / MainPage.xaml
Created March 12, 2018 11:58
Page element update for the Windows Machine Learning, EmotionRecognition sample.
<Page
x:Class="EmotionRecognition.MainPage"
...
Loaded="Page_Loaded">
@rnrneverdies
rnrneverdies / MainPage.xaml.cs
Created March 12, 2018 12:00
Loaded event handler for the Windows Machine Learning, EmotionRecognition sample.
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
// Load onnx model
await LoadModelAsync();
}
@rnrneverdies
rnrneverdies / TestRecognizer.cs
Last active March 13, 2018 14:10
Test method for the Windows Machine Learning, EmotionRecognition sample.
// 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.part1.cs
Last active March 14, 2018 12:02
Results structure and gobal variable declarations for the Windows Machine Learning, EmotionRecognition sample.
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 / EmotionRecognizer.part3.cs
Last active March 14, 2018 12:05
EvaluateAsync method for the Windows Machine Learning, EmotionRecognition sample.
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 March 14, 2018 12:06
LoadModelAsync method for the Windows Machine Learning, EmotionRecognition sample.
public class EmotionRecognizer
{
// ....
public async Task LoadModelAsync()
{
try
{
// Load Model
var modelFile = await StorageFile.GetFileFromApplicationUriAsync(
@rnrneverdies
rnrneverdies / keybase.md
Created March 25, 2018 13:55
keybase proof

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: