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

[v4.0] feat: add new tasks for image classification v2 #722

Merged
merged 28 commits into from
Mar 5, 2024

Conversation

anhappdev
Copy link
Collaborator

@anhappdev anhappdev commented Jun 1, 2023

Closes #719

This is how the app looks with 2 new tasks:

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@freedomtan
Copy link
Contributor

version name scheme: should we call it Classification V2 (after model name) or V3.1 (align with the app version)? Let's discuss this in main mobile working group.

@freedomtan
Copy link
Contributor

we can move the two mobilenet edgetpu models to the end of the list later

@freedomtan
Copy link
Contributor

Let's call it V2 (not V2.0).

@anhappdev
Copy link
Collaborator Author

Screenshot updated in the first comment.

@anhappdev
Copy link
Collaborator Author

The accuracy test of image_classification_offline_v2 failed on Pixel 6 with Pixel backend because the accuracy is 0.
But image_classification_v2 on Pixel 6 passed the test.
Other backends (TFLite, Core ML) also passed the test.

@freedomtan Do you have an idea what can be the reason for this?

@freedomtan
Copy link
Contributor

The accuracy test of image_classification_offline_v2 failed on Pixel 6 with Pixel backend because the accuracy is 0. But image_classification_v2 on Pixel 6 passed the test. Other backends (TFLite, Core ML) also passed the test.

@freedomtan Do you have an idea what can be the reason for this?

Yes, I ran into the same problem on Pixel 7 before. It seems you have to reduce the batch size to a much smaller one. I guess it’s a bug or limitation of EdgeTPU.

@anhappdev anhappdev changed the title feat: add 2 new image_classification tasks for MobileNetEdgeTPUv2 model feat: add new tasks for MobileNetEdgeTPUv2 model Jun 22, 2023
@anhappdev
Copy link
Collaborator Author

Yes, I ran into the same problem on Pixel 7 before. It seems you have to reduce the batch size to a much smaller one. I guess it’s a bug or limitation of EdgeTPU.

Thank you. Reducing the batch size worked.

@anhappdev anhappdev marked this pull request as ready for review June 22, 2023 13:35
@anhappdev anhappdev requested a review from a team as a code owner June 22, 2023 13:35
@freedomtan
Copy link
Contributor

let's rebase this one and create an 4.0 branch.

@anhappdev anhappdev marked this pull request as draft July 18, 2023 06:21
@anhappdev anhappdev changed the title feat: add new tasks for MobileNetEdgeTPUv2 model [v4.0] feat: add new tasks for MobileNetEdgeTPUv2 model Jul 18, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@freedomtan
Copy link
Contributor

Let's rebase this to current master branch and make the model path local (local://) and without checksum, so that it's easier to test new models (we may get more than one model to test).

@anhappdev anhappdev force-pushed the 719/new-edge-tpu-model branch from a03cd6c to dd6663b Compare November 23, 2023 10:56
@anhappdev
Copy link
Collaborator Author

@freedomtan

Let's rebase this to current master branch

Done

