majianjia / nnom

A higher-level Neural Network library for microcontrollers.
Apache License 2.0
820 stars 235 forks source link

nnom have no suppoprt on incremental training models #121

Open JerrySkywalker opened 3 years ago

JerrySkywalker commented 3 years ago

When I used nnom to transform my model into c source file, it failed to generate the model because of KeyError (could not find correct layer name).

I've checked my source and found that nnom is ok only when there is one model.fit(). If I run more than one fit() on one model, it crashed. So I've checked the keras layer naming mechanism. It appears that keras names the layer automatically with the pattern: "the-layer-type_the-order-of-this-type-of-layer_fit-times-if-you-run-fit()-more-than-once)" ,but currently nnom only recongnize the first two part and has no regex to match "_fit-time".

For example, the name of the layer is actually "input_1_2", but nnom only get "input_1"

图片

I think it can be solved by changing the name acquiring method of LI[].

majianjia commented 3 years ago

Yes indeed, the converter is largely relying on the naming of the layer, it causes many troubles already. I am looking for a good way to do it properly. Feel free to modify the script and try.