qaihm-bot commited on
Commit
8671cc5
·
verified ·
1 Parent(s): 354444f

See https://github.com/quic/ai-hub-models/releases/v0.46.1 for changelog.

First-Order-Motion-Model_FOMMDetector_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed740f67f007d5541b0b207daf5407abfcd9473c1f3656ac1e9a58783804ac5b
3
- size 52977856
 
 
 
 
First-Order-Motion-Model_FOMMGenerator_float.onnx.zip DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:99f3164f80c16625c450cbd5d3f433c4719aa594667041953983731d78c341cf
3
- size 170025526
 
 
 
 
README.md CHANGED
@@ -9,215 +9,74 @@ pipeline_tag: image-to-video
9
 
10
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/fomm/web-assets/model_demo.png)
11
 
12
- # First-Order-Motion-Model: Optimized for Mobile Deployment
13
- ## Animation of Still Image from Source Video
14
-
15
 
16
  FOMM is a machine learning model that animates a still image to mirror the movements from a target video.
17
 
18
- This model is an implementation of First-Order-Motion-Model found [here](https://github.com/AliaksandrSiarohin/first-order-model/tree/master).
19
-
20
-
21
- This repository provides scripts to run First-Order-Motion-Model on Qualcomm® devices.
22
- More details on model performance across various devices, can be found
23
- [here](https://aihub.qualcomm.com/models/fomm).
24
-
25
-
26
-
27
- ### Model Details
28
-
29
- - **Model Type:** Model_use_case.video_generation
30
- - **Model Stats:**
31
- - Model checkpoint: vox-256
32
- - Input resolution: 256x256
33
- - Model size (FOMMDetector) (float): 54.2 MB
34
- - Model size (FOMMGenerator) (float): 174 MB
35
-
36
- | Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model
37
- |---|---|---|---|---|---|---|---|---|
38
- | FOMMDetector | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 4.629 ms | 0 - 29 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
39
- | FOMMDetector | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 3.427 ms | 0 - 105 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
40
- | FOMMDetector | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 3.031 ms | 0 - 93 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
41
- | FOMMDetector | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 2.908 ms | 1 - 92 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
42
- | FOMMDetector | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 4.684 ms | 28 - 28 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
43
- | FOMMGenerator | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 22.855 ms | 18 - 21 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
44
- | FOMMGenerator | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 16.644 ms | 17 - 191 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
45
- | FOMMGenerator | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 13.498 ms | 16 - 154 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
46
- | FOMMGenerator | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 11.017 ms | 18 - 165 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
47
- | FOMMGenerator | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 22.939 ms | 88 - 88 MB | NPU | [First-Order-Motion-Model.onnx.zip](https://huggingface.co/qualcomm/First-Order-Motion-Model/blob/main/First-Order-Motion-Model.onnx.zip) |
48
-
49
-
50
-
51
-
52
- ## Installation
53
-
54
-
55
- Install the package via pip:
56
- ```bash
57
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
58
- pip install "qai-hub-models[fomm]"
59
- ```
60
-
61
-
62
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
63
-
64
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
65
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
66
-
67
- With this API token, you can configure your client to run models on the cloud
68
- hosted devices.
69
- ```bash
70
- qai-hub configure --api_token API_TOKEN
71
- ```
72
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
73
-
74
-
75
-
76
- ## Demo off target
77
-
78
- The package contains a simple end-to-end demo that downloads pre-trained
79
- weights and runs this model on a sample input.
80
-
81
- ```bash
82
- python -m qai_hub_models.models.fomm.demo
83
- ```
84
-
85
- The above demo runs a reference implementation of pre-processing, model
86
- inference, and post processing.
87
-
88
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
89
- environment, please add the following to your cell (instead of the above).
90
- ```
91
- %run -m qai_hub_models.models.fomm.demo
92
- ```
93
-
94
-
95
- ### Run model on a cloud-hosted device
96
 
97
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
98
- device. This script does the following:
99
- * Performance check on-device on a cloud-hosted device
100
- * Downloads compiled assets that can be deployed on-device for Android.
101
- * Accuracy check between PyTorch and on-device outputs.
102
 
103
- ```bash
104
- python -m qai_hub_models.models.fomm.export
105
- ```
106
 
 
107
 
 
108
 
109
- ## How does this work?
 
 
110
 
111
- This [export script](https://aihub.qualcomm.com/models/fomm/qai_hub_models/models/First-Order-Motion-Model/export.py)
112
- leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this model
113
- on-device. Lets go through each step below in detail:
114
 
115
- Step 1: **Compile model for on-device deployment**
116
 
117
- To compile a PyTorch model for on-device deployment, we first trace the model
118
- in memory using the `jit.trace` and then call the `submit_compile_job` API.
119
 
120
- ```python
121
- import torch
 
 
122
 
123
- import qai_hub as hub
124
- from qai_hub_models.models.fomm import Model
125
 
126
- # Load the model
127
- torch_model = Model.from_pretrained()
128
 
129
- # Device
130
- device = hub.Device("Samsung Galaxy S25")
131
 
132
- # Trace model
133
- input_shape = torch_model.get_input_spec()
134
- sample_inputs = torch_model.sample_inputs()
135
 
136
- pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])
137
-
138
- # Compile model on a specific device
139
- compile_job = hub.submit_compile_job(
140
- model=pt_model,
141
- device=device,
142
- input_specs=torch_model.get_input_spec(),
143
- )
144
-
145
- # Get target model to run on-device
146
- target_model = compile_job.get_target_model()
147
-
148
- ```
149
-
150
-
151
- Step 2: **Performance profiling on cloud-hosted device**
152
-
153
- After compiling models from step 1. Models can be profiled model on-device using the
154
- `target_model`. Note that this scripts runs the model on a device automatically
155
- provisioned in the cloud. Once the job is submitted, you can navigate to a
156
- provided job URL to view a variety of on-device performance metrics.
157
- ```python
158
- profile_job = hub.submit_profile_job(
159
- model=target_model,
160
- device=device,
161
- )
162
-
163
- ```
164
-
165
- Step 3: **Verify on-device accuracy**
166
-
167
- To verify the accuracy of the model on-device, you can run on-device inference
168
- on sample input data on the same cloud hosted device.
169
- ```python
170
- input_data = torch_model.sample_inputs()
171
- inference_job = hub.submit_inference_job(
172
- model=target_model,
173
- device=device,
174
- inputs=input_data,
175
- )
176
- on_device_output = inference_job.download_output_data()
177
-
178
- ```
179
- With the output of the model, you can compute like PSNR, relative errors or
180
- spot check the output with expected output.
181
-
182
- **Note**: This on-device profiling and inference requires access to Qualcomm®
183
- AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).
184
-
185
-
186
-
187
-
188
- ## Deploying compiled model to Android
189
-
190
-
191
- The models can be deployed using multiple runtimes:
192
- - TensorFlow Lite (`.tflite` export): [This
193
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
194
- guide to deploy the .tflite model in an Android application.
195
-
196
-
197
- - QNN (`.so` export ): This [sample
198
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
199
- provides instructions on how to use the `.so` shared library in an Android application.
200
-
201
-
202
- ## View on Qualcomm® AI Hub
203
- Get more details on First-Order-Motion-Model's performance across various devices [here](https://aihub.qualcomm.com/models/fomm).
204
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
  ## License
208
  * The license for the original implementation of First-Order-Motion-Model can be found
209
  [here](https://github.com/AliaksandrSiarohin/first-order-model/blob/master/LICENSE.md).
210
 
211
-
212
-
213
  ## References
214
  * [First Order Motion Model for Image Animation](https://arxiv.org/abs/2003.00196)
215
  * [Source Model Implementation](https://github.com/AliaksandrSiarohin/first-order-model/tree/master)
216
 
217
-
218
-
219
  ## Community
220
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
221
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
222
-
223
-
 
9
 
10
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/fomm/web-assets/model_demo.png)
11
 
12
+ # First-Order-Motion-Model: Optimized for Qualcomm Devices
 
 
13
 
14
  FOMM is a machine learning model that animates a still image to mirror the movements from a target video.
15
 
16
+ This is based on the implementation of First-Order-Motion-Model found [here](https://github.com/AliaksandrSiarohin/first-order-model/tree/master).
17
+ This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/fomm) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device.
 
 
 
 
20
 
21
+ ## Getting Started
22
+ There are two ways to deploy this model on your device:
 
23
 
24
+ ### Option 1: Download Pre-Exported Models
25
 
26
+ Below are pre-exported model assets ready for deployment.
27
 
28
+ | Runtime | Precision | Chipset | SDK Versions | Download |
29
+ |---|---|---|---|---|
30
+ | ONNX | float | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/fomm/releases/v0.46.1/fomm-onnx-float.zip)
31
 
32
+ For more device-specific assets and performance metrics, visit **[First-Order-Motion-Model on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/fomm)**.
 
 
33
 
 
34
 
35
+ ### Option 2: Export with Custom Configurations
 
36
 
37
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/fomm) Python library to compile and export the model with your own:
38
+ - Custom weights (e.g., fine-tuned checkpoints)
39
+ - Custom input shapes
40
+ - Target device and runtime configurations
41
 
42
+ This option is ideal if you need to customize the model beyond the default configuration provided here.
 
43
 
44
+ See our repository for [First-Order-Motion-Model on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/fomm) for usage instructions.
 
45
 
46
+ ## Model Details
 
47
 
48
+ **Model Type:** Model_use_case.video_generation
 
 
49
 
50
+ **Model Stats:**
51
+ - Model checkpoint: vox-256
52
+ - Input resolution: 256x256
53
+ - Model size (FOMMDetector) (float): 54.2 MB
54
+ - Model size (FOMMGenerator) (float): 174 MB
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ ## Performance Summary
57
+ | Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit
58
+ |---|---|---|---|---|---|---
59
+ | FOMMDetector | ONNX | float | Snapdragon® X Elite | 4.668 ms | 28 - 28 MB | NPU
60
+ | FOMMDetector | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 3.421 ms | 0 - 104 MB | NPU
61
+ | FOMMDetector | ONNX | float | Qualcomm® QCS8550 (Proxy) | 4.575 ms | 0 - 30 MB | NPU
62
+ | FOMMDetector | ONNX | float | Qualcomm® QCS9075 | 6.01 ms | 1 - 4 MB | NPU
63
+ | FOMMDetector | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 3.023 ms | 0 - 91 MB | NPU
64
+ | FOMMDetector | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 2.857 ms | 0 - 91 MB | NPU
65
+ | FOMMGenerator | ONNX | float | Snapdragon® X Elite | 22.761 ms | 88 - 88 MB | NPU
66
+ | FOMMGenerator | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 16.694 ms | 0 - 176 MB | NPU
67
+ | FOMMGenerator | ONNX | float | Qualcomm® QCS8550 (Proxy) | 23.05 ms | 18 - 21 MB | NPU
68
+ | FOMMGenerator | ONNX | float | Qualcomm® QCS9075 | 35.444 ms | 18 - 22 MB | NPU
69
+ | FOMMGenerator | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 13.959 ms | 14 - 153 MB | NPU
70
+ | FOMMGenerator | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 10.851 ms | 0 - 150 MB | NPU
71
 
72
  ## License
73
  * The license for the original implementation of First-Order-Motion-Model can be found
74
  [here](https://github.com/AliaksandrSiarohin/first-order-model/blob/master/LICENSE.md).
75
 
 
 
76
  ## References
77
  * [First Order Motion Model for Image Animation](https://arxiv.org/abs/2003.00196)
78
  * [Source Model Implementation](https://github.com/AliaksandrSiarohin/first-order-model/tree/master)
79
 
 
 
80
  ## Community
81
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
82
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
 
 
tool-versions.yaml DELETED
@@ -1,4 +0,0 @@
1
- tool_versions:
2
- onnx:
3
- qairt: 2.37.1.250807093845_124904
4
- onnx_runtime: 1.23.0