and make the model path local (local://) and without checksum, so that it's easier to test new models (we may get more than one model to test).

Each vendor should add a new benchmark_setting to its setting file like this, and can set its own path to local for testing.

benchmark_setting {
  benchmark_id: "image_classification_v2"
  framework: "TFLite"
  delegate_choice: {
    delegate_name: "CPU"
    accelerator_name: "cpu"
    accelerator_desc: "CPU"
    model_path: "https://github.com/mlcommons/mobile_models/raw/anh/add-MNEdgeTPU-V2-L/v3_1/tflite/mobilenet-edgetpu-v2-L_fp32.tflite"
    model_checksum: "4b7ce0a82f8eaa542404d2ab2ee4e575"
  }
}

benchmark_setting {
  benchmark_id: "image_classification_offline_v2"
  framework: "TFLite"
  delegate_choice: {
    delegate_name: "CPU"
    accelerator_name: "cpu"
    accelerator_desc: "CPU"
    batch_size: 2
    model_path: "https://github.com/mlcommons/mobile_models/raw/anh/add-MNEdgeTPU-V2-L/v3_1/tflite/mobilenet-edgetpu-v2-L_fp32.tflite"
    model_checksum: "4b7ce0a82f8eaa542404d2ab2ee4e575"
  }
}

Or should I remove the checksum and set the path to local for tflite_settings_android.pbtxt?

@freedomtan
Copy link
Contributor

@freedomtan

Let's rebase this to current master branch

Done

we need max_duration for new benchmark items.

diff --git a/flutter/assets/tasks.pbtxt b/flutter/assets/tasks.pbtxt
index 5a113ca..d7cf0be 100644
--- a/flutter/assets/tasks.pbtxt
+++ b/flutter/assets/tasks.pbtxt
@@ -221,6 +221,7 @@ task {
   name: "Image Classification v2"
   min_query_count: 1024
   min_duration: 60
+  max_duration: 600
   max_throughput: 1000
   max_accuracy: 1.0
   scenario: "SingleStream"
@@ -257,6 +258,7 @@ task {
   name: "Image Classification v2 (Offline)"
   min_query_count: 24576
   min_duration: 0
+  max_duration: 600
   max_throughput: 2000
   max_accuracy: 1.0
   scenario: "Offline"

@anhappdev
Copy link
Collaborator Author

we need max_duration for new benchmark items.

Done. max_duration does not work in Offline scenario, so I set it to zero.

@freedomtan
Copy link
Contributor

@mohitmundhragithub and @AhmedTElthakeb for some new models, we need different preprocessing, I have a hack based on this one, 1d9e1e9

@mohitmundhragithub
Copy link
Contributor

@mohitmundhragithub and @AhmedTElthakeb for some new models, we need different preprocessing, I have a hack based on this one, 1d9e1e9

this is for which model?
I think MobileNetEdgeTPUv2 model was working fine... no?

@freedomtan
Copy link
Contributor

@freedomtan to send PRs for different input sizes for new models (with different preprocessing). 224x224, 256x256, 384x384

@anhappdev anhappdev changed the title [v4.0] feat: add new tasks for MobileNetEdgeTPUv2 model [v4.0] feat: add new tasks for image classification v2 Feb 8, 2024
nathanw-mlc and others added 6 commits February 13, 2024 10:55
* Update S3 provider in android-build-test.yml

* Update env var name

---------

Co-authored-by: Anh <[email protected]>
* hacks for model small

* small -> medium

* medium -> large

* for quantized models

* make float model work again

fixed a stupid bug

* fix pixel and neuron settings

* change preprocessing and label offset

* Adding changes for calibration dataset preprocessing

* hacks

* clean up

* fix pixel backend settings

* fix pixel settings & icons for classificaton v2

* fix lint issue

* Revert "Adding changes for calibration dataset preprocessing"

This reverts commit c259333.

New model doesn't need these

* revert imagenet width and height

we'll use #853 to handle different width and height

* fix offline for Pixel backend

* Undo update for Windows build

* update MobilenetV4 settings for TFLite, Neuron, and Pixel

* update windows setting for Mobilenet V4

* Use MobileNetV4 model in Apple devices

* Fix tflite_settings_windows.pbtxt

* Update expected_accuracy

* Update expected_accuracy and expected_throughput for Apple devices

* Use fp32 model for Windows

* Update expected_throughput for Windows

* Update expected_throughput for Android

* Update S3 provider in android-build-test.yml (#855)

* Update S3 provider in android-build-test.yml

* Update env var name

---------

Co-authored-by: Anh <[email protected]>

* Reduce batch_size for image_classification_offline_v2 in Pixel 6

---------

Co-authored-by: Mohit Mundhra <[email protected]>
Co-authored-by: Anh <[email protected]>
Co-authored-by: Nathan Wasson <[email protected]>
* Remove InfiniteProgressCircle

* Use GitHub vars for --num-flaky-test-attempts flag

* Format Dart code

* Add DottedProgressCircle

* Add setting for progress animation style

* Revert "Add setting for progress animation style"

This reverts commit c14cc63.

* Revert "Add DottedProgressCircle"

This reverts commit ef1c427.

* Use ProgressCircle with no animation

* Format Dart code
* Use GitHub vars for --num-flaky-test-attempts flag

* Use Pixel 6 for test-android-apk-tflite

* Add expected_throughput for _kTFLiteBackend -> _kPixel6

* Update expected_throughput for _kTFLiteBackend -> _kPixel6

* Replace obsolete Windows image

* Update expected_throughput for _kDN2103

* Use Pixel 6 - API level 31 for higher device capacity
Replace obsolete Windows image
anhappdev and others added 7 commits March 1, 2024 15:31
* Use dev version of loadgen

* Set enforce_max_duration to false

* Add min_duration_ms and max_duration_ms to dev Makefile

* update enforce_max_duration logic

* use updated loadgen

* Show different colors for performance result based on multiple conditions.

* Fix Dart linter issue

* Use GitHub vars for --num-flaky-test-attempts flag

* Update expected_throughput for _kS22Ultra

* Use latest commit from inference/mobile_update branch

---------

Co-authored-by: Koan-Sin Tan <[email protected]>
@anhappdev
Copy link
Collaborator Author

Should we merge this to submission-v4.0 branch first? And then after the submission, we merge submission-v4.0 into master.

@freedomtan
Copy link
Contributor

Should we merge this to submission-v4.0 branch first? And then after the submission, we merge submission-v4.0 into master.

I am fine with either way. Let's discuss it in the meeting.

@freedomtan
Copy link
Contributor

  1. let's merge this to submission-v4.0 first, and back to master when we have good qualcomm backend for the classification V2.
  2. change order of test as @mohitmundhragithub suggested.

@anhappdev anhappdev changed the base branch from master to submission-v4.0 March 5, 2024 06:36
Copy link

sonarqubecloud bot commented Mar 5, 2024

@anhappdev anhappdev marked this pull request as ready for review March 5, 2024 08:36
@anhappdev anhappdev merged commit 58ffbb5 into submission-v4.0 Mar 5, 2024
20 of 21 checks passed
@anhappdev anhappdev deleted the 719/new-edge-tpu-model branch March 5, 2024 08:37
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add single stream and offlline task for MNEdgeTPU-V2-L
4 participants