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

How to use the ONNX models? #63

Closed
noureddine-as opened this issue Apr 10, 2020 · 3 comments
Closed

How to use the ONNX models? #63

noureddine-as opened this issue Apr 10, 2020 · 3 comments

Comments

@noureddine-as
Copy link

noureddine-as commented Apr 10, 2020

Hello,

I would like to export C applications from the ONNX models, in order to avoid the training phase, due to my limited resources.

So here is what I did

  • First I installed the ONNX models using the Python script provided in tools/
  • I managed to setup the ILSVRC2012 dataset (well, I guess .. I couldn't access the official one, but anyway N2D2 seems to find the stimulis now)
  • Now, when I execute this
n2d2 "$N2D2_MODELS/ONNX/vgg16-onnx.ini" -test

I get the following:

Loading directory database "blabla/disk-data/ILSVRC2012/train/n13052670"
Found 1277267 stimuli
Loading directory database "blabla/disk-data/ILSVRC2012/train/n13054560"
Found 1278567 stimuli
Loading directory database "blabla/disk-data/ILSVRC2012/train/n13133613"
Found 1279867 stimuli
Loading directory database "blabla/disk-data/ILSVRC2012/train/n15075141"
Found 1281167 stimuli
Notice: Unused section soft1.Target in INI file
Notice: Unused section common.config in INI file
Time elapsed: 4.75089 s
Error: No cell generator for type 'ONNX'.

And the same happens with $N2D2_MODELS/models/MobileNet_ONNX.ini.

My questions are:

  • Did I miss something here?
  • If I understand well, the ONNX models do not need to be trained right?
  • Is there another way to get pre-trained models to be exported in C form?

Best regards.

@noureddine-as
Copy link
Author

Hi again,

Actually, even training results in a problem! Following is what I get from "$N2D2_MODELS/VGG16.ini"
Any ideas?

.....
Found 1281167 stimuli
Invalid registrar key "SliceExtractionTransformation"
Notice: Unused section sp.OnTheFlyTransformation-2 in INI file
Notice: Unused section sp.OnTheFlyTransformation-3 in INI file
Notice: Unused section conv_def in INI file
Notice: Unused section conv1_1 in INI file
Notice: Unused section conv1_2 in INI file
Notice: Unused section pool1 in INI file
Notice: Unused section conv2_1 in INI file
Notice: Unused section conv2_2 in INI file
Notice: Unused section pool2 in INI file
Notice: Unused section conv3_1 in INI file
Notice: Unused section conv3_2 in INI file
Notice: Unused section conv3_3 in INI file
Notice: Unused section pool3 in INI file
Notice: Unused section conv4_1 in INI file
Notice: Unused section conv4_2 in INI file
Notice: Unused section conv4_3 in INI file
Notice: Unused section pool4 in INI file
Notice: Unused section conv5_1 in INI file
Notice: Unused section conv5_2 in INI file
Notice: Unused section conv5_3 in INI file
Notice: Unused section pool5 in INI file
Notice: Unused section fc6 in INI file
Notice: Unused section fc6.drop in INI file
Notice: Unused section fc6.dropconfig in INI file
Notice: Unused section fc7 in INI file
Notice: Unused section fc7.drop in INI file
Notice: Unused section fc7.dropconfig in INI file
Notice: Unused section fc8 in INI file
Notice: Unused section soft1 in INI file
Notice: Unused section soft1.Target in INI file
Notice: Unused section common.config in INI file
Time elapsed: 5.12852 s
Error: bad_function_call

Best regards.

@olivierbichler-cea
Copy link
Contributor

Hi,

You are relating two separate issues here:

  1. To enable ONNX support, you must compile with ONNX=1 in the make command. Right now, only the Makefile supports it, not CMake.

=> An ONNX support in CMake would be a must. We should eventually add it, but of course help is welcome to add it earlier.

  1. The SliceExtractionTransformation used in the VGG model is not included in the open source version of N2D2. You can remove it from the model to solve the issue.

=> Adding some missing transformations in the open source version of N2D2 is under consideration.

Cheers,
Olivier

@olivierbichler-cea
Copy link
Contributor

Closing this issue, which should be solved now:

  • ONNX is now integrated in the CMake;
  • The SliceExtractionTransformation is now open source.

olivierbichler-cea added a commit that referenced this issue Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants