You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/06.nicla/boards/nicla-vision/tutorials/image-classification/content.md
+6-23Lines changed: 6 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,33 +143,18 @@ The ML model is trained and already optimized to be used with microcontrollers.
143
143
144
144
### Deploy
145
145
146
-
Deploying the ML model to your board requires a few steps. The Edge Impulse® Studio provides an export feature for OpenMV. Switch to the deployment section in the menu, select OpenMV under "Build firmware" and click "build". This will create an OpenMV compatible library and download it as a zip file. Unzip it.
146
+
Deploying the ML model to your board requires a few simple steps. The Edge Impulse® Studio provides an export feature for OpenMV. Since the Nicla Vision doesn't have any on-board SRAM we need to bake the machine learning model into the firmware and load it from the flash. Switch to the deployment section in the menu, select "OpenMV Firmware" under "Configure your deployment" and click "build". This will create an OpenMV compatible firmware that includes the machine learning model. Unzip the file once it's downloaded. The download should start automatically.
147
147
148
148

149
149
150
-
Since the Nicla Vision doesn't have any on-board SRAM we need to build the machine learning model into the firmware and load it from the flash. To do so, go to https://github.com/openmv/openmv and [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the repository. In your fork click on "Actions" and enable the workflows by clicking on the green button.
151
150
152
-
Rename the machine learning model and the label file to fruit_detection.tflite and fruit_detection.txt respectively. In your fork, replace the built-in machine learning model under `src/lib/libtf/models` with the model you downloaded from Edge Impulse® Studio. Commit the files and push the commit to the repository. It will build a new firmware automatically.
153
-
154
-

155
-
156
-
You can inspect the build process under "Actions".
157
-
158
-

159
-
160
-
Once the firmware has been built you can download it from the releases section that you can find in the "Code" tab. Put the board in bootloader mode and click on the connect symbol in the OpenMV IDE. In the dialog select "Load a specific firmware". Select `firmware.bin` in the folder that you just created and flash it to the board.
161
-
162
-

151
+
Put the board in bootloader mode and click on the connect symbol in the OpenMV IDE. In the dialog select "Load a specific firmware". Select `edge_impulse_firmware_arduino_nicla_vision.bin` in the folder that you created while unziping the downloaded file and flash it to the board.
163
152
164
153
### Run the Script
165
154
166
-
The final step is to run the **ei_image_classification.py** script. Open it in the OpenMV. As the model is now baked into the firmware you need to adjust the lines where it loads the model and the labels as follows:
155
+
The final step is to run the **ei_image_classification.py** script. Open it in the OpenMV IDE.
167
156
168
-
```python
169
-
labels, net = tf.load_builtin_model('fruit_detection')
170
-
```
171
-
172
-
Also, replace the print statement in the innermost for loop with the following code:
157
+
Replace the print statement in the innermost for loop with the following code:
173
158
174
159
```python
175
160
confidence = predictions_list[i][1]
@@ -199,7 +184,7 @@ sensor.set_hmirror(True)
199
184
sensor.set_windowing((240, 240)) # Set 240x240 window.
200
185
sensor.skip_frames(time=2000) # Let the camera adjust.
201
186
202
-
labels, net = tf.load_builtin_model('fruit_detection')
187
+
labels, net = tf.load_builtin_model('trained')
203
188
204
189
clock = time.clock()
205
190
while(True):
@@ -231,6 +216,4 @@ You have learned about classification as a machine learning concept which catego
231
216
232
217
## Troubleshooting
233
218
234
-
### GitHub Workflow
235
-
236
-
If you’re encountering difficulties while using the GitHub workflow in your forked repository, make sure that you chose `MobileNetV2 96x96 0.1` as model type, otherwise the model will likely be too big. Also make sure you are changing the files in your own, forked repository and not in the original OpenMV repository.
219
+
If you’re encountering difficulties while deploying your machine learning model, make sure that you chose `MobileNetV2 96x96 0.1` as model type, otherwise the model will likely be too big.
0 commit comments