question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding custom properties to model.json upon save?

See original GitHub issue

Hello! I’m writing on behalf of the ml5 project. In a meeting today with @cvalenzuela and other contributors we discussed some questions around the saving and loading features for ml5. This is discussed in more detail at https://github.com/ml5js/ml5-library/issues/174.

We are wrapping the tf.js save() method in our ImageClassifier class for use with the FeatureExtractor example. model.json and model.weights.bin work “out of the box” with ml5, however our examples include additional functionality. For example, we allow the end user to specify a string label for a class rather than a numeric index. To be able to retain this information when saving, we would like to be able to customize model.json with ml5 specific properties.

What do you think about adding an optional argument to save() that allows for customization, e.g.

const ml5prop = { 
  labels: ['cat', 'dog']
};
model.save(destination, ml5prop);

This could be good for other use cases where tf.js users have other meta-data they would like to include.

Let us know your thoughts. We are happy to work on a pull request for this. Or perhaps you have a better idea for how we should be handling saving/loading on our end?

@cvalenzuela let me know if I missed anything or am not describing this properly!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
caisqcommented, Oct 5, 2018

I think this is a reasonable feature request.

1reaction
nsthoratcommented, Oct 18, 2018

weightSpecs are a subset of weightsManifest that don’t contain the paths. weightsSpecs are of type WeightsManifestEntry, here is the corresponding entry in the weights manifest: https://github.com/tensorflow/tfjs-core/blob/master/src/io/types.ts#L59

You can just kick off a download using a Blob, createObjectURL and forcing a link (google how to trigger file download from JS).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jackson: How to add custom property to the JSON without ...
Simply wrap the POJO in a MorphedResult, and then add or remove properties at will. When serialized, the MorphedResult wrapper disappears and any...
Read more >
How to customize property names and values with System. ...
To set the name of individual properties, use the [JsonPropertyName] attribute. Here's an example type to serialize and resulting JSON: C# Copy.
Read more >
Configure custom properties
Let's add a first custom property to the document entity for the JSON target. It will be a dropdown control for a list...
Read more >
Create Custom Properties in Infraworks
NOTE: I strongly recommend you create a test model that you can work on to test your im.schema.json file before loading up in...
Read more >
Introduction to Model IO — xgboost 1.7.2 documentation
ubj for binary JSON) as file extension when saving/loading model: booster.save_model('model.json') . More details below. Before we get started, XGBoost is a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found