OSError: Could not find the file for module nn

When i tried to run the cifar10 network program,it is showing the following error. How can i solve this.
OSError: Could not find the file.
nn.load(‘/cifar10.network’)

You need to put the network on the OpenMV Cam’s disk. That said, the cifar10 net doesn’t run on the OpenMV Cam M7. You can run the cifar10 fast net on the OpenMV Cam.

If you want to do that, please add softmax=True to the nn.forward() call.

Hello,

I am new to openmv. I am interested to test nn with openmv. The first thing I try to do is download the smile.network, but I can not copy this network into the disk. When I connect the openmv cam to the windows pc, it is showing “0 Byte free of 79.0K byte”.

Regards,

Baozhu

Hi, use an SD card.

Hi, Thanks, I just put 8G SD card.

I can now downloaded cifar10.network/cifar10_fast.network and copy into the disk, and try the example code

net = nn.load(‘/cifar10_fast.network’)
labels = [‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’]

clock = time.clock()
while(True):
clock.tick()

img = sensor.snapshot()

for obj in net.search(img, threshold=0.6, min_scale=0.4, scale_mul=0.8,
x_overlap=0.5, y_overlap=0.5, contrast_threshold=0.5):
print(“Detected %s - Confidence %f%%” % (labels[obj.index()], obj.value()))
img.draw_rectangle(obj.rect(), color=(255, 0, 0))
print(clock.fps())


But the results are always :
First layer is NULL!
First layer is NULL!
49.31507
First layer is NULL!
First layer is NULL!

Where can be the problem, please? The network downloaded from the githup is not a already trained network?

Regards,

Baozhu

Looks like the file may be corrupted or you didn’t download the file from github. You have to download the raw file:

https://raw.githubusercontent.com/openmv/openmv/master/ml/cmsisnn/models/cifar10_fast/cifar10_fast.network


Also make sure the file is written before resetting the camera (safely remove the disk if you have to).

Thanks iabdalkader, I copy the network you give into the disk and now it works.

Regards,

Baozhu

Hi @iabdalkader
This link is not existing anymore. Could you help the situation with newer solutions please?

We switched to Tensorflow, these old models won’t work anyway, you should use EdgeImpulse to train (or find a pre-trained) model.

I use edge impulse and trained model. I get a “failed to upload labels.txt” error:
image.
I also installed SD drive and it doesn’t work

Did you copy the files to the drive?

Hi @iabdalkader i dont want to use edge impulse and i want to train my models on my local computer. Also I ve researched pre-trained models and i ve found some tflite files. Whenever i try to load to OpenMV H7 Plus cam, it crashes without any RAM issue and that means i think these files are not supported.

Could you advice any pre-trained object detection tflite models for OpenMV beacuse i couldnt find?

We basically just support the edge impulse. If you are getting a crash it’s because your model is not using an op in the supported ops table: tensorflow-lib/libtf.cc at master · openmv/tensorflow-lib · GitHub

I need to stress that Edge Impulse is the only company that produces reliable tensorflow networks for tensorflow lite. If you are not using them then you are just in for a world of pain.