Comments (6)
Hi,
at least Keras 2.2.4 is known to work. We know that at least tf.keras
has a small difference in the format even in the same version (I do not recall exactly what it was, I believe it was in the UpSampling2D
layer). To find out where exactly the error comes from, it would be good to have a stack trace at the point of the ASSERT.
The missing load
method is an artefact from the B-Human version which contains another load...
method for another file format. It is fixed now.
PS: Upon looking at the changelog of Keras, it may be from a Flatten
layer which got the data_format
attribute only in version 2.1.6. In that case, lines 448 to 451 can just be commented out.
from compilednn.
Thanks for the quick answer!
Unfortunately commenting the lines for Flatten
did not yet work.
This is the backtrace:
#0 0xf7fdaa62 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0xf736ab19 in __GI_raise (sig=6)
at /usr/src/debug/glibc/2.23-r0/git/sysdeps/unix/sysv/linux/raise.c:54
#2 0xf736bfd7 in __GI_abort () at /usr/src/debug/glibc/2.23-r0/git/stdlib/abort.c:89
#3 0x087b6f93 in Assert::abort ()
at /home/timm/workspaceNao/robocupag/framework/external/CompiledNN/Src/Platform/BHAssert.cpp:82
#4 0x08784dc3 in NeuralNetwork::getRecordEntrySimpleMap::Record (record=record@entry=0xeceaef68,
name=...) at /home/timm/workspaceNao/robocupag/framework/external/CompiledNN/Src/Model.cpp:295
#5 0x0877a607 in NeuralNetwork::Model::parseJSONModel(In&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::function<void (std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::vector<float, std::allocator >&, std::vector<unsigned int, std::allocator >&)> const&) (this=this@entry=0xece5fcf4, stream=..., fileName=..., getWeights=...)
at /home/timm/workspaceNao/robocupag/framework/external/CompiledNN/Src/Model.cpp:945
#6 0x0877c8bf in NeuralNetwork::Model::loadKerasHDF5 (this=this@entry=0xece5fcf4, filename=...)
at /home/timm/workspaceNao/robocupag/framework/external/CompiledNN/Src/Model.cpp:1205
Which points to:
const SimpleMap::Record* config = getRecordEntry<SimpleMap::Record>(root, "config");
from compilednn.
I just tested a very simple network (one Conv2D layer) exported from keras 2.1.3 and it works. The error is rather confusing because on the one hand, this is the first JSON element that is explicitly asked for in the code (indicating something very basic is going wrong), on the other hand the JSON parser itself should already ASSERT/FAIL if the embedded JSON was invalid.
The easiest would probably be if you sent me the HDF5 model file (untrained is sufficient 😉).
from compilednn.
This is the network's h5 file.
I should add.. this is trained in PyTorch, the weights have then been transferred to Keras. The model is tested in Keras and has same performance.
from compilednn.
The problem is that we currently only support models that are created with Keras' Functional API and not the Sequential API (we assumed that the Functional API would be much more common). I have just implemented this, only to find out that the JSON format of Sequential models has also changed a little from Keras 2.1 to 2.2 (luckily, it seems that 2.3 did not change significantly to 2.2), so I will need to make the parser version-aware now (which is probably a good idea anyway).
The next problem, however, is that we currently can only handle data in the channels_last format (which is the default when using Keras with the TensorFlow backend) and your model uses channels_first. I am not sure whether CompiledNN can be easily changed to handle this. I will think about that.
from compilednn.
The channels_last format is something I should easily fix on my side as it is a thing I took over from PyTorch. Also I have not thought about Functional vs Sequential as I don't have much background in Keras. Now that I am aware I can adapt my code.
I guess I will mark this closed for now.
Thank you very much for the efforts! And of course for publishing this!
(P.S.: I will come back to you if I have troubles again ;D)
from compilednn.
Related Issues (20)
- GlobalPooling2D: support an arbitrarily large channel dimension
- Documentation HOT 4
- Segmentation Fault in Tensor.h:225 HOT 1
- Finish Im2Col implementation
- Implement Conv1x1
- Fuse BatchNormalization followed by (D)Conv2D
- DConv2D does not work for channel numbers that are not multiples of 4 or do not fit into SSE registers
- Quantization
- Fusing UInt8Input+BatchNormalization only works if number of channels is a multiple of 4 HOT 1
- Installation fails HOT 1
- 'Platform/BHAssert.h' file not found HOT 2
- Onnx support HOT 2
- Support Conv1D and MaxPooling1D
- build failed HOT 6
- ASSERT(input.dims(2) <= settings.xmmRegs() * 4) failed HOT 2
- Testing
- Conv2D: canBeInplace-condition is wrong
- Conv2D: biasOffset thing is not working
- Softmax: support multi-dimensional tensors and an arbitrary softmax axis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compilednn.