-
Notifications
You must be signed in to change notification settings - Fork 2
Add workflow for library publishing and update documentation #18
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ on: | |
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| android-tests: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Publish to GitHub Packages | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| run-tests: | ||
| name: Run Test Suite | ||
| uses: ./.github/workflows/android-tests.yml | ||
| secrets: inherit | ||
|
|
||
| publish: | ||
| needs: run-tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: "17" | ||
|
|
||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Build libraries | ||
| run: ./gradlew build | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this build both libraries or only SimFace?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should build both; that's how it worked when running it locally |
||
|
|
||
| - name: Publish to GitHub Packages | ||
| env: | ||
| USERNAME: ${{ github.actor }} | ||
| TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: ./gradlew publish | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # SimQ - Face Quality Assessment | ||
|
|
||
| SimQ is an Android library for assessing the quality of face images. It analyzes multiple quality metrics to provide a comprehensive quality score between 0.0 and 1.0. | ||
|
|
||
| ## Features | ||
|
|
||
| SimQ evaluates face images based on four key metrics: | ||
|
|
||
| - **Alignment**: Evaluates face pose angles (pitch, yaw, roll) and eye state | ||
| - **Blur**: Measures image sharpness using Laplacian variance | ||
| - **Brightness**: Assesses image luminance levels | ||
| - **Contrast**: Evaluates pixel intensity variation | ||
|
|
||
| ## Installation | ||
|
|
||
| Add the dependency to your `build.gradle.kts`: | ||
|
|
||
| ```kotlin | ||
| implementation("com.simprints.biometrics:simq:2025.4.0") | ||
| ``` | ||
|
|
||
| ## Basic Usage | ||
|
|
||
| ```kotlin | ||
| // Initialize SimQ with default parameters | ||
| val simQ = SimQ() | ||
|
|
||
| // Calculate quality score for a face image | ||
| val qualityScore = simQ.calculateFaceQuality( | ||
| bitmap = faceBitmap, | ||
| pitch = 5.0, | ||
| yaw = -3.0, | ||
| roll = 0.0 | ||
| ) | ||
|
|
||
| // Quality score ranges from 0.0 (poor) to 1.0 (excellent) | ||
| if (qualityScore >= 0.6) { | ||
| // Image quality is sufficient | ||
| } | ||
| ``` | ||
|
|
||
| ## Advanced Usage | ||
|
|
||
| ### Custom Weights | ||
|
|
||
| Customize how much each metric contributes to the final score: | ||
|
|
||
| ```kotlin | ||
| val customWeights = QualityWeights( | ||
| alignment = 0.25, | ||
| blur = 0.35, | ||
| brightness = 0.25, | ||
| contrast = 0.10, | ||
| eyeOpenness = 0.05 | ||
| ) | ||
|
|
||
| val simQ = SimQ(faceWeights = customWeights) | ||
| ``` | ||
|
|
||
| ### Custom Parameters | ||
|
|
||
| Adjust the thresholds for each quality metric: | ||
|
|
||
| ```kotlin | ||
| val customParameters = QualityParameters( | ||
| maxAlignmentAngle = 15.0, | ||
| minBlur = 60_000.0, | ||
| maxBlur = 120_000.0, | ||
| minBrightness = 40.0, | ||
| optimalBrightnessLow = 90.0, | ||
| optimalBrightnessHigh = 140.0, | ||
| maxBrightness = 180.0, | ||
| minContrast = 35.0, | ||
| maxContrast = 50.0 | ||
| ) | ||
|
|
||
| val simQ = SimQ(faceParameters = customParameters) | ||
| ``` | ||
|
|
||
| ## Parameters Reference | ||
|
|
||
| ### calculateFaceQuality() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine for now, but I would suggest adding Dokka and generating documentation based on code comments, as this will get outdated sooner or later. |
||
|
|
||
| | Parameter | Type | Default | Description | | ||
| |-----------|------|---------|-------------| | ||
| | `bitmap` | `Bitmap` | Required | The cropped face image | | ||
| | `pitch` | `Double` | `0.0` | Face pitch angle (head nod) in degrees | | ||
| | `yaw` | `Double` | `0.0` | Face yaw angle (head rotation) in degrees | | ||
| | `roll` | `Double` | `0.0` | Face roll angle (head tilt) in degrees | | ||
| | `leftEyeOpenness` | `Double?` | `null` | Left eye openness probability (0.0-1.0) | | ||
| | `rightEyeOpenness` | `Double?` | `null` | Right eye openness probability (0.0-1.0) | | ||
| | `centerCrop` | `Float` | `0.5f` | Fraction of image to analyze (0.0-1.0) | | ||
| | `horizontalDisplacement` | `Float` | `0.0f` | Horizontal shift for center crop (-1.0 to 1.0) | | ||
| | `verticalDisplacement` | `Float` | `0.0f` | Vertical shift for center crop (-1.0 to 1.0) | | ||
|
|
||
| ### QualityWeights (Default Values) | ||
|
|
||
| | Weight | Default | Description | | ||
| |--------|---------|-------------| | ||
| | `alignment` | `0.28` | Face pose contribution | | ||
| | `blur` | `0.30` | Sharpness contribution | | ||
| | `brightness` | `0.30` | Luminance contribution | | ||
| | `contrast` | `0.10` | Contrast contribution | | ||
| | `eyeOpenness` | `0.02` | Eye state contribution | | ||
|
|
||
| ### QualityParameters (Default Values) | ||
|
|
||
| | Parameter | Default | Description | | ||
| |-----------|---------|-------------| | ||
| | `maxAlignmentAngle` | `20.0` | Maximum combined angle deviation | | ||
| | `maxIndividualAngle` | `25.0` | Maximum single angle deviation | | ||
| | `minBlur` | `50,000.0` | Minimum acceptable Laplacian variance | | ||
| | `maxBlur` | `100,000.0` | Optimal Laplacian variance | | ||
| | `minBrightness` | `30.0` | Minimum acceptable brightness (0-255) | | ||
| | `optimalBrightnessLow` | `80.0` | Lower bound of optimal brightness | | ||
| | `optimalBrightnessHigh` | `150.0` | Upper bound of optimal brightness | | ||
| | `maxBrightness` | `190.0` | Maximum acceptable brightness | | ||
| | `brightnessSteepness` | `0.3` | Brightness scoring curve steepness | | ||
| | `minContrast` | `30.0` | Minimum acceptable contrast (std dev) | | ||
| | `maxContrast` | `47.0` | Optimal contrast (std dev) | | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, there was a v4 of this action, not sure how critical the changes are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will leave it at v3 for now to be consistent with the other workflows