GithubHelp home page GithubHelp logo

microsoft / cognitive-emotion-android Goto Github PK

View Code? Open in Web Editor NEW
107.0 66.0 58.0 1.08 MB

Android SDK for the Microsoft Emotion API, part of Cognitive Services.

Home Page: https://www.microsoft.com/cognitive-services/en-us/emotion-api

License: Other

Java 100.00%

cognitive-emotion-android's Introduction

Microsoft Emotion API: Android Client Library & Sample

This repo contains the Android client library & sample for the Microsoft Emotion API, an offering within Microsoft Cognitive Services, formerly known as Project Oxford.

The client library

This client library is a thin Java client wrapper for the Microsoft Emotion REST API.

The easiest way to consume the client library is to add com.microsoft.projectoxford.emotion package from Maven Central Repository.

To find the latest version of client library, go to http://search.maven.org, and search for "com.microsoft.projectoxford".

To add the client library dependency from build.gradle file, add the following line in dependencies.

dependencies {
    //
    // Use the following line to include client library from Maven Central Repository
    // Change the version number from the search.maven.org result
    //
    compile 'com.microsoft.projectoxford:emotion:1.0.0'

    // Your other Dependencies...
}

To do add the client library dependency from Android Studio:

  1. From Menu, Choose File > Project Structure
  2. Click on your app module
  3. Click on Dependencies tab
  4. Click "+" sign to add new dependency
  5. Pick "Library dependency" from the drop down list
  6. Type "com.microsoft.projectoxford" and hit the search icon from "Choose Library Dependency" dialog
  7. Pick the Project Oxford client library that you intend to use.
  8. Click "OK" to add the new dependency

Order expressions

You can call the function ToRankedList from the Scores class, for example:

ASCENDING

List<Map.Entry<String, Double>> collection = scores.ToRankedList(Order.ASCENDING);

DESCENDING

List<Map.Entry<String, Double>> collection = scores.ToRankedList(Order.DESCENDING);

The sample

This sample is an Android application to demonstrate the use of Emotion API.

It demonstrates emotion detection from an image. It can identify people's faces and interpret their emotions.

Requirements

Android OS must be Android 4.1 or higher (API Level 16 or higher)

Build the sample

  1. You must obtain a subscription key for Emotion API and Face API by following instructions on our website. Please note that Emotion API and Face API requires two different subscriptions.

  2. Start Android Studio and open project from Emotion > Android > Sample folder.

  3. In Android Studio -> "Project" panel -> "Android" view, open file "app/res/values/strings.xml", and find the line "Please_add_the_emotion_subscription_key_here;". Replace the "Please_add_the_emotion_subscription_key_here" value with your Emotion subscription key string from the first step. If you cannot find the file "strings.xml", it is in folder "Sample\app\src\main\res\values\string.xml".

  4. In Android Studio, select menu "Build > Make Project" to build the sample, and "Run" to launch this sample app.

Run the sample

In Android Studio, select menu "Run", and "Run app" to launch this sample app.

Once the app is launched, click on buttons to use samples of between different scenarios, and follow the instructions on screen.

Microsoft will receive the images you upload and may use them to improve Emotion API and related services. By submitting an image, you confirm you have consent from everyone in it.

If you want to know what is the name of the expression with more value then you might call getExpressionName() from the Score class

Contributing

We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

All Microsoft Cognitive Services SDKs and samples are licensed with the MIT License. For more details, see LICENSE.

Sample images are licensed separately, please refer to LICENSE-IMAGE.

Developer Code of Conduct

Developers using Cognitive Services, including this client library & sample, are expected to follow the “Developer Code of Conduct for Microsoft Cognitive Services”, found at http://go.microsoft.com/fwlink/?LinkId=698895.

cognitive-emotion-android's People

Contributors

chsienki avatar cthrash avatar lightfrenzy avatar margaretmz avatar microsoft-github-policy-service[bot] avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cognitive-emotion-android's Issues

The application could not be installed: INSTALL_FAILED_NO_MATCHING_ABIS

I keep getting this error while installing app from this project

The installation did not succeed.
The application could not be installed: INSTALL_FAILED_NO_MATCHING_ABIS

List of apks:
[0] 'C:\MyData\LocalProjectsAndroidStudio\Cognitive-Emotion-Android\Sample\app\build\outputs\apk\app-universal-debug.apk'
Installation failed due to: 'null'
Retry

Please help me
Thanks :)

Android resource linking failed

Output: /media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml:18: error: unexpected element found in .

Command: /home/vaibhav/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/a35ee41b85191e11fdabc79baa719df9/aapt2-3.2.1-4818971-linux/aapt2 link -I
/home/vaibhav/Android/Sdk/platforms/android-28/android.jar
--manifest
/media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml
-o
/media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_
-R
@/media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt
--auto-add-overlay
--java
/media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r
--custom-package
syndicatesoftwareofficial.com.chatroom
-0
apk
--output-text-symbols
/media/vaibhav/9462D3CC62D3B16A/Android-studio-Files/chatRoom/app/build/intermediates/symbols/debug/R.txt
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-linux Daemon `#0```

Error 400: Error Executing Post Request!

Hi,

I've been successfully using the Emotion API in my android app for detecting facial emotions.
In an activity, everything works fine.

However, when moving the same processResults() (which invokes an AsyncTask as shown in the guiding code) method to an android background service aiming to take photos in the background, I get this error.

Can you tell me what the description for that error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.