Comments (9)
I have narrowed this down to the model.json array structure being structured differently on .save() with latest alpha releases. I have to step back to version [email protected] to get the model load() function to work but of course this is not compatible with the latest ml5.hand.pose
Is there a fix that can be made to the json array structure so load() will work with the later alpha versions of ml5?
from ml5-library.
JSON structure for version 0.4.3
{"modelTopology":{
"class_name":"Sequential",
"config":[{"class_name":"Dense","config":{"units":16,"activation":"sigmoid","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense1","trainable":true,"batch_input_shape":[null,2],"dtype":"float32"}},{"class_name":"Dense","config":{"units":1,"activation":"sigmoid","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense2","trainable":true}}],"keras_version":"tfjs-layers 1.2.2","backend":"tensor_flow.js"},"weightsManifest":[{"paths":["./model.weights.bin"],"weights":[{"name":"dense_Dense1/kernel","shape":[2,16],"dtype":"float32"},{"name":"dense_Dense1/bias","shape":[16],"dtype":"float32"},{"name":"dense_Dense2/kernel","shape":[16,1],"dtype":"float32"},{"name":"dense_Dense2/bias","shape":[1],"dtype":"float32"}]}]}
from ml5-library.
model.JSON for later versions
{
"modelTopology": {
"class_name": "Sequential",
"config": {
"name": "sequential_1",
"layers": [
{
"class_name": "Dense",
"config": {
"units": 16,
"activation": "relu",
"use_bias": true,
"kernel_initializer": {
"class_name": "VarianceScaling",
"config": {
"scale": 1,
"mode": "fan_avg",
"distribution": "normal",
"seed": null
}
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"kernel_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"bias_constraint": null,
"name": "dense_Dense1",
"trainable": true,
"batch_input_shape": [null, 42],
"dtype": "float32"
}
},
{
"class_name": "Dense",
"config": {
"units": 1,
"activation": "sigmoid",
"use_bias": true,
"kernel_initializer": {
"class_name": "VarianceScaling",
"config": {
"scale": 1,
"mode": "fan_avg",
"distribution": "normal",
"seed": null
}
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"kernel_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"bias_constraint": null,
"name": "dense_Dense2",
"trainable": true
}
}
]
},
"keras_version": "tfjs-layers 4.8.0",
"backend": "tensor_flow.js"
},
"weightsManifest": [
{
"paths": ["./model.weights.bin"],
"weights": [
{
"name": "dense_Dense1/kernel",
"shape": [42, 16],
"dtype": "float32"
},
{ "name": "dense_Dense1/bias", "shape": [16], "dtype": "float32" },
{ "name": "dense_Dense2/kernel", "shape": [16, 1], "dtype": "float32" },
{ "name": "dense_Dense2/bias", "shape": [1], "dtype": "float32" }
]
}
]
}
from ml5-library.
So you can see config is structured differently.
from ml5-library.
Although to note: the newer JSON structure works fine with classification and can be saved and loaded without issue. Its only regression i am seeing this error
from ml5-library.
This is definitely specific to
https://unpkg.com/[email protected]/dist/ml5.js
I can now run the regression training, saving and loading with
'https://unpkg.com/ml5@latest/dist/ml5.min.js'
from ml5-library.
Looks like the 0.4.3 version stores the array of layers as the modelTopology.config
property, whereas in the newer version it is modelTopology.config.layers
. This may have been a change in how TFJS saves the file. We would want to support legacy files which were trained under the old version.
The specific error message "modelTopology field is missing from file model.json" is odd though. It makes me wonder if we are passing it to TFJS incorrectly. Like passing a portion of the object rather than the whole object. Or passing model_meta.json
instead of model.json
or something like that.
from ml5-library.
So I have tried to see if editing the array structure from how the modelTopology.config
is formatted to the newer version of modelTopology.config.layers
matters and is doesn't matter to https://unpkg.com/ml5@latest/dist/ml5.min.js
versions (eg: it accepts both old and new array structures / old and new ways the file is saved) but neither array structure works for https://unpkg.com/[email protected]/dist/ml5.js
which makes me think it isn't directly the array structure but more the way the model.json
or model_meta.json
file is loaded in load()
function in the alpha versions of ML5 as you suspect.
from ml5-library.
It is also unrelated to handpose.js as this error persists even on a simple mouse position regression example.
from ml5-library.
Related Issues (20)
- DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': Tainted canvases may not be loaded. HOT 1
- knnClassifier result after .save() and .load() - classIndex becomes undefined and label becomes number, labelToClassId disappears HOT 1
- memory leak in featureExtractor on addImage in WebGL backend HOT 3
- ML5 fails to load on Chrome incognito - localstorage error HOT 1
- PoseNet Bug using custom trained model in a reactjs environment HOT 6
- about use ml5 in vue HOT 1
- How should we handle input data with Nulls/Blanks? HOT 1
- Always outputting the same thing. Might be something wrong with my HTML not sure HOT 2
- add facemesh and handpose to preload
- Possible memory leak in BodyPix and WEBGL
- Various problems with the training-charRNN repo
- Problem with CORS HOT 1
- ERR_CONNECTION_REFUSED
- New m15 Coder, couldn't find answer online, Error "Error in oneHot: depth must be >=2, but it is 1" HOT 1
- "Feature Extractor Examples" from ml5.js website / TypeError: Failed to fetch HOT 9
- Need some information on using NeuralNetworkVis HOT 4
- Fetch data from GitHub repo as JSON doesn't work HOT 1
- Feature Request- open up dovalidation and validationData property on FeatureExtractor class HOT 1
- custom
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 ml5-library.