metadata
sleap_nn.export.metadata
¶
Metadata helpers for exported models.
Classes:
| Name | Description |
|---|---|
ExportMetadata |
Metadata embedded or saved alongside exported models. |
Functions:
| Name | Description |
|---|---|
build_base_metadata |
Create an ExportMetadata instance with standard defaults. |
embed_metadata_in_onnx |
Embed metadata into an ONNX model file. |
extract_metadata_from_onnx |
Extract metadata from an ONNX model file. |
hash_file |
Compute SHA256 hash for a file. |
ExportMetadata
dataclass
¶
Metadata embedded or saved alongside exported models.
Methods:
| Name | Description |
|---|---|
default_timestamp |
Return an ISO timestamp for export. |
from_dict |
Load from dict. |
load |
Load from JSON file. |
save |
Save to JSON file. |
to_dict |
Convert to JSON-serializable dict. |
Source code in sleap_nn/export/metadata.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
default_timestamp()
classmethod
¶
from_dict(data)
classmethod
¶
Load from dict.
Source code in sleap_nn/export/metadata.py
load(path)
classmethod
¶
save(path)
¶
to_dict()
¶
Convert to JSON-serializable dict.
Source code in sleap_nn/export/metadata.py
build_base_metadata(*, export_format, model_type, model_name, checkpoint_path, backbone, n_nodes, n_edges, node_names, edge_inds, input_scale, input_channels, output_stride, crop_size=None, max_instances=None, max_peaks_per_node=None, max_batch_size=1, precision='fp32', training_config_hash='', training_config_embedded=False, input_dtype='uint8', normalization='0_to_1', n_classes=None, class_names=None, peak_threshold=None, anchor_part=None)
¶
Create an ExportMetadata instance with standard defaults.
Source code in sleap_nn/export/metadata.py
embed_metadata_in_onnx(model_path, metadata, training_config_text=None)
¶
Embed metadata into an ONNX model file.
Raises ImportError if onnx is unavailable.
Source code in sleap_nn/export/metadata.py
extract_metadata_from_onnx(model_path)
¶
Extract metadata from an ONNX model file.
Raises ValueError if metadata is missing.
Source code in sleap_nn/export/metadata.py
hash_file(path)
¶
Compute SHA256 hash for a file.