Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Android/WPF Demo and Portrait Processing to SDK 1.0.0 Beta.2 #30

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion face/AndroidDetect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The sample demonstrates how to use Azure Face API to detect and frame faces in a
### Prerequisites

* [Android Studio](https://developer.android.com/studio) (API Level 28+)
* Java SDK `com.azure:azure-ai-vision-face:1.0.0-beta.1` for Gradle
* Java SDK `com.azure:azure-ai-vision-face:1.0.0-beta.2` for Gradle


### Setup and Build
Expand Down
6 changes: 3 additions & 3 deletions face/AndroidDetect/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apply plugin: 'com.android.application'

android {
namespace 'com.contoso.facetutorial'
compileSdkVersion 33
compileSdk 34
defaultConfig {
minSdkVersion 28
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.4.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -26,7 +26,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.2'

implementation 'com.azure:azure-ai-vision-face:1.0.0-beta.1'
implementation 'com.azure:azure-ai-vision-face:1.0.0-beta.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
Expand Down
2 changes: 1 addition & 1 deletion face/AndroidDetect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:8.3.2'
Copy link
Member Author

@der3318 der3318 Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using AGP 8.0.0 results in the following error:

Execution failed for task ':app:mergeExtDexDebug'.
java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null

With the build environment:

  • Android Studio | Ladybug (2024.2.1) | September 2024
  • JDK 21, which is the new default JetBrains Runtime (JBR) that comes with Android Studio 2024.2.1 (see blog)
  • Gradle 8.5, the minimum version that supports Java 21 (see compatibility matrix)

Upgrading AGP from 8.0.0 to 8.3.2, which is the maximum version compatible with Gradle 8.5 (see compatibility table and 8.3.* release notes), solves the problem.

Accordingly, the API level is suggested to migrate from 33 to 34:

The maximum API level that Android Gradle plugin 8.3 supports is API level 34.

android {
    namespace 'com.contoso.facetutorial'
-   compileSdk 33
+   compileSdk 34
    defaultConfig {
        minSdkVersion 28
-       targetSdkVersion 33
+       targetSdkVersion 34
        versionCode 1
        versionName "1.4.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }



// NOTE: Do not place your application dependencies here; they belong
Expand Down
8 changes: 6 additions & 2 deletions face/DemoWPF/Sample-WPF/App.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
Expand Down Expand Up @@ -31,12 +31,16 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.10" newVersion="6.0.0.10" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory.Data" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
26 changes: 13 additions & 13 deletions face/DemoWPF/Sample-WPF/FaceAPI-WPF-Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Azure.AI.Vision.Face, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>packages\Azure.AI.Vision.Face.1.0.0-beta.1\lib\netstandard2.0\Azure.AI.Vision.Face.dll</HintPath>
<HintPath>packages\Azure.AI.Vision.Face.1.0.0-beta.2\lib\netstandard2.0\Azure.AI.Vision.Face.dll</HintPath>
</Reference>
<Reference Include="Azure.Core, Version=1.39.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>packages\Azure.Core.1.39.0\lib\net472\Azure.Core.dll</HintPath>
<Reference Include="Azure.Core, Version=1.44.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>packages\Azure.Core.1.44.1\lib\net472\Azure.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Rest.ClientRuntime.2.3.24\lib\net461\Microsoft.Rest.ClientRuntime.dll</HintPath>
Expand All @@ -76,8 +76,8 @@
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ClientModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>packages\System.ClientModel.1.0.0\lib\netstandard2.0\System.ClientModel.dll</HintPath>
<Reference Include="System.ClientModel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>packages\System.ClientModel.1.1.0\lib\netstandard2.0\System.ClientModel.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand All @@ -87,8 +87,8 @@
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Memory.Data, Version=1.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.Data.1.0.2\lib\net461\System.Memory.Data.dll</HintPath>
<Reference Include="System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.Data.6.0.0\lib\net461\System.Memory.Data.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
Expand All @@ -110,11 +110,11 @@
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Text.Encodings.Web, Version=4.0.5.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll</HintPath>
<Reference Include="System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Json.4.7.2\lib\net461\System.Text.Json.dll</HintPath>
<Reference Include="System.Text.Json, Version=6.0.0.10, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Json.6.0.10\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
Expand Down
14 changes: 7 additions & 7 deletions face/DemoWPF/Sample-WPF/packages.config
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Azure.AI.Vision.Face" version="1.0.0-beta.1" targetFramework="net48" />
<package id="Azure.Core" version="1.39.0" targetFramework="net48" />
<package id="Azure.AI.Vision.Face" version="1.0.0-beta.2" targetFramework="net48" />
<package id="Azure.Core" version="1.44.1" targetFramework="net48" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net46" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net48" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net48" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net46" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.24" targetFramework="net48" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.19" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.ClientModel" version="1.0.0" targetFramework="net48" />
<package id="System.ClientModel" version="1.1.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="6.0.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
<package id="System.Memory.Data" version="1.0.2" targetFramework="net48" />
<package id="System.Memory.Data" version="6.0.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="4.7.2" targetFramework="net48" />
<package id="System.Text.Json" version="4.7.2" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="6.0.0" targetFramework="net48" />
<package id="System.Text.Json" version="6.0.10" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.AI.Vision.Face" Version="1.0.0-beta.1" />
<PackageReference Include="Azure.AI.Vision.Face" Version="1.0.0-beta.2" />
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.19.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.6" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion face/Scenario-PortraitProcessing/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
}

dependencies {
implementation 'com.azure:azure-ai-vision-face:1.0.0-beta.1'
implementation 'com.azure:azure-ai-vision-face:1.0.0-beta.2'
implementation 'com.microsoft.onnxruntime:onnxruntime:1.19.0'
}

Expand Down
4 changes: 2 additions & 2 deletions face/Scenario-PortraitProcessing/python/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
# JPEG quality
JPEG_QUALITY = 95
# Detection model option
DETECTION_MODEL = FaceDetectionModel.DETECTION_03
DETECTION_MODEL = FaceDetectionModel.DETECTION03
# Recognition model option
RECO_MODEL = FaceRecognitionModel.RECOGNITION_04
RECO_MODEL = FaceRecognitionModel.RECOGNITION04
# Face attribute options
FACE_ATTRIBUTES = [FaceAttributeTypeDetection03.BLUR, FaceAttributeTypeDetection03.HEAD_POSE, FaceAttributeTypeDetection03.MASK, FaceAttributeTypeRecognition04.QUALITY_FOR_RECOGNITION]
# Margin ratio on face crop
Expand Down