-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


,

, 19 2017 . 17:57 +
, - . , , . , , . , , , . , , . . , .




, . , , .

,


Heedbook, , . , , . , , .

:


1. - ( , , , ) .
2. , , .
3. - .
4. , .
5. / , , , .
6. . ( , . ))

, , , .



, - -, - . , , . )



, Heedbook .

:


Azure Functions


. , ( , ). Azure Functions. WebJob, .

AF Azure. 2017 AF Visual Studio 2017 UPD 3.

AF Microsoft, , AF Heedbook. , Azure.

AF Http , Blob Azure Blob storage, OneDrive . AF. AF, AF , .

AF . AF . Microsoft Face API.

. AF , project.json :

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Microsoft.ProjectOxford.Common": "1.0.324",
        "Microsoft.ProjectOxford.Face": "1.2.5"
      }
    }
   }
} 

AF Visual Studio 2017 UPD 3 Nuget.

AF . Azure MsSql. function.json:

{
  "bindings": [
    {
      "name": "InputFace",
      "type": "blobTrigger",
      "direction": "in",
      "path": "frames/{name}",
      "connection": "heedbookhackfest_STORAGE"
    },
    {
      "type": "apiHubTable",
      "name": "FaceData",
      "dataSetName": "default",
      "tableName": "FaceEmotionGuid",
      "connection": "sql_SQL",
      "direction": "out"
    }
  ],
  "disabled": false
}

, Azure Functions!

#r "System.IO"

using System.IO;
using Microsoft.ProjectOxford.Face;
using Microsoft.ProjectOxford.Common.Contract;

public static async Task Run(Stream InputFace, string name, IAsyncCollector FaceData, TraceWriter log)
{
    log.Info($"Processing face {name}");
    var namea = Path.GetFileNameWithoutExtension(name).Split('-');
    var cli = new FaceServiceClient();
    var res = await cli.DetectAsync(InputFace,false,false,new FaceAttributeType[] { FaceAttributeType.Age, FaceAttributeType.Emotion, FaceAttributeType.Gender});
    var fc = (from f in res
              orderby f.FaceRectangle.Width
              select f).FirstOrDefault();
    if (fc!=null)
    {
        var R = new FaceEmotion();
        R.Time = DateTime.ParseExact(namea[1],"yyyyMMddHHmmss",System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat);
        R.DialogId = int.Parse(namea[0]);
        var t = GetMainEmotion(fc.FaceAttributes.Emotion);
        R.EmotionType = t.Item1;
        R.FaceEmotionGuidId = Guid.NewGuid();
        R.EmotionValue = (int)(100*t.Item2);
        R.Sex = fc.FaceAttributes.Gender.ToLower().StartsWith("m");
        R.Age = (int)fc.FaceAttributes.Age;
        await FaceData.AddAsync(R);
        log.Info($" - recorded face, age={fc.FaceAttributes.Age}, emotion={R.EmotionType}");
    }
    else log.Info(" - no faces found");
}
 
public static Tuple GetMainEmotion(EmotionScores s)
{
    float m = 0;
    string e = "";
    foreach (var p in s.GetType().GetProperties())
    {
        if ((float)p.GetValue(s)>m)
        {
            m = (float)p.GetValue(s);
            e = p.Name;
        }
    }
    return new Tuple(e,m);
}


public class FaceEmotion
{
    public Guid FaceEmotionGuidId { get; set; }

    public DateTime Time  { get; set; }

    public string EmotionType { get; set; }

    public float EmotionValue { get; set; }

    public int DialogId { get; set; }

    public bool Sex { get; set; }

    public int Age { get; set; }

}

Cognitive Services Face API. AF Stream CS:

  var res = await cli.DetectAsync(InputFace,false,false,new FaceAttributeType[] { FaceAttributeType.Age, FaceAttributeType.Emotion, FaceAttributeType.Gender});

:

     var fc = (from f in res
              orderby f.FaceRectangle.Width
              select f).FirstOrDefault();

:

await FaceData.AddAsync(R);
 

, ? . )


, , .

AF, , ( , ). , .Net walkarround , .


, , , . -, . . -.

- - GetUserMedia(). - . , , . , . , - .


, . , . , Goolge Speech Api, .


. Heedbook .

Heedbook , ML, , SEO . info@heedbook.com.
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/330942/

:  

: [1] []
 

:
: 

: ( )

:

  URL