Importing metadata¶
It might not be convenient to maintain a huge model-index.yml
file in your repository. So model-index
make it easy
to split data into smaller file.
Data can be imported from other YAML files, JSON files and from Markdown files.
Importing fields¶
For Models, Metadata and Results you can provide a filename instead of actual values. For example:
Models:
- Name: Inception v3
Metadata: models/metadata/inception_v3.yml
Results: models/metadata/inception_v3_results.json
Both YAML and JSON are supported. The content of the file needs to conform to the expected structure specified for Models, Metadata and Results.
So in this case, inception_v3.yml
could look like this:
Batch Size: 120
Epochs: 100
Dropout: 0.1
and inception_v3_results.json
could look like this:
[
{
"Task": "Image Classification",
"Dataset": "ImageNet ReaL",
"Metrics": {
"Accuracy": "90.2%"
}
}
]
Importing a whole YAML file¶
You can split the model index into smaller files (e.g. containing a single collection of related models)
and then import them into the main model-index.yml
file:
Import:
- models/metadata/inception_models.yml
Here the inception_models.yml
file has to be in ModelIndex format
(i.e. the same as the root model-index.yml
file). For example:
Collection:
- Name: Inception models
Models:
- Name: Inception v3 (original)
In Collection: Inception models
Metadata:
Epochs: 90
- Name: Inception v3 (retrained)
In Collection: Inception models
Metadata:
Epochs: 120
Importing a whole JSON file¶
The imported file can also be in JSON format, as long as it has the same structure as the YAML:
Import:
- models/metadata/mnasnet_100.json
- models/metadata/mnasnet_200.json
So one of these JSON files could look like:
{
"Epochs": 120,
"Dropout": 0.2
}
Importing a whole Markdown file¶
Import:
- docs/rexnet.md
Instead of specifying the README
field of the model, you can add the model metadata directly into the markdown file.
Include the metadata in YAML format in a comment, with a Type: model-index
key to indicate that it should be parsed
by the model-index
library. So, the rexnet.md
could look like this:
<!--
Type: model-index
Models:
- Name: RexNet
Metadata: ../models/metadata/rexnet.json
Results: ../models/metadata/rexnet_results.json
-->
# Summary
Rank Expansion Networks (ReXNets) follow a set of new design principles for
designing bottlenecks in image classification models.
## How to use this model
....
Using wildcards to import multiple files¶
Specify wildcards to import multiple files:
Import:
- docs/*.md
- models/metadata/*.json