Using a FOMO Model used on an OpenMV RT1062 on N6 Board

I’ve recently purchased the latest N6 board and I’m trying to get my old RT1062 code working on the new board. I was using a FOMO model that I trained with Edge impulse, and quantized at INT8. Is there something I need to do to get this model working on the new N6 board? If I run it as is I get the Failed to load error. I tried to use the ‘Convert Model for NPU’ tool within the ‘Machine Vision’ dropdown menu and this causes the board to disconnect and reconnect but there is no error message.

This is the code I’m using to load the model at the moment that Edge impulse provides

try:
    net = ml.Model("TrainedModel.tflite", load_to_fb=uos.stat('TrainedModel.tflite')[6] > (gc.mem_free() - (64*1024)))
except Exception as e:
    raise Exception('Failed to load "TrainedModel.tflite", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')')

try:
    labels = [line.rstrip('\n') for line in open("labels.txt")]
except Exception as e:
    raise Exception('Failed to load "labels.txt", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')')

Any suggestions would be greatly appreciated!

Hi, you need to run it through the NPU conversion tool.

What version of the IDE are you using? Please grab the latest one: Download – OpenMV

To convert the model, you need to do:

  1. Tools→Edit ROM FS
  2. After the dialog loads. Click add file.
  3. The STEdge AI NPU tool will load and convert the model.
  4. Then click commit to write the ROMFS back to the N6.

Afterward, you can run the model by accessing it via:

ml.Model("/rom/TrainedModel.tflite")

You should see 120+ FPS performance.

Hi,

I’m using version 4.8.8. I tried following these steps but it still does the same thing. If I reopen the ROMSF I can see the model there but the device still disconnects and then reconnects when I try to run my code. Any suggestions?

Can you post your model? Or, send it to me in a PM.

Hi, any progress? Have same issue with fomo network generated from edge impulse.

Hi, I found the issue.

When using the Write to ROM tool, it asks you for model conversion. The conversion is successful, based on the log, but the original model is actually written to the ROM.

The solution is to convert the model using OpenMV → Tools → Machine Vision → Convert Model for NPU. Save this converted model, and then use the ROM writing tool. It works fine after that